升级到cxf-rt-frontend-jaxrs v3.1.13时出现以下问题。 我使用的是javax.ws.rs v2.0.1,Spring v4.3.10。
org.springframework.beans.factory.BeanCreationException:使用名称' xxxxx'创建bean时出错::init方法的调用失败;嵌套异常是org.apache.cxf.service.factory.ServiceConstructionException 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)〜[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)〜[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)〜[spring-web-4.3.10.RELEASE.jar:4.1.6.RELEASE] 在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)〜[spring-web-4.3.10.RELEASE.jar:4.1.6.RELEASE] 在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)[spring-web-4.3.10.RELEASE.jar:4.1.6.RELEASE] 在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)[catalina.jar:na] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)[catalina.jar:na] 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)[catalina.jar:na] 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)[catalina.jar:na] 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)[catalina.jar:na] 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)[catalina.jar:na] 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)[catalina.jar:8.5.23-dev] 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1860)[catalina.jar:8.5.23-dev] at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)[na:1.8.0_131] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_131] 在java.lang.Thread.run(Thread.java:748)[na:1.8.0_131] 引起:org.apache.cxf.service.factory.ServiceConstructionException:null 在org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_131] 在java.lang.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_131] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1758)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1695)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)〜[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] ...省略了25个常用帧 引起:java.lang.ClassCastException:org.apache.cxf.jaxrs.model.wadl.WadlGenerator无法强制转换为javax.ws.rs.container.ContainerRequestFilter 在org.apache.cxf.jaxrs.provider.ServerProviderFactory.createWadlGenerator(ServerProviderFactory.java:108)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] 在org.apache.cxf.jaxrs.provider.ServerProviderFactory。(ServerProviderFactory.java:100)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] 在org.apache.cxf.jaxrs.provider.ServerProviderFactory.createInstance(ServerProviderFactory.java:120)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] 在org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setupFactory(JAXRSServerFactoryBean.java:234)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] 在org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:182)〜[cxf-rt-frontend-jaxrs-3.1.13.jar:3.1.13] ...省略了32个常见帧
答案 0 :(得分:0)
我们已经使用了maven树,并确定有另一个jar正在加载不同的版本,并且这是随机行为发生的,因为它取决于类加载器首先加载的内容。无论如何,修复只是从依赖项中排除该版本。