• java.lang.NullPointerException org.apache.jsp.WEB_002dINF.pages.imagecheck.test_jsp._jspInit(test_jsp.java:22)的原因


    HTTP Status 500 -
    type Exception report
    
    message
    
    description The server encountered an internal error () that prevented it from fulfilling this request.
    
    exception
    
    org.apache.jasper.JasperException: java.lang.NullPointerException
    	org.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.NullPointerException
    	org.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
    

      

    出现这个的原因是项目lib下面的jsp-api.jar和tomcat 下的jsp-api.jar有冲突导致的。因为项目里用到的library里包含了jsp-api.jar 和servlet-api.jar两个包,然后通过myeclips发布的时候将会这两个包复制到webroot/lib下去了,而tomcat的lib下面本来就有这两个包,导致了冲突,这就是这个错误产生的主要原因。

    解决方案是,编辑自定义user library,将user library设置为 system library,这样在通过myeclips发布时就不会自动拷贝这两个JAR包。

    或者通过在tomcat_home/conf/catalina/下面加一个配置文件指定webroot来发布项目,避免不必要的自动拷贝.

    以前都是用后一种方式发布的项目,今天突然测试一个代码,然后偷懒用myeclipse上的发布按钮发布到tomcat的webapps目录下的发布方式。结果就出现了今天的这个问题,还奇怪的怎么好好的代码就不好用了,整了好几个小时,各种百思不得其解啊。整半天原来是JAR包冲突导致的。


    上面是我百度的解决方法,我的解决方法很简单,就直接的将我们项目中的jsp-api.jar和jsp-api去掉就可以了。

  • 相关阅读:
    get(0)??
    抽象类中。。
    matlab函数
    unity_快捷键
    unity_ UI
    关于博客园使用
    survival shooter
    第七次团队作业:Alpha冲刺(3/10)
    第七次团队作业:Alpha冲刺(2/10)
    第七次团队作业:Alpha冲刺(1/10)
  • 原文地址:https://www.cnblogs.com/zr520/p/4877282.html
Copyright © 2020-2023  润新知