Tomcat releases the WEB Project JSP page and returns a null pointer exception.

Source: Internet
Author: User
Tags apache tomcat
When you access the JSP page, the following message is displayed:
HTTP status 500-
 

TypeException report

Message

Description The server encountered an internal error () that prevented it from fulfilling this request.

Exception

org.apache.jasper.JasperException: java.lang.NullPointerExceptionorg.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)javax.servlet.http.HttpServlet.service(HttpServlet.java:617)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

Root Cause

java.lang.NullPointerExceptionorg.apache.jsp.WEB_002dINF.pages.imagecheck.test_jsp._jspInit(test_jsp.java:22)org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)javax.servlet.http.HttpServlet.service(HttpServlet.java:617)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

Note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.

 

After Baidu checked the cause, is the project lib under the jsp-api.jar and tomcat under the jsp-api.jar conflict caused. Because I used a user library in my project that contains two packages: jsp-api.jar and servlet-api.jar, and then copied the two packages to webroot/lib at myeclips release, the two packages under Tomcat lib are already in conflict, which is the main cause of this error.

The solution is to edit the Custom User library and set the user library to system library, so that the two jar packages will not be automatically copied when published through myeclips.

You can also add a configuration file under tomcat_home/CONF/Catalina/to specify webroot to release the project to avoid unnecessary automatic copying.

Previously, the project was released in the latter way. Today, I suddenly tested a code, and then I was lazy to use the release button on myeclipse to publish it to the webapps directory of Tomcat. The result is that today's problem occurs, and it is strange that the Code is not easy to use. After several hours, all sorts of things cannot be understood. It turns out to be caused by jar package conflicts throughout the whole day.

Spring MVC is ready for use. You can access JSP. Code---#

Apache Tomcat/6.0.35
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.