Search code examples
javaweb-servicesweblogiccxfopencmis

Running OpenCMIS client with CXF


I'm trying to add an OpenCmis client to web application which already has other clients using CXF. It will be deployed on Weblogic. I have the OpenCMIS client working based on http://chemistry.apache.org/java/opencmis-client-bindings.html

The problem is when I put it together with the other client implementations. For the CXF I had to modify the weblogic-application.xml with some preferred packages and with that the OpenCMIS client doesn't work. The exception I get is this:

Caused By: java.lang.ClassCastException: com.sun.proxy.$Proxy136 cannot be cast to com.sun.xml.ws.developer.WSBindingProvider
    at org.apache.chemistry.opencmis.client.bindings.spi.webservices.SunRIPortProvider.createPortObject(SunRIPortProvider.java:84)
    at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getPortObject(AbstractPortProvider.java:458)
    at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getRepositoryServicePort(AbstractPortProvider.java:280)
    at org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:69)
    at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:85)
    at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:109)
    at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:96)

Is there some way to make it work together?


Solution

  • To answer my own question. I just needed to add a binding library for opencmis:

        <dependency>
            <groupId>org.apache.chemistry.opencmis</groupId>
            <artifactId>chemistry-opencmis-client-bindings</artifactId>
            <version>${version.opencmis}</version>
        </dependency>
    

    And then add this to initialization:

    parameter.put(SessionParameter.WEBSERVICES_PORT_PROVIDER_CLASS, CXFPortProvider.class.getName());