File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes DispatchAction No action instance for path ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DispatchAction No action instance for path ..." Watch "DispatchAction No action instance for path ..." New topic
Author

DispatchAction No action instance for path ...

Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
Hi there,
after a form is sent to a DispatchAction (which should works as CRUD) returns me the following error:

09:45:28,474 ERROR [RequestProcessor] No action instance for path /userManagement could be created
java.lang.NullPointerException
at xx.xxxxxxx.struts.action.user.UserDispatchAction.<init>(UserDispatchAction.java:54)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

The struts-config.xml

and the class

from the logger I can see that the UserService is correctly instancied but the code doesn't get to the [create] start! line.
It seems that this error could be related to different reasons, but the majority complains that the class doesn't extends the Action.

DispatchAction extends Action...
so what's the problem?

Thanks in advance


trying to decode a woman mind....
Kris Bal
Greenhorn

Joined: Dec 24, 2006
Posts: 19
check whether you are passing the value 'create' for the parameter 'method' in the request?
Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
I also tried with an hidden input form, but nothing changed.
<html:form action="/userManagement?method=create" method="post" styleClass="f-wrap-1">
Kris Bal
Greenhorn

Joined: Dec 24, 2006
Posts: 19
can you provide the full jsp code?
Kris Bal
Greenhorn

Joined: Dec 24, 2006
Posts: 19
Also provide your full web.xml,struts-config.xml
Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
the jsp (it's a tile) and the validation works fine


web.xml
I don't know if this may be the cause, but I wanted to implement the annotations and so the version is 2.5

struts-config

there's somthing which I'm not really sure of, and maybe is related to this issue. On startup there's a plugin which should store my facade bean, belowe the code

[ May 10, 2007: Message edited by: Alessandro Ilardo ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
As I look at the error message you're getting, it appears that your UserDispatchAction class may be throwing a NPE in the constructor. The message tells you what line number the error is on: 54. Look at line 54 of your UserDispatchAction class and try to determine why some object being dereferenced is null when you're not expecting it to be.


Merrill
Consultant, Sima Solutions
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Alessandro,

-can you show us what's in the init()-method of your UserDispatchAction?
(especially line 54).
-do you extend the org.apache.struts.actions.DispatchAction?

Herman
Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
hi guys,
thanks for reply

belowe line 54
private UserEntityLocal UserBean = (UsrEntityLocal)servlet.getServletContext().getAttribute(Constants.USER);


I'm trying to store the ejb in the servlet context (see code belowe) in order to keep it available to my classes without make everytime a look up for it.

note that at startup time the log message above is correctly shown without any error message.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It seems to me that the most likely possibility is that the servlet variable is null. This variable is declared by the superclass, but I'm wondering if you override it or set it to null in your class. A safer way of coding it would be:
Kris Bal
Greenhorn

Joined: Dec 24, 2006
Posts: 19
Don't keep the parameter name as method.

change the parameter name from method to something else you want.
<action ... parameter="method"...> in struts-config.xml

Also correspondingly change in the jsp/html where you pass the value for the parameter.


Because method='post' is there and it will only be taken.You should not use the name 'method' for the action mapping parameter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DispatchAction No action instance for path ...