其余应用程序未部署在tomcat 9上

时间:2019-07-19 05:13:55

标签: eclipse rest maven-3 jersey-2.0 tomcat9

我正在尝试用Java创建一个Rest应用程序。我按照以下教程中的说明进行操作。 https://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/ 我使用最新版本的eclipse EE,maven 3.6.1和javaSE11。服务器是Tomcat 9.0.20。

我能够成功完成Maven构建。没有错误。但是,当我尝试执行“在服务器上运行”时,它将失败。参见下面的错误日志

    java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
    implementation=org.glassfish.jersey.message.internal.DataSourceProvider
    contracts={javax.ws.rs.ext.MessageBodyWriter,javax.ws.rs.ext.MessageBodyReader}
    scope=javax.inject.Singleton
    qualifiers={}
    descriptorType=CLASS
    descriptorVisibility=NORMAL
    metadata=
    rank=0
    loader=null
    proxiable=null
    proxyForSameScope=null
    analysisName=null
    id=107
    locatorId=0
    identityHashCode=267445972
    reified=false)
    at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:705)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:464)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2310)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1395)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1390)
    at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1452)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1377)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1366)
    at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:158)
    at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:54)
    at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:337)
    at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:175)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:264)
    at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:136)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:372)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:372)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1122)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1077)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4868)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)

WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: javax/activation/DataSource
    at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138)
    at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2358)
    at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1378)
    at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1374)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1374)
    at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1317)
    at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83)
    at org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:148)
    at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:180)
    at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:129)
    at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:180)
    at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:740)
    at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:694)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:464)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2310)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1395)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1390)
    at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1452)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1377)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1366)
    at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:158)
    at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:54)
    at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:329)
    at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:157)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:265)
    at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:136)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:372)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:372)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1122)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1077)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4868)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1363)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1186)
    ... 76 more
MultiException stack 2 of 2
java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
    implementation=org.glassfish.jersey.message.internal.DataSourceProvider
    contracts={javax.ws.rs.ext.MessageBodyWriter,javax.ws.rs.ext.MessageBodyReader}
    scope=javax.inject.Singleton
    qualifiers={}
    descriptorType=CLASS
    descriptorVisibility=NORMAL
    metadata=
    rank=0
    loader=null
    proxiable=null
    proxyForSameScope=null
    analysisName=null
    id=107
    locatorId=0
    identityHashCode=267445972
    reified=false)
    at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:705)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:464)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2310)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1395)
    at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1390)
    at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:128)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1452)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1377)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1366)
    at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:158)
    at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:54)
    at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:329)
    at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:157)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:265)
    at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:136)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:372)
    at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:372)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1122)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1077)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4868)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)


Jul 19, 2019 10:36:50 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\docs]
Jul 19, 2019 10:36:50 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\docs] has finished in [16] ms
Jul 19, 2019 10:36:50 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\examples]
Jul 19, 2019 10:36:51 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 19, 2019 10:36:51 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 19, 2019 10:36:51 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@11bdab37')
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\examples] has finished in [220] ms
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\host-manager]
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\host-manager] has finished in [23] ms
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\manager]
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\manager] has finished in [19] ms
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\ROOT]
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [D:\softwares\apache-tomcat-9.0.20-windows-x64\apache-tomcat-9.0.20\webapps\ROOT] has finished in [19] ms
Jul 19, 2019 10:36:51 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Jul 19, 2019 10:36:51 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Jul 19, 2019 10:36:51 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in [1,941] milliseconds

我的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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>OnlineOrganicMarket</groupId>
    <artifactId>OnlineOrganicMarket</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <jersey2.version>2.27</jersey2.version>
        <jaxrs.version>2.1</jaxrs.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <!-- JAX-RS -->
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>${jaxrs.version}</version>
        </dependency>
        <!-- Jersey 2.19 -->
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <version>${jersey2.version}</version>
        </dependency>
        <!-- <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-server</artifactId> 
            <version>${jersey2.version}</version> </dependency> <dependency> <groupId>org.glassfish.jersey.core</groupId> 
            <artifactId>jersey-client</artifactId> <version>${jersey2.version}</version> 
            </dependency> -->
        <dependency>
            <groupId>org.glassfish.jersey.inject</groupId>
            <artifactId>jersey-hk2</artifactId>
            <version>${jersey2.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>2.26-b03</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>2.27</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>2.27</version>
        </dependency>
    </dependencies>
</project>

我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
  <display-name>OnlineOrganicMarket</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
        <servlet-name>Jersey Web Application</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.oom.services;com.oom.beans;com.oom.DAO;com.oom.util</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/OnlineOrganicMarket/*</url-pattern>
    </servlet-mapping>
</web-app>

我尝试了各种解决方案,例如切换服务器位置

0 个答案:

没有答案