我的eclipse,maven,tomcat配置有一个相当奇怪的问题。不知何故,我随机地为我的项目的主jsp(总是被调用并包含每个页面的主体的jsp)获得ClassNotFoundException。 应用程序在测试服务器和实时服务器上正常运行,而不会遇到此问题。 在继续清理项目后,在我的开发系统上,在Tomcat上清理并清理Tomcat工作目录,它有时会再次运行。但是大部分时间我都要做几次这个程序(10到20次)直到它再次开始工作。经过一些小的改动,它再次停止工作,我必须再次清洁和清洁10到20次,直到它再次开始工作。这真的很烦人,我现在真的知道如何解决这个问题。
例外:
org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.frame_jsp at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.RequestFilter.doFilter(RequestFilter.java:177) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.RequestAttributesFilter.doFilter(RequestAttributesFilter.java:146) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:384) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at com.framepool.web.VideoRequestProcessor.process(VideoRequestProcessor.java:64) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at com.framepool.web.ValidableActionServlet.doGet(ValidableActionServlet.java:59) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.RequestFilter.doFilter(RequestFilter.java:177) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.RequestAttributesFilter.doFilter(RequestAttributesFilter.java:146) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at com.framepool.web.filters.rest.LanguageFilter.doFilter(LanguageFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.DomainRedirectFilter.doFilter(DomainRedirectFilter.java:86) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.framepool.web.filters.XSSFilter.doFilter(XSSFilter.java:39) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.jsp.frame_jsp at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:145) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172) ... 66 more
答案 0 :(得分:2)
解决方案是完全删除eclipse / tomcat scratch dir。搜索.class文件需要很长时间,并且不会给出任何结果。 scratch目录可以在/.metadata/.plugins/org.eclipse.wst.server.core中找到,你可以找到一个名为tmp0的文件夹。删除此文件夹解决了我的问题。
答案 1 :(得分:0)
从基础开始。 ClassNotFoundException的唯一两个原因是该类不存在,或者运行时的配置不包含指向类所在位置的正确指针。
找出您的开发系统期望您的项目的类文件的位置。熟悉eclipse的人可以准确地告诉你这个配置的位置,或者它可以配置的各个地方,我无法摆脱困境。根据您运行Tomcat的方式,它可能不是日食;例如,将Tomcat作为单独的程序运行会将其与eclipse配置分离。
另一种可行的方法是,当它正常工作时,在整个磁盘中搜索显示缺失的类的.class文件(或其中一个,你不清楚它是否总是同一个文件)。它可能有多个副本,请注意它们。下次它不工作时,执行相同的搜索。
我假设您没有将类文件打包到开发环境中的jar中。如果是这样,那么这两个搜索应该告诉你类文件应该在哪里但不是。也许你可以从那里向后工作,找出为什么它似乎是随机的,哪个过程应该把它放在那里,但不是。
我不认为它实际上是随机的,我不会认为它是日食。我认为在你清理10-20次之后,重新启动不同的东西。我希望您也验证过,您没有耗尽磁盘空间或忽略指示编译问题的日志。