Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException when calling an action class

 
Thyagarajan Ramanujam
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Regards
Jatan
 
Thyagarajan Ramanujam
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks for your reply. I added those jar. But still not able to resolve the issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic