使用Tomcat 7.0.35部署JAXWS时出现问题

时间:2014-03-31 12:18:53

标签: java soap tomcat7 jax-ws java-metro-framework

我们正在运行ubuntu 13.04 + Tomcat / 7.0.35 + java 1.7.0_51-b00。 设置已成功运行数月。 现在我们使用jax-ws 2.2.8添加了一个SOAP端点,并且该应用程序不再在服务器上部署,说

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/v014]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoSuchMethodError: com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(Ljavax/servlet/ServletContext;)V
        at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5280)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more

Mar 31, 2014 12:26:43 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/v014.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/v014]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

添加以下maven依赖项使得webapp通过eclipse / tomcat7在本地运行,但不能解决远程服务器上的问题。

<dependency>
   <groupId>com.sun.xml.ws</groupId>
   <artifactId>jaxws-rt</artifactId>
   <version>2.2.8</version>
   <exclusions>
    <exclusion>
     <groupId>com.sun.xml.stream</groupId>
     <artifactId>sjsxp</artifactId>
    </exclusion>
   </exclusions>
  </dependency>

  <dependency>
   <groupId>com.sun.xml.stream.buffer</groupId>
   <artifactId>streambuffer</artifactId>
   <version>1.5.3</version>
  </dependency>

  <dependency>
   <groupId>com.sun.xml.ws</groupId>
   <artifactId>policy</artifactId>
   <version>2.3.1</version>
  </dependency>

  <dependency>
   <groupId>org.glassfish.gmbal</groupId>
   <artifactId>gmbal-api-only</artifactId>
   <version>3.2.0-b003</version>
  </dependency>

  <dependency>
   <groupId>org.glassfish.ha</groupId>
   <artifactId>ha-api</artifactId>
   <version>3.1.9</version>
  </dependency>

我们还试图手动添加罐子

jaxb-impl.jar jaxb-core.jar ha-api.jar gmbal-api-only.jar jaxws-api.jar jaxws-rt.jar management-api.jar policy.jar stax-ex.jar streambuffer.jar

同时访问Tomcat的lib和/或webapp的WEB-INF文件夹,但不起作用。

还尝试降级到jax-ws 2.1 - &gt;同样的错误。

非常感谢帮助或想法。

2 个答案:

答案 0 :(得分:1)

运行JAX-WS所需的一切都已包含在标准java 1.7 JVM中。

仅包含您的应用程序自定义的JAR。

我建议从捆绑的JAR中删除与jaxws,jaxb,policy,stax和streambuffer相关的任何内容。

答案 1 :(得分:1)

@rustyx建议应该有效。但我使用OpenJDK 1.7遇到了同样的问题,解决方法是在我的pom.xml上添加以下依赖项

<!-- JAX-WS Dependencies -->
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.8</version>
        <exclusions>
            <exclusion>
                <groupId>com.sun.xml.stream</groupId>
                <artifactId>sjsxp</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.stream.buffer</groupId>
        <artifactId>streambuffer</artifactId>
        <version>1.5.3</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>policy</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.gmbal</groupId>
        <artifactId>gmbal-api-only</artifactId>
        <version>3.2.0-b003</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.ha</groupId>
        <artifactId>ha-api</artifactId>
        <version>3.1.9</version>
    </dependency>

希望有所帮助, 干杯