无法加载servlet类org.glassfish.jersey.servlet.ServletContainer

时间:2015-02-11 04:43:41

标签: spring maven jsf servlets jersey

这里的上下文是我正在尝试将项目配置为使用Spring JSF运行,并使用Maven作为依赖项管理器使用Jersey部署Web服务。 但是,当我尝试运行该项目时,日志告诉我servlet类org.glassfish.jersey.servlet.ServletContainer无法加载。但我查看了jar文件,我看到里面有类。 我确实搜索了很多方法来解决它,但似乎不是我的情况。 下面是我的pom.xml文件

<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>
<groupId>com.mycompany</groupId>
<artifactId>weservice</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>weservice Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
    <!-- JUnit dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <!-- JSF dependencies -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.4</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.4</version>
    </dependency>
    <!-- Java Servlet dependencies -->
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <!-- Spring 4.0.4 dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.1.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
        <version>2.15</version>
    </dependency>
    <!-- Jersey dependencies -->
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>2.15</version>         
    </dependency>
</dependencies>
<build>
    <finalName>weservice</finalName>
</build>

这是我的web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:web="http://xmlns.jcp.org/xml/ns/javaee">
    <display-name>Archetype Created Web Application</display-name>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <servlet>
        <description>JAX-RS Tools Generated - Do not modify</description>
        <servlet-name>JAX-RS Servlet</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>com.aavn.rest</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>JAX-RS Servlet</servlet-name>
        <url-pattern>/jaxrs/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
</web-app>

错误日志:

    !ENTRY org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.582
!MESSAGE 
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.582
!MESSAGE Failed to load servlet class org.glassfish.jersey.servlet.ServletContainer
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.582
!MESSAGE org.apache.geronimo.common.DeploymentException: Failed to load servlet class org.glassfish.jersey.servlet.ServletContainer
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.582
!MESSAGE    at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.getPortInfo(AdvancedWARWebServiceFinder.java:169)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.582
!MESSAGE    at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.discoverPOJOWebServices(AdvancedWARWebServiceFinder.java:143)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.discoverWebServices(AdvancedWARWebServiceFinder.java:44)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.discoverWebServices(AdvancedWARWebServiceFinder.java:37)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.WARWebServiceFinder.discoverWebServices(WARWebServiceFinder.java:51)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.WARWebServiceFinder.discoverWebServices(WARWebServiceFinder.java:28)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.JAXWSServiceBuilder.discoverWebServices(JAXWSServiceBuilder.java:245)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.JAXWSServiceBuilder.findWebServices(JAXWSServiceBuilder.java:103)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.postInitContext(TomcatModuleBuilder.java:454)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.initContext(AbstractWebModuleBuilder.java:437)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.initContext(SwitchingModuleBuilder.java:168)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:686)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:281)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:145)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.lang.reflect.Method.invoke(Method.java:606)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.lang.reflect.Method.invoke(Method.java:606)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.security.AccessController.doPrivileged(Native Method)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1427)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.lang.reflect.Method.invoke(Method.java:606)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.Transport$2.run(Transport.java:202)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.Transport$2.run(Transport.java:199)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.security.AccessController.doPrivileged(Native Method)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.security.AccessController.doPrivileged(Native Method)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.lang.Thread.run(Thread.java:745)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.getPortInfo(AdvancedWARWebServiceFinder.java:160)
!SUBENTRY 1 org.apache.geronimo.st.v30.core 4 0 2015-02-11 13:15:56.583
!MESSAGE    ... 57 more

如果您还需要其他任何信息,请告诉我们。

非常感谢

0 个答案:

没有答案