2017-05-30 39 views
1

我正在写一个OSGi包(hu.libra.commons.osgi.core.wsbundle),它包含一个web服务服务器(com.sun.xml.ws/jaxws-rt)。 这是行得通的,但生成的包包含5Mb的嵌入式jar,我不想将它包含在所有的webservice包中(毕竟OSGi是关于模块化的),我想将它们放入一个“webservice core”包(hu.libra.commons.webservice.core)和我所有的webservices都将依赖于此。OSGi ClassNotFoundException WSServletContextListener

但是,当我尝试这样做,我得到java.lang.ClassNotFoundException:com.sun.xml.ws.transport.http.servlet.WSServletContextListener异常。 问题是什么?

目前工作的pom.xml(hu.libra.commons.osgi.core.wsbundle)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <bundlename>hu.libra.commons.osgi.core.wsbundle</bundlename> 
</properties> 

<organization> 
    <name>Libra Szoftver Zrt.</name> 
    <url>http://www.libra.hu</url> 
</organization> 

<modelVersion>4.0.0</modelVersion> 
<groupId>hu.libra.commons</groupId> 
<artifactId>libra-commons-osgi-core-wsbundle</artifactId> 
<version>1.7.0</version> 
<name>Libra Common OSGi Core Webservice Bundle</name> 
<packaging>war</packaging> 

<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
     </resource> 
    </resources> 

    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 
       </archive> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <executions> 
       <execution> 
        <id>bundle-manifest</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>manifest</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <supportedProjectTypes> 
        <supportedProjectType>war</supportedProjectType> 
       </supportedProjectTypes> 
       <instructions> 
        <Bundle-SymbolicName>${bundlename}</Bundle-SymbolicName> 
        <Private-Package>hu.libra.commons.osgi.core.wsbundle</Private-Package> 
        <Import-Package> 
         org.osgi.framework, 
         javax.servlet, 
         javax.servlet.http, 
         hu.libra.commons.osgi.utils, 
         hu.libra.commons.osgi.core.service       
        </Import-Package> 
        <DynamicImport-Package> 
         javax.*, 
         org.xml.sax, 
         org.xml.sax.*, 
         org.w3c.*       
        </DynamicImport-Package> 
        <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath> 
        <Embed-Directory>WEB-INF/lib</Embed-Directory> 
        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
        <Embed-Transitive>true</Embed-Transitive> 
        <Web-ContextPath>/libraosgicore</Web-ContextPath> 
        <Webapp-Context>/libraosgicore</Webapp-Context> 
       </instructions> 
      </configuration> 
     </plugin> 
    </plugins> 
    <finalName>${bundlename}-${project.version}</finalName> 
</build> 

<dependencies> 
    <!-- OSGi --> 
    <dependency> 
     <groupId>org.osgi</groupId> 
     <artifactId>org.osgi.core</artifactId> 
     <version>6.0.0</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.xml.ws</groupId> 
     <artifactId>jaxws-rt</artifactId> 
     <version>2.2.10</version> 
    </dependency> 


    <!-- Libra OSGi Core Service --> 
    <dependency> 
     <groupId>hu.libra.commons</groupId> 
     <artifactId>libra-commons-osgi-utils</artifactId> 
     <version>1.7.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>hu.libra.commons</groupId> 
     <artifactId>libra-commons-osgi-core-service</artifactId> 
     <version>1.7.0</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

接下来的两个POM不工作,我得到抛出java.lang.ClassNotFoundException:COM .sun.xml.ws.transport.http.servlet.WSServletContextListener异常。

的pom.xml(hu.libra.commons.webservice.core)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <bundlename>hu.libra.commons.webservice.core</bundlename> 
</properties> 

<organization> 
    <name>Libra Szoftver Zrt.</name> 
    <url>http://www.libra.hu</url> 
</organization> 

<modelVersion>4.0.0</modelVersion> 
<groupId>hu.libra.commons</groupId> 
<artifactId>libra-commons-webservice-core</artifactId> 
<version>1.7.0</version> 
<name>Libra Commons Webservice Core</name> 
<packaging>bundle</packaging> 

<build> 
    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <executions> 
       <execution> 
        <id>bundle-manifest</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>manifest</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <supportedProjectTypes> 
        <supportedProjectType>jar</supportedProjectType> 
        <supportedProjectType>bundle</supportedProjectType> 
       </supportedProjectTypes> 
       <instructions> 
        <Bundle-SymbolicName>${bundlename}</Bundle-SymbolicName>       
        <Import-Package> 
         org.osgi.framework, 
         javax.servlet, 
         javax.servlet.http       
        </Import-Package> 
        <DynamicImport-Package> 
         javax.*, 
         org.xml.sax, 
         org.xml.sax.*, 
         org.w3c.*       
        </DynamicImport-Package> 
        <Export-Package>*</Export-Package> 
        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
        <Embed-Transitive>true</Embed-Transitive>      
       </instructions> 
      </configuration> 
     </plugin> 
    </plugins> 
    <finalName>${bundlename}-${project.version}</finalName> 
</build> 
<dependencies> 
    <dependency> 
     <groupId>com.sun.xml.ws</groupId> 
     <artifactId>jaxws-rt</artifactId> 
     <version>2.2.10</version> 
    </dependency> 
</dependencies> 

的pom.xml(hu.libra.commons.osgi.core.wsbundle)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <bundlename>hu.libra.commons.osgi.core.wsbundle</bundlename> 
</properties> 

<organization> 
    <name>Libra Szoftver Zrt.</name> 
    <url>http://www.libra.hu</url> 
</organization> 

<modelVersion>4.0.0</modelVersion> 
<groupId>hu.libra.commons</groupId> 
<artifactId>libra-commons-osgi-core-wsbundle</artifactId> 
<version>1.7.0</version> 
<name>Libra Common OSGi Core Webservice Bundle</name> 
<packaging>war</packaging> 

<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
     </resource> 
    </resources> 

    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 
       </archive> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <executions> 
       <execution> 
        <id>bundle-manifest</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>manifest</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <supportedProjectTypes> 
        <supportedProjectType>war</supportedProjectType> 
       </supportedProjectTypes> 
       <instructions> 
        <Bundle-SymbolicName>${bundlename}</Bundle-SymbolicName> 
        <Private-Package>hu.libra.commons.osgi.core.wsbundle</Private-Package> 
        <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath> 
        <Web-ContextPath>/libraosgicore</Web-ContextPath> 
        <Webapp-Context>/libraosgicore</Webapp-Context> 
       </instructions> 
      </configuration> 
     </plugin> 
    </plugins> 
    <finalName>${bundlename}-${project.version}</finalName> 
</build> 

<dependencies> 
    <!-- OSGi --> 
    <dependency> 
     <groupId>org.osgi</groupId> 
     <artifactId>org.osgi.core</artifactId> 
     <version>6.0.0</version> 
     <scope>provided</scope> 
    </dependency> 

    <!-- Libra OSGi Core Service --> 
    <dependency> 
     <groupId>hu.libra.commons</groupId> 
     <artifactId>libra-commons-osgi-utils</artifactId> 
     <version>1.7.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>hu.libra.commons</groupId> 
     <artifactId>libra-commons-osgi-core-service</artifactId> 
     <version>1.7.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>hu.libra.commons</groupId> 
     <artifactId>libra-commons-webservice-core</artifactId> 
     <version>1.7.0</version> 
     <scope>provided</scope> 
    </dependency>  
</dependencies> 

异常日志/堆栈跟踪

java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener 
    at java.lang.ClassLoader.findClass(ClassLoader.java:530) 
    at org.apache.felix.http.jetty.internal.WebAppBundleContext$1.findClass(WebAppBundleContext.java:54) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1681) 
    at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1897) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:83) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:70) 
    at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:403) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1364) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
2017-05-30 09:12:27.083:WARN:oejs.BaseHolder:Jetty HTTP Service: 
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    at java.lang.ClassLoader.findClass(ClassLoader.java:530) 
    at org.apache.felix.http.jetty.internal.WebAppBundleContext$1.findClass(WebAppBundleContext.java:54) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:86) 
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:874) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
2017-05-30 09:12:27.083:WARN:/libraosgicore:Jetty HTTP Service: unavailable 
javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:102) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:874) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
2017-05-30 09:12:27.084:WARN:oejs.BaseHolder:Jetty HTTP Service: 
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    at java.lang.ClassLoader.findClass(ClassLoader.java:530) 
    at org.apache.felix.http.jetty.internal.WebAppBundleContext$1.findClass(WebAppBundleContext.java:54) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:86) 
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:892) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
2017-05-30 09:12:27.084:WARN:/libraosgicore:Jetty HTTP Service: unavailable 
javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:102) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:892) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
2017-05-30 09:12:27.085:WARN:oejw.WebAppContext:Jetty HTTP Service: Failed startup of context [email protected]{/libraosgicore,bundle://23.0:0/,UNAVAILABLE}{libraosgicore} 
MultiException[javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet, javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet] 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:846) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Suppressed: 
    |javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    | at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:102) 
    | at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    | at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:892) 
    | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    | at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    | at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    | at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    | at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    | at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    | at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    | at java.lang.Thread.run(Thread.java:745) 
Caused by: 
javax.servlet.UnavailableException: com.sun.xml.ws.transport.http.servlet.WSServlet 
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:102) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:874) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349) 
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1404) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1366) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) 
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.apache.felix.http.jetty.internal.JettyService$4.doExecute(JettyService.java:817) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:976) 
    at org.apache.felix.http.jetty.internal.JettyService$JettyOperation.call(JettyService.java:966) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
+0

您应该从这些POM中删除''和''部分。 –

回答

0

问题可能是com.sun.xml包在Java框架中 - 因为我知道jaxws运行时随JRE一起提供。 java框架包可以在容器的启动委托包中定义或作为框架扩展包来定义。

实施例扩展波姆:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
    <parent> 
    <groupId>com.github.livesense</groupId> 
    <artifactId>org.liveSense.parent</artifactId> 
    <version>1.0.6-SNAPSHOT</version> 
    <relativePath>..</relativePath> 
    </parent> 
    <version>1.0.6-SNAPSHOT</version> 
<scm> 
    <connection>scm:git:https://github.com/liveSense/org.liveSense.fragment.sun.misc.git</connection> 
    <developerConnection>scm:git:https://github.com/liveSense/org.liveSense.fragment.sun.misc.git</developerConnection> 
    <url>https://github.com/liveSense/org.liveSense.fragment.sun.misc</url> 
    <tag>HEAD</tag> 
</scm> 
<artifactId>org.liveSense.fragment.sun.misc</artifactId> 
<packaging>jar</packaging> 
<name>liveSense :: Extension :: Sun misc</name> 
<description> 
     This bundle extends the System Bundle export 
     list with the sun.misc package such 
     that OSGi bundles may refer to Sun's misc implementation 
     without the OSGi framework itself to provide it in a 
     non-portable way. 
</description> 
<build> 
    <plugins> 
    <plugin> 
     <artifactId>maven-jar-plugin</artifactId> 
     <configuration> 
     <forceCreation>true</forceCreation> 
     <archive> 
      <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 
      <manifestEntries> 
      <Export-Package>sun.misc</Export-Package> 
      </manifestEntries> 
     </archive> 
     <configuration> 
    </plugin> 
    <plugin> 
     <groupId>org.apache.felix</groupId> 
     <artifactId>maven-bundle-plugin</artifactId> 
     <executions> 
     <execution> 
      <id>bundle-manifest</id> 
      <phase>process-classes</phase> 
      <goals> 
      <goal>manifest</goal> 
      </goals> 
     </execution> 
     </executions> 
     <configuration> 
     <instructions> 
      <Bundle-Category>liveSense</Bundle-Category> 
      <Fragment-Host>system.bundle; extension:=framework</Fragment-Host> 
     </instructions> 
     </configuration> 
    </plugin> 
    </plugins> 
</build> 
</project> 

而且THYE com.sun.misc包可以通过束导入。

+0

玩过导入和“org.osgi.framework.system.packages.extra”之后,ClassNotFoundException消失了,现在我得到了“javax.servlet.UnavailableException:Servlet类com.sun.xml.ws.transport.http。 servlet.WSServlet不是javax.servlet.Servlet“异常。 这是否意味着我使用了两个版本的javax.servlet.Servlet?我该如何解决这个问题? –