奇怪的tomcat问题,估计是涉及到它的加载过程,求高人指点 5C

有个奇怪的tomcat问题:本人用jdk1.8+spring 开发的web项目,利用Tomcat插件,开发的web项目,如果配置的是tomcat6.26,则 启动调试过程正常,但打包出来后运行Tomcat,则报错如下:
严重: Exception Processing ErrorPage[exceptionType=java.lang.Throwable, location=/common/500.jsp]
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:415)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:270)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)

但如果放在tomcat 7底下,则运行正常。

  1. 如果调试时采用tomcat7 来调试,则有出错:
    java.lang.ClassCastException: org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor cannot be cast to javax.servlet.Filter

    问题可能出在tomcat的运行和调试时所加载的包有所区别,但具体原因是什么?怎么解决?

2个回答

看看是不是因为Tomcat版本不同的问题, 你可以试试将tomcat相同版本,然后复制代码 重建一个项目 重新用新的Tomcat编译 我以前有个情况 和你差不多

帮你百度查了下。
有着两种解决方案,不知道能不能帮助你。
1,把jdk安装目录下的lib/tools.jar拷贝到tomcat安装目录下的common/lib目录下,然后重启tomcat
2,删除tomcat lib下面的 servlet.jar、jsp-servlet.jar爆包

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问