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

Pascal BERGOGNE <[email protected]> Tue, 15 Mar 2011 15:19:56 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
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