[ https://issues.apache.org/jira/browse/ARIES-1970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jean-Baptiste Onofré resolved ARIES-1970. ----------------------------------------- Resolution: Fixed > ClassCastException in Karaf ITests when using CXF JAX-RS WebClient and > Whiteboard > --------------------------------------------------------------------------------- > > Key: ARIES-1970 > URL: https://issues.apache.org/jira/browse/ARIES-1970 > Project: Aries > Issue Type: Bug > Components: jax-rs-whiteboard > Affects Versions: jax-rs-whiteboard-1.0.5, jax-rs-whiteboard-1.0.7, > jax-rs-whiteboard-1.0.6 > Environment: Karaf 4.3.0.RC1 (with default CXF: 3.3.5) + Whiteboard > 1.0.6 (with default CXF: 3.2.5) > Karaf 4.3.0.RC1 (rebuilt with CXF: 3.2.5) + Whiteboard 1.0.6 (with default > CXF: 3.2.5) > Karaf 4.2.6 + Whiteboard 1.0.5 > Reporter: Alexey Ivanov > Assignee: Jean-Baptiste Onofré > Priority: Major > Fix For: jax-rs-whiteboard-2.0.2 > > > Could be related with https://issues.apache.org/jira/browse/ARIES-1969 > May be caused by mixed up classes from different OSGi classpathes (repackaged > CXF copy in Whiteboard and CXF copy from jax-rs) due to to CXF singletones or > Karaf+Pax-Exam dynamic packages. > Bug disappears after we moved out repackaged CXF from Aries JAX-RR Whiteboard > into external dependency. > Steps to reproduce: > {code:java} > Deploy whiteboard example from karaf-rest-example-whiteboard > Deploy cxf-jaxrs > Create org.apache.cxf.jaxrs.client.WebClient. E.g. WebClient client = > WebClient.create(address); > Then ClassCastException occurs > {code} > > {code:java} > java.lang.RuntimeException: java.lang.ClassCastException: Cannot cast > org.apache.cxf.bus.managers.ClientLifeCycleManagerImpl to > org.apache.cxf.endpoint.ClientLifeCycleManager > at > org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:234) > at org.apache.cxf.jaxrs.client.WebClient.create(WebClient.java:115) > at > org.apache.karaf.itests.examples.RestExampleTest.testWhiteboardWithCxfWebClient(RestExampleTest.java:180) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) > at > org.apache.karaf.itests.KarafTestSupport$Retry$1.evaluate(KarafTestSupport.java:139) > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > at > org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runLeafWithRetry(ContainerTestRunner.java:97) > at > org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChildWithRetry(ContainerTestRunner.java:84) > at > org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:75) > at > org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:43) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > at org.junit.runner.JUnitCore.run(JUnitCore.java:115) > at > org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124) > at > org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97) > at > org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:92) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) > at sun.rmi.transport.Transport$1.run(Transport.java:200) > at sun.rmi.transport.Transport$1.run(Transport.java:197) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:196) > at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) > at java.security.AccessController.doPrivileged(Native Method) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Caused by: java.lang.ClassCastException: Cannot cast > org.apache.cxf.bus.managers.ClientLifeCycleManagerImpl to > org.apache.cxf.endpoint.ClientLifeCycleManager > at java.lang.Class.cast(Class.java:3369) > at > org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:317) > at > org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:185) > at > org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.notifyLifecycleManager(JAXRSClientFactoryBean.java:239) > at > org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:228) > ... 50 more > {code} > > > -- This message was sent by Atlassian Jira (v8.20.10#820010)