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)
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?
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.
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.
Joined: Feb 15, 2005
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:
Joined: Dec 24, 2006
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.