*
The moose likes Struts and the fly likes NullPointerException when calling an action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "NullPointerException when calling an action class " Watch "NullPointerException when calling an action class " New topic
Author

NullPointerException when calling an action class

Thyagarajan Ramanujam
Greenhorn

Joined: Mar 24, 2008
Posts: 25
Hi,

I am using eclipse Helios to develop a Struts 2 (using Struts 2.3.4.1.jar) application. I have added the jar files. I started developing as Dynamic Web Project in Eclipse. I am also using spring with the application.

When I call any action class, NullPointerException is thrown in StrutsActionProxy.java.
java.lang.NullPointerException
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:432)

While debugging the code, I found the cause for this: It says HttpServletRequest.java cannot be resolved. It is indirectly referenced from required .class files

I feel there are 2 jar files which contains the class. I found one is in spring-web-3.0.jar. And other will be automatically included by eclipse for a dynamic web project. I could not remove the spring jar because it contains ContextLoaderListner.class

I searched for possible solution. But I could not find any.

Any help is appreciated.
Thanks.
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi,

Have added server-api.jar , the error is indicating you havent added the servlet-api.jar file

Regards
Jatan
Thyagarajan Ramanujam
Greenhorn

Joined: Mar 24, 2008
Posts: 25

Thanks for your reply. I added those jar. But still not able to resolve the issue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException when calling an action class