2011-09-26 344 views
0

我對我的應用程序使用java RestEasy Framwork。當我試圖在tomcat服務器上發出一個請求時,我有一些例外。 Full stackTrace是:Tomcat 6.0.24異常:javax.servlet.ServletException:Servlet執行拋出異常

Sep 26, 2011 1:50:06 PM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Servlet.service() for servlet my-servlet threw exception 
java.lang.VerifyError: Cannot inherit from final class 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) 
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2331) 
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:976) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1451) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) 
    at org.codehaus.jackson.jaxrs.MapperConfigurator.getDefaultMapper(MapperConfigurator.java:69) 
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.locateMapper(JacksonJsonProvider.java:587) 
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:404) 
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:105) 
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:61) 
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108) 
    at org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.read(DigitalVerificationInterceptor.java:35) 
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108) 
    at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:168) 
    at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:114) 
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137) 
    at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) 
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) 
    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209) 
    at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) 
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) 
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) 
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) 
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) 
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) 
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    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:662) 

可能是什麼問題?

回答

1

這個異常說明你的servlet/JSP extends其他一些類,並且該類被標記爲final。無論如何,如果它是一個應該在編譯時檢測到的servlet(而不是JSP)。

+0

感謝您的快速回復。但是,相同的代碼昨天正在運行。今天一切都一樣。我仍然編譯它,並看到每個類都生成或不。有一個信息顯示,當我啓動tomcat它是: (\ WEB-INF \ lib \ javaee.jar) - jar沒有加載。請參閱Servlet規範2.3,第9.7.2節。違規類:javax/servlet/Servlet.class 這是原因嗎? –

+0

這可能是一些不相容的瓶子踩在對方的腳趾上。 嘗試清理應用程序的.jar庫文件夾和tomcat的庫(在tomcat \ lib中找到)。 據我所知,你不需要在servlet-api.jar的應用程序中包含javaee.jar。 – Romeo

+0

不僅僅是servlet類本身,它看起來像是service()使用的類之一。你在那裏創建任何匿名課程嗎? – SJuan76

-1

確保spring-expressions.jar存在於您的tomcat libs目錄中......我不得不將它複製到那裏(除了將它複製到我的WEB-INF/libs),但是將該jar的副本複製到我的tomcat目錄解決了我的類似問題