• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

DispatchAction No action instance for path ...

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check whether you are passing the value 'create' for the parameter 'method' in the request?
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you provide the full jsp code?
 
Kris Bal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also provide your full web.xml,struts-config.xml
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic