1
類GsonMessageBodyHandler
是實現MessageBodyReader<T>
一個抽象類,它有沒有註釋。然後,這個方法被一個名爲JsonMessageBodyHandler
的類所分類。 JsonMessageBodyHandler
註明@Producer
和@Consumes(MediaType.APPLICATION_JSON)
。球衣的錯誤,試圖實例抽象類
當我部署我的項目是非模糊的,它工作正常。然而,當我模糊,即使我告訴ProGuard的不混淆GsonMessageBodyHandler
和JsonMessageBodyHandler
,新澤西出於某種原因堅持嘗試實例GsonMessageBodyHandler
作爲一個供應商,然後失敗,因爲它是抽象的。我無法確定是什麼導致澤西試圖加載這個抽象類,但只有在混淆後才能加載。誰能幫忙?
球衣版本是1.17。
啓動日誌中的有關章節給出如下:
2013-05-05 01:08:29.363 [localhost-startStop-1] ERROR c.s.j.c.s.component.ProviderFactory - The provider class, class com.rest.common.GsonMessageBodyHandler, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.InstantiationException: null
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30) ~[na:1.6.0_35]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ~[na:1.6.0_35]
at java.lang.Class.newInstance0(Class.java:355) ~[na:1.6.0_35]
at java.lang.Class.newInstance(Class.java:308) ~[na:1.6.0_35]
at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:192) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:179) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ProviderFactory._getComponentProvider(ProviderFactory.java:159) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:153) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:251) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.component.ProviderServices.getProviders(ProviderServices.java:148) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initWriters(MessageBodyFactory.java:206) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:163) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1310) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:774) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:770) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765) [jersey-server-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:489) [jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319) [jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) [jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374) [jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557) [jersey-servlet-1.17.jar:1.17]
at javax.servlet.GenericServlet.init(GenericServlet.java:160) [servlet-api.jar:3.0.FR]
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) [catalina.jar:7.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:655) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1628) [catalina.jar:7.0.32]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_35]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_35]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_35]
SEVERE: The class com.rest.common.GsonMessageBodyHandler is an abstract class and cannot be instantiated.
2013-05-05 01:08:29.675 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/rest] - StandardWrapper.Throwable com.sun.jersey.spi.inject.Errors$ErrorMessagesException: null
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770) ~[jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765) ~[jersey-server-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:489) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557) ~[jersey-servlet-1.17.jar:1.17]
at javax.servlet.GenericServlet.init(GenericServlet.java:160) ~[servlet-api.jar:3.0.FR]
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) [catalina.jar:7.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:655) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1628) [catalina.jar:7.0.32]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_35]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_35]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_35]
2013-05-05 01:08:29.691 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/rest] - Servlet /rest threw load() exception
com.sun.jersey.spi.inject.Errors$ErrorMessagesException: null
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) ~[jersey-core-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770) ~[jersey-server-1.17.jar:1.17]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765) ~[jersey-server-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:489) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374) ~[jersey-servlet-1.17.jar:1.17]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557) ~[jersey-servlet-1.17.jar:1.17]
at javax.servlet.GenericServlet.init(GenericServlet.java:160) ~[servlet-api.jar:3.0.FR]
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266) ~[catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185) ~[catalina.jar:7.0.32]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080) ~[catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) [catalina.jar:7.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.32]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.32]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:655) [catalina.jar:7.0.32]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1628) [catalina.jar:7.0.32]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_35]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_35]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_35]
感謝您的答覆,我做了檢查是一定的,並在ProGuard配置文件有: -keepattributes例外,InnerClasses,簽名,不推薦使用,的SourceFile,LineNumberTable,*註釋*,合成,EnclosingMethod。無論如何,即使它剝離了註釋,抽象基類仍然沒有註釋。出於某種原因,澤西正試圖實例化抽象類。 – user2352817 2013-05-10 03:42:14