tomee ExceptionInInitializerError和ThreadLocalProxy在类加载器中不可见

时间:2014-10-15 08:57:16

标签: tomcat cxf jax-rs tomee

我使用Apache TomEE在Tomcat服务器上实现了CXF。

我在启动时收到此错误消息。



SEVERE: error invoking org.apache.tomee.webservices.TomeeJaxRsService@3b1c4405
java.lang.ExceptionInInitializerError
	at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.<clinit>(CxfRsHttpListener.java:134)
	at org.apache.openejb.server.cxf.rs.CxfRSService.createHttpListener(CxfRSService.java:167)
	at org.apache.openejb.server.rest.RESTService.deployApplication(RESTService.java:459)
	at org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:275)
	at org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:53)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.openejb.observer.ObserverManager$MethodInvocation.invoke(ObserverManager.java:399)
	at org.apache.openejb.observer.ObserverManager.doFire(ObserverManager.java:110)
	at org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:99)
	at org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:134)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1651)
	at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:116)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar(TomcatWebAppBuilder.java:648)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:618)
	at org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy(TomcatWebappDeployer.java:43)
	at org.apache.openejb.assembler.DeployerEjb.deploy(DeployerEjb.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
	at org.apache.openejb.security.internal.InternalSecurityInterceptor.invoke(InternalSecurityInterceptor.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
	at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
	at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
	at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
	at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
	at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
	at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
	at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:370)
	at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:181)
	at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:344)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:240)
	at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:86)
	at org.apache.openejb.server.httpd.ServerServlet.service(ServerServlet.java:58)
	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.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	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:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	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.IllegalArgumentException: interface org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy is not visible from class loader
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:616)
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
	at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
	at java.lang.reflect.WeakCache.get(WeakCache.java:141)
	at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:738)
	at org.apache.cxf.jaxrs.utils.InjectionUtils.createThreadLocalProxy(InjectionUtils.java:905)
	at org.apache.cxf.jaxrs.model.AbstractResourceInfo.addContextMethod(AbstractResourceInfo.java:167)
	at org.apache.cxf.jaxrs.model.AbstractResourceInfo.checkContextMethod(AbstractResourceInfo.java:150)
	at org.apache.cxf.jaxrs.model.AbstractResourceInfo.findContextSetterMethods(AbstractResourceInfo.java:132)
	at org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:65)
	at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:29)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.initJaxbProviders(ProviderFactory.java:131)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.<init>(ProviderFactory.java:120)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.getInstance(ProviderFactory.java:161)
	at org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:73)
	... 74 more
&#13;
&#13;
&#13;

我真的不明白错误信息的含义。

1 个答案:

答案 0 :(得分:4)

当您在初始化时发生的任何堆栈跟踪中看到以下块时:

Caused by: java.lang.IllegalArgumentException: interface org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy is not visible from class loader
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:580)
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:556)
    at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
    at java.lang.reflect.WeakCache.get(WeakCache.java:127)
    at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:418)
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:717)
    at org.apache.cxf.jaxrs.utils.InjectionUtils.createThreadLocalProxy(InjectionUtils.java:905)
    at org.apache.cxf.jaxrs.model.AbstractResourceInfo.addContextMethod(AbstractResourceInfo.java:167)
    at org.apache.cxf.jaxrs.model.AbstractResourceInfo.checkContextMethod(AbstractResourceInfo.java:150)
    at org.apache.cxf.jaxrs.model.AbstractResourceInfo.findContextSetterMethods(AbstractResourceInfo.java:132)
    at org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:65)
    at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:29)
    at org.apache.cxf.jaxrs.provider.ProviderFactory.initJaxbProviders(ProviderFactory.java:131)
    at org.apache.cxf.jaxrs.provider.ProviderFactory.<init>(ProviderFactory.java:120)
    at org.apache.cxf.jaxrs.provider.ProviderFactory.getInstance(ProviderFactory.java:161)
    at org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:73)
    ... 29 more

您很有可能在Web应用程序中获得CXF库的副本。如果是这种情况,你肯定想要删除它们。

CXF使用static变量进行某些重要的跟踪。当有一个类的副本在webapp中和服务器内部保存静态时,webapp中的那个将有效地隐藏服务器中的那个 - Java中的静态作用在类加载器的作用域。

从webapp中删除CXF的副本(如果有的话),你应该更进一步。