2

I have a Spring Maven web app which contains a number of RESTful web services. Within this I'm running a custom built client jar which interacts with a number of older SOAP services - the jar project hides a lot of the complexity for interacting with the SOAP services behind some simplified java objects.

When running in jetty everything works fine. However when deploying the jar to tomcat, both on a different server and locally on the same machine as jetty, I get the following error

com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy

So the issue looks to be that in TC the sun jar is been called ahead of the cxf one. I found multiple similar issues online - I tried the solution in a previous SO question (below), which actually was very similar to my problem, along with reading the referenced links in the answers but no luck

CXF - ClassCastException (SEIStub/ClientProxy)

I also came across the below article

http://forum.mulesoft.org/mulesoft/topics/cxf_jaxws_client_java_lang_classcastexception_com_sun_xml_ws_client_sei_seistub_cannot_be_cast_to_org_apache_cxf

So as I also am referencing chemistry-opencmis in my project I thought this may have been causing the classpath error. I tried loading these jars externally and then also tried removing the opencmis references and code from the project completely and rebuilt but was seeing the same behavior - worked fine in jetty but not in tomcat.

I've also looked at similar issues on the apache mail forums

https://issues.apache.org/jira/browse/CXF-2237

The contents of my web.xml file are below

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true">

  <display-name>xxx</display-name>

    <listener>
        <listener-class>com.fmr.xtrac.forms.web.init.WebConfigurer</listener-class>
    </listener>

     <!-- GZipFilter has issues with XFire's service-listing servlet. -->
  <!-- http://issues.appfuse.org/browse/APF-863 -->
  <filter>
        <filter-name>gzipFilter</filter-name>
        <filter-class>net.sf.ehcache.constructs.web.filter.GzipFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>/rest/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>*.css</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>*.html</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>*.js</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzipFilter</filter-name>
    <url-pattern>*.zip</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>cors</filter-name>
    <filter-class>xxx.CorsFilter</filter-class>
    <init-param>
     <param-name>cors.allowOrigin</param-name>
        <param-value>*</param-value>
    </init-param>
    <init-param>
     <param-name>cors.supportedMethods</param-name>
        <param-value>GET, POST, HEAD, PUT, DELETE</param-value>
    </init-param>
    <init-param>
        <param-name>cors.supportedHeaders</param-name>
        <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value>
    </init-param>
    <init-param>
        <param-name>cors.exposedHeaders</param-name>
        <param-value>Set-Cookie</param-value>
    </init-param>
    <init-param>
        <param-name>cors.supportsCredentials</param-name>
        <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>cors</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

</web-app>

and in my pom the relevant dependencies are

<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.7.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.7.6</version>
        </dependency>

<dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.chemistry.opencmis</groupId>
            <artifactId>chemistry-opencmis-client-api</artifactId>
            <version>0.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.chemistry.opencmis</groupId>
            <artifactId>chemistry-opencmis-commons-impl</artifactId>
            <version>0.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.chemistry.opencmis</groupId>
            <artifactId>chemistry-opencmis-client-impl</artifactId>
            <version>0.10.0</version>
        </dependency>

Has anyone come across this issue before or have any thoughts or ideas on what might be causing it or anything else I can try to identify the problem or resolve it? The fact that the behavior is different in jetty and tomcat makes me think that it's something to do with the war but I'm out of ideas on what to try!

Thanks in advance for any help, Derm

Community
  • 1
  • 1
dermd
  • 167
  • 3
  • 13

0 Answers0