• javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet


    本人博客地址:http://www.m-sk.me ,欢迎访问

    软件平台:

        ​编程语言:JAVA

        ​开发工具:MyEclipse 2014

        ​服务器:apache-tomcat-7.0.52 or jetty-distribution-9.1.4.v20140401

    问题描述:

        ​使用MyEclipse内置Tomcat服务器运行通过JAX WS技术创建的WebService时正常,但是使用独立Tomcat或Jetty服务器启动时报错:

        ​

    严重: Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4888)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        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:632)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
        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)

    解决方法:

        Tomcat需要jax-ws RI包,将jax-ws RI的lib目录下的包拷贝至项目的WEB-INFlib目录下。

        ​    ​下载地址:https://jax-ws.java.net 

        ​需要拷贝的包有:

          1. gmbal-api-only.jar

        ​    ​2. ha-api.jar

        ​    ​3. jaxb-core.jar
        ​    ​4. jaxb-impl.jar
        ​    ​5. jaxws-api.jar
        ​    ​6. jaxws-rt.jar
        ​    ​7. management-api.jar
        ​    ​8. policy.jar
        ​    ​9. stax-ex.jar
        ​    ​10. streambuffer.jar

        ​    ​也可以像我一样,把所有的包都拷贝过去

        ​    ​

    P.S.:

        ​    ​这个问题困扰我整整一天,网络上众说纷纭,各种解决方法大都尝试过,网上好多人说的都有问题,比如有人说需要的包有

      • gmbal-api-only.jar

      • ha-api.jar

      • jaxb-impl.jar

      • jaxws-api.jar

      • jaxws-rt.jar

      • management-api.jar

      • policy.jar

      • stax-ex.jar

      • streambuffer.jar

        ​我添加后,出现如下错误:

    严重: ContainerBase.addChild: start: 
    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/HitchingServer]]
        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:632)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
        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.NoClassDefFoundError: com/sun/istack/localization/Localizable
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
        at java.lang.Class.getDeclaredFields(Class.java:1806)
        at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
        at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:400)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more
    Caused by: java.lang.ClassNotFoundException: com.sun.istack.localization.Localizable
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
        ... 38 more
    四月 13, 2014 7:37:53 下午 org.apache.catalina.startup.HostConfig deployDirectory
    严重: Error deploying web application directory G:Program Filesapache-tomcat-7.0.52webappsHitchingServer
    java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/HitchingServer]]
        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:632)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
        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)

        ​更有人说:

        ​    ​如果在Tomcat 6.0上部署,则需要加上JAX-WS API /  Runtime 两个库

        ​不知道他们是如何成功的,反正我是没成功。

    参考:

        ​

    http://www.mkyong.com/webservices/jax-ws/java-lang-classnotfoundexception-com-sun-xml-ws-transport-http-servlet-wsservletcontextlistener/

    ​JAX-WS文档:

    3. Installation Instructions

    The following applies to the JAX-WS standalone bundles.

    • Extract JAX-WS RI 2.2.8 bundle

    • To use with GlassFish

      • Glassfish contains JAX-WS within Metro package so no installation required. For updating JAX-WS installation in Glassfish please refer to Metro project.

    • To install on Tomcat

      • Set CATALINA_HOME to your Tomcat installation.

      • Run

        ant install

        This essentially copies lib/*.jar from the root of JAX-WS RI extracted bundle to $CATALINA_HOME/shared/lib

      • If you are running on top of JDK6, run

        ant install-api

        or use

        ant -help

        for detailed information.

    If you intend to only invoke an already existing Web service, then alternatively you can use the wsimport and wsgen scripts in the bin directory of the JAX-WS RI 2.2.8 bundle.

    4. Running on top of JDK 6

    JDK 6u4 includes JAX-WS 2.1 and JAXB 2.1 API and RI. JAX-WS RI 2.2.8 includes RI of JAX-WS/JAXB 2.2. In order to run JAX-WS RI 2.2.8 you would need to specify ONLY jaxws-api.jar, and jaxb-api.jar jars using theJava Endorsed Standards Override Mechanism

     

  • 相关阅读:
    Flink--Window apply
    Flink--time-window 的高级用法
    Flink的Windows
    Flink的流处理--KeyBy
    Flink的分布式缓存
    Flink的广播变量
    Flink--本地执行和集群执行
    Flink-- 数据输出Data Sinks
    存储管理-页式管理
    存储管理-覆盖技术和交换技术
  • 原文地址:https://www.cnblogs.com/m-sk/p/3662659.html
Copyright © 2020-2023  润新知