CXF客户端类在tomcat中抛出异常但不在jetty中抛出异常

时间:2014-02-14 01:56:12

标签: java tomcat jetty

我有一个Spring Maven网络应用程序,其中包含许多RESTful Web服务。在这里我运行一个自定义构建的客户端jar,它与许多旧的SOAP服务交互 - jar项目隐藏了很多与一些简化的java对象背后的SOAP服务交互的复杂性。

在码头跑步时一切正常。但是当将jar部署到tomcat时,无论是在不同的服务器上还是在与jetty相同的机器上本地,我都会收到以下错误

  

com.sun.xml.ws.client.sei.SEIStub无法转换为   org.apache.cxf.frontend.ClientProxy

所以问题在于TC中的太阳罐在cxf之前被调用了。我在网上发现了多个类似的问题 - 我在之前的SO问题(下面)中尝试了解决方案,这实际上与我的问题非常相似,并且在答案中阅读了引用的链接但没有运气

CXF - ClassCastException (SEIStub/ClientProxy)

我还看到了下面的文章

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

因为我在项目中也引用了化学-opencmis,我认为这可能导致了类路径错误。我尝试从外部加载这些罐子然后也尝试从项目中完全删除opencmis引用和代码并重建但是看到相同的行为 - 在jetty中工作正常但在tomcat中没有。

我也在apache邮件论坛上看过类似的问题

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

我的web.xml文件的内容在

下面
<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>

在我的pom中,相关的依赖项是

<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>

之前有没有人遇到过这个问题,或者对可能导致问题或其他任何事情有任何想法或想法我可以尝试找出问题或解决问题?在码头和tomcat中行为不同这一事实让我觉得这与战争有关,但我不知道该尝试什么!

提前感谢您的帮助, 真皮

0 个答案:

没有答案