wood burning stoves 2.0*
The moose likes Servlets and the fly likes null pointer exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "null pointer exception" Watch "null pointer exception" New topic
Author

null pointer exception

gurudev arer
Greenhorn

Joined: Apr 01, 2008
Posts: 6
Hi,

The following exception is logged in my application log. When this exception occurs my application hangs and i need to bounce the server.
I am not able to find out why am i getting this error. Please help.


[color=red]SEVERE: Servlet.service() for servlet action threw exception
java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1754)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)[/color]
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Seems like problem with your configurations. can paste the relevant xml here


[Servlet tutorial] [Servlet 3.0 Cook Book]
gurudev arer
Greenhorn

Joined: Apr 01, 2008
Posts: 6
Hi sudhir,
Thanks for the reply.
Here is the web.xml file

[code=java]
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>


<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>resources.application</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>

</servlet>


<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>/pages/static/Welcome.jsp</welcome-file>
</welcome-file-list>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

</web-app>

[/code]
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Please use proper code tag. It makes code readable.

Do you know when the error comes up? I mean, which screen or URL is giving you this error?
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

The problem is with your stuts mapping for some ActionForward.

Make sure the mapping.findForward("<forward name>") has a correct <forward name>

Try to give more info if that doesn't resolve the issue...


Java Experience
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: null pointer exception
 
Similar Threads
NullPointerException
File upload limit using tomcat
Spring and Hessian
Issues with Jboss Application Server - Error received
ServletException after JSP precompilation