将camel-cxf升级到2.15.2后出错。类投射例外

时间:2015-06-01 16:18:32

标签: apache-camel

升级到apache camel-cxf到2.15.2和cxf 3.0.4后我在启动我的驼峰路线时遇到以下问题。

该路线与支付网关进行肥皂整合。

有没有人为此找到解决方法?

请参阅下面的堆栈跟踪。

  

引起:javax.ejb.EJBException:   org.apache.camel.FailedToCreateProducerException:创建失败   端点生产者:   端点[CXF:// https://staging.payu.co.za/service/PayUAPI?dataFormat=PAYLOAD&portName=%7Bhttp%3A%2F%2Fsoap.api.controller.web.payjar.com%2F%7DEnterpriseAPISoapPort&serviceName=%7Bhttp%3A%2F%2Fsoap.api.controller.web.payjar.com%2F%7DEnterpriseAPISoapService&wsdlURL=https%3A%2F%2Fstaging.payu.co.za%2Fservice%2FPayUAPI%3Fwsdl]。   原因:org.apache.camel.RuntimeCamelException:   java.lang.ClassCastException:无法强制转换   org.apache.cxf.wsdl11.WSDLManagerImpl to   org.apache.cxf.wsdl.WSDLManager at   org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)     在   org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)     在   org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:349)     在   org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)     在   org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)     在   org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)     ......还有11个

Caused by: org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint:
     

端点[CXF:// https://staging.payu.co.za/service/PayUAPI?dataFormat=PAYLOAD&portName=%7Bhttp%3A%2F%2Fsoap.api.controller.web.payjar.com%2F%7DEnterpriseAPISoapPort&serviceName=%7Bhttp%3A%2F%2Fsoap.api.controller.web.payjar.com%2F%7DEnterpriseAPISoapService&wsdlURL=https%3A%2F%2Fstaging.payu.co.za%2Fservice%2FPayUAPI%3Fwsdl]。   原因:org.apache.camel.RuntimeCamelException:   java.lang.ClassCastException:无法强制转换   org.apache.cxf.wsdl11.WSDLManagerImpl to   org.apache.cxf.wsdl.WSDLManager at   org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:407)     在   org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123)     在   org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:219)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)     在   org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)     在   org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1272)     在   org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44)     在   org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)     在   org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:155)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:61)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)     在   org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:1122)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)     在   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)     在   org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)     在   org.apache.camel.impl.RouteService.startChildService(RouteService.java:340)     在org.apache.camel.impl.RouteService.warmUp(RouteService.java:182)     在   org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3090)     在   org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3020)     在   org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2797)     在   org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2653)     在   org.apache.camel.impl.DefaultCamelContext.access $ 000(DefaultCamelContext.java:167)     在   org.apache.camel.impl.DefaultCamelContext $ 2.call(DefaultCamelContext.java:2467)     在   org.apache.camel.impl.DefaultCamelContext $ 2.call(DefaultCamelContext.java:2463)     在   org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)     在   org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432)     在   com.unijunction.ordercloud.common.bootstrap.CamelInstantiator.init(CamelInstantiator.java:58)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at   org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:114)     在   org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:103)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.invocation.InterceptorContext $ Invocation.proceed(InterceptorContext.java:437)     在   org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:73)     在   org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory $ ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:107)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ee.component.AroundConstructInterceptorFactory $ 1.processInvocation(AroundConstructInterceptorFactory.java:28)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:100)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)     在   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)     在   org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)     ......还有27个

Caused by: org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: Cannot cast
     

org.apache.cxf.wsdl11.WSDLManagerImpl to   org.apache.cxf.wsdl.WSDLManager at   org.apache.camel.component.cxf.WSDLServiceFactoryBean.getDefinition(WSDLServiceFactoryBean.java:66)     在   org.apache.camel.component.cxf.WSDLServiceFactoryBean.buildServiceFromWSDL(WSDLServiceFactoryBean.java:101)     在   org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525)     在   org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)     在   org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)     在   org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)     在   org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)     在   org.apache.camel.component.cxf.CxfEndpoint.createClient(CxfEndpoint.java:634)     在   org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:76)     在   org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)     在   org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:2869)     在   org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:1097)     在   org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:1058)     在   org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:405)     ......还有104个

Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.wsdl11.WSDLManagerImpl to
     

org.apache.cxf.wsdl.WSDLManager at   java.lang.Class.cast(Class.java:3186)at   org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:322)     在   org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:216)     在   org.apache.camel.component.cxf.WSDLServiceFactoryBean.getDefinition(WSDLServiceFactoryBean.java:64)     ...... 117更多

1 个答案:

答案 0 :(得分:1)

camel和cfx发现的常见问题:

  • 阴影jar文件中的camel / cfx的重复版本,因为我发现了cxf - 3.0.12和3.1.10的问题。
  • 骆驼TypeConverter的问题。

解决方案:

  • Maven依赖项,apache cxf版本2.7.18和apache camel版本2.17.2。

CXF束

驼核

驼CXF

  • 将其包含在阴影maven pom中,

                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                    <resource>META-INF/services/org/apache/camel/TypeConverter</resource>
                </transformer>