Re: Re: Re: Re: org.apache.cxf.jaxws.spi.ProviderImpl cannot be cast to javax.xml.ws.spi.Provider

Pascal BERGOGNE <[email protected]> Wed, 16 Mar 2011 15:04:27 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
Hi Benoit,

Thanks again for your answer !
Disabling the jaxws service from jonas property file worked fine (2 others
options didn't work) !

The webservice client that I'm using is also exposing is own webservice, so
during the client instantiation process :
 step 1 : create webservice client (generating stubs ans so on ...) works
now well :)
 step 2 : expose his own webservice (jetty embedded) throw this exception :

javax.ejb.EJBException: org.ow2.easybeans.rpc.api.RPCException:
java.lang.IllegalAccessError: tried to access class
com.sun.xml.txw2.DatatypeWriter$2 from class com.sun.xml.txw2.DatatypeWriter
    at
org.ow2.easybeans.proxy.client.AbsInvocationHandler.handleThrowable(AbsInvocationHandler.java:187)
    at
org.ow2.easybeans.proxy.client.ClientRPCInvocationHandler.invoke(ClientRPCInvocationHandler.java:218)
    at
org.ow2.easybeans.proxy.client.ClientRPCInvocationHandler.invoke(ClientRPCInvocationHandler.java:111)
    at $Proxy58.start(Unknown Source)
    at myContextListener.contextInitialized(MyContextListener.java:40)

For the moment, the client step 2 is not necessary : I have removed it to
avoid this exception, but it should be interesting to know why it is thrown.

An other question, I have disabled the jaxws jonas service and also excluded
all maven cxf dependencies from my projects. My resulting ear does not
contains any cxf or spring libraries.
I can't figure out how jonas find cxf and spring dependences to create my
web service client !

Thanks again !

Pascal


2011/3/15 Florent BENOIT <[email protected]>

>      Hi Pascal,
>
> You may try 3 options :
>
> - Remove the jaxws service from the JONAS_BASE/conf/jonas.properties file
> - Remove all CXF stuff from your WEB-INF/lib as CXF bundle is providing CXF
> classes through the jaxws service
> - Add a filter into your webapp or add org.apache.cxf.* to the global
> configuration in JONAS_BASE/conf/classloader-default-filtering.xml
>
>
> Regards,
>
> Florent
> Pascal BERGOGNE wrote:
>
> Hi Florent,
>
> Thank you for this quick answer !
>
> I had already found the http://jira.ow2.org/browse/JONAS-363 web page and
> tried with the Jonas M5 version, but the exception still occurs.
> I also tried, as you said, the RC1-SNAPSHOT, unsuccessfully :(
>
> Do you see any other way to correct this behavior ?
>
> Thank you
>
> Pascal
>
> 2011/3/15 Florent BENOIT <[email protected]>
>
>>   Hi Pascal,
>>
>> You should look at http://jira.ow2.org/browse/JONAS-363
>>
>> And you may try to download a snapshot to see if it fixes the problem for
>> you :
>>
>> http://maven.ow2.org/maven2-snapshot/org/ow2/jonas/assemblies/profiles/jonas-full/5.2.0-RC1-SNAPSHOT/
>>
>> Regards,
>>
>> Florent
>>
>>
>> Pascal BERGOGNE wrote:
>>
>>> Hello,
>>>
>>> I'm facing some problems using a webservice client from an EAR
>>> application.
>>>
>>> My EAR is composed of an ejb-jar and a war.
>>> The war is only used to run an EJB timer when the application is deployed
>>> (listener into web.xml).
>>> The purpose of the EJB Timer is to instantiate a "poller" object that'll
>>> call periodically a webservice.
>>>
>>> The poller depends on an other projet that represents a custom webservice
>>> client.
>>>
>>> I suppose that the exception occurs while the webservice client is
>>> creating the stubs.
>>> Here the exception :
>>>
>>> 2011-03-15 14:39:33,842 : StandardContext.listenerStart : Exception
>>> sending context initialized event to listener instance of class
>>> com.francetelecom.happi.wsapi.apiwar.TriggerTest
>>> javax.xml.ws.WebServiceException: Unable to create Provider:
>>> org.apache.cxf.jaxws.spi.ProviderImpl cannot be cast to
>>> javax.xml.ws.spi.Provider
>>>    at javax.xml.ws.spi.Provider.provider(Provider.java:82)
>>>    at javax.xml.ws.Service.<init>(Service.java:57)
>>>    at myWSclient.myClient_Service.<init>(MyClient_Service.java:44)
>>>    at myWSclient.myClientImpl.setURL(MyClientImpl.java:550)
>>>    at myWSclient.myClientImpl.<init>(MyClientImpl.java:113)
>>>    at myWSclient.myClientFactory.<init>(MyClientFactory.java:28)
>>>    at myprojet.Poller.<init>(Poller.java:61)
>>>    at myprojet.TriggerTest.contextInitialized(TriggerTest.java:51)
>>>    at
>>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
>>>    at
>>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
>>>    at
>>> org.ow2.jonas.web.tomcat6.JOnASStandardContext.start(JOnASStandardContext.java:281)
>>>    at
>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>>>    at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>>>    at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
>>>    at
>>> org.ow2.jonas.web.tomcat6.Tomcat6Service.__doRegisterWar(Tomcat6Service.java:699)
>>>    at
>>> org.ow2.jonas.web.tomcat6.Tomcat6Service.doRegisterWar(Tomcat6Service.java)
>>>    at
>>> org.ow2.jonas.web.base.BaseWebContainerService.registerWar(BaseWebContainerService.java:918)
>>>    at
>>> org.ow2.jonas.web.base.BaseWebContainerService.deployWars(BaseWebContainerService.java:1538)
>>>    at
>>> org.ow2.jonas.ear.internal.EarDeployer.deployWARs(EarDeployer.java:1081)
>>>    at
>>> org.ow2.jonas.ear.internal.EarDeployer.doDeploy(EarDeployer.java:785)
>>>    at
>>> org.ow2.util.ee.deploy.impl.deployer.AbsDeployer$1.execute(AbsDeployer.java:96)
>>>    at
>>> org.ow2.util.ee.deploy.impl.deployer.AbsDeployer$1.execute(AbsDeployer.java:95)
>>>    at
>>> org.ow2.util.execution.helper.RunnableHelper.execute(RunnableHelper.java:77)
>>>    at
>>> org.ow2.util.ee.deploy.impl.deployer.AbsDeployer.deploy(AbsDeployer.java:94)
>>>    at
>>> org.ow2.util.ee.deploy.impl.deployer.DeployerManager.deploy(DeployerManager.java:129)
>>>    at org.ow2.jonas.lib.jmbeans.J2EEServer.__deploy(J2EEServer.java:754)
>>>    at org.ow2.jonas.lib.jmbeans.J2EEServer.deploy(J2EEServer.java)
>>>    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:616)
>>>    at
>>> org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:458)
>>>    at
>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:857)
>>>    at
>>> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:795)
>>>    at
>>> javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1450)
>>>    at
>>> javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:90)
>>>    at
>>> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1285)
>>>    at
>>> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1383)
>>>    at
>>> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:807)
>>>    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:616)
>>>    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
>>>    at sun.rmi.transport.Transport$1.run(Transport.java:177)
>>>    at java.security.AccessController.doPrivileged(Native Method)
>>>    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
>>>    at
>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
>>>    at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
>>>    at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>>    at java.lang.Thread.run(Thread.java:636)
>>>
>>>
>>>
>>> TriggerTest is the callback class in the web.xml listener
>>>
>>> the myClientImpl.setUrl :
>>>    public void setURL(URL url) {
>>>        service = new MyClient_Service(url);
>>>    }
>>>
>>> Here are the maven dependencies used :
>>>
>>> By the ejb project containing the poller :
>>>
>>>        <dependency>
>>>            <groupId>myproject</groupId>
>>>            <artifactId>client</artifactId>
>>>            <version>1.0.0</version>
>>>        </dependency>
>>>
>>>
>>> myproject.client pom :
>>>    <properties>
>>>        <cxf.version>2.2.7</cxf.version>
>>>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>    </properties>
>>>
>>>    <dependencies>
>>>
>>>        <dependency>
>>>            <groupId>myproject.client</groupId>
>>>            <artifactId>api</artifactId>
>>>            <version>1.0</version>
>>>        </dependency>
>>>               <dependency>
>>>            <groupId>org.apache.cxf</groupId>
>>>            <artifactId>cxf-rt-frontend-jaxws</artifactId>
>>>            <version>${cxf.version}</version>
>>>        </dependency>
>>>               <dependency>
>>>            <groupId>org.apache.cxf</groupId>
>>>            <artifactId>cxf-rt-transports-http</artifactId>
>>>            <version>${cxf.version}</version>
>>>        </dependency>
>>>        <!-- Jetty is needed if you're are not using the CXFServlet -->
>>>        <dependency>
>>>            <groupId>org.apache.cxf</groupId>
>>>            <artifactId>cxf-rt-transports-http-jetty</artifactId>
>>>            <version>${cxf.version}</version>
>>>        </dependency>               <dependency>
>>>            <groupId>org.apache.axis</groupId>
>>>            <artifactId>axis</artifactId>
>>>            <version>1.4</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>javax.xml</groupId>
>>>            <artifactId>jaxrpc-api</artifactId>
>>>            <version>1.1</version>
>>>        </dependency>
>>>    </dependencies>
>>>
>>>
>>> the myproject.client works great in maven unit tests. But under the jonas
>>> context I get the previous exception.
>>>
>>> I was wondering if it is possible to configure jonas to avoid the usage
>>> of his own CXF mechanism (so it won't create the stubs itself) .
>>>
>>> Any help is welcome !
>>>
>>> Thanks to all
>>>
>>> Pascal
>>>
>>>
>>
>
>