-5

Here is the directory structure of my java Struts based web application, and webRoot directory.

enter image description here

enter image description here

code is get compiled successfully but when i run it to browser it gives exception with HTTP Status 500:

org.apache.jasper.JasperException: java.lang.NullPointerException
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause 

java.lang.NullPointerException
    org.apache.jsp.index_jsp._jspInit(index_jsp.java:22)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

can anyone help me on this please Thanks in advance.

I tried the war file to run external tomcat-7 but showed same error, also found this org.apache.jasper.JasperException: java.lang.NullPointerException but not helpful for me.

Here is web.xml

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
 <display-name>Ilex Reports</display-name>
 <description>Report Server</description>
 <servlet>
  <servlet-name>rpt</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <init-param>
   <param-name>host</param-name>
   <param-value>localhost</param-value>
  </init-param>
  <init-param>
   <param-name>port</param-name>
   <param-value>80</param-value>
  </init-param>
 </servlet>
 <servlet-mapping>
  <servlet-name>rpt</servlet-name>
  <url-pattern>*.xo</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
  <welcome-file>/index.jsp</welcome-file>
 </welcome-file-list>
 <!-- Custom Tag Library Descriptors -->
 <taglib>
  <taglib-uri>http://jakarta.apache.org/tomcat/fb-taglib</taglib-uri>
  <taglib-location>/WEB-INF/tld/Element.tld</taglib-location>
 </taglib>
 <!-- Struts Tag Library Descriptors -->
 <taglib>
  <taglib-uri>/tags/struts-bean</taglib-uri>
  <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/tags/struts-html</taglib-uri>
  <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/tags/struts-logic</taglib-uri>
  <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/tags/struts-nested</taglib-uri>
  <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/tags/struts-tiles</taglib-uri>
  <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
 </taglib>
 <login-config>
  <auth-method>BASIC</auth-method>
 </login-config>
</web-app>
Community
  • 1
  • 1
NoNaMe
  • 6,020
  • 30
  • 82
  • 110
  • Not much of the information provided i guess. Add your `web.xml` and `web folder structure`, may be then we could help you out some. – roger_that Jul 17 '13 at 05:05

2 Answers2

1

Do one thing, the jsps are compiled into java servlets, so you can check the code and see at the appropriate line. The java files are I guess in work directory of tomcat.

Line of error

org.apache.jsp.index_jsp._jspInit(index_jsp.java:22)

Here is the file to look at.

index_jsp.java
Himanshu Bhardwaj
  • 4,038
  • 3
  • 17
  • 36
0

You've probably got a version mismatch, incorrect library versions, or else damaged/partial JSP compilation from earlier.

Have a look in the Tomcat/work directory (C:\Dev\Tomcat 6.0.35\work\Catalina\localhost\jr\org\apache\jsp\WEB_002dINF\jsp), on my system & you can see the source-code of your index_jsp.java file.

Clean the Tomcat/work directory to force recompilation of all JSPs.

From Tomcat 6, _jspInit() from an example JSP looks like:

public void _jspInit() {
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fc_005furl_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fescapeXml_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}

Essentially, this stuff should work -- so there is almost certainly a problem in your configuration.

Thomas W
  • 13,940
  • 4
  • 58
  • 76