为了账号安全,请及时绑定邮箱和手机立即绑定

Java Web 应用程序无法在使用 Jersey 2.26 的 Tomcat

Java Web 应用程序无法在使用 Jersey 2.26 的 Tomcat

largeQ 2021-07-08 21:16:04
我正在尝试使用使用 Maven 构建的 Jersey 2.26 将一个简单的 Java (1.8) Web 应用程序部署到 Tomcat 9(也在 8.5 上尝试过)。我在构建但部署到 Tomcat 时没有看到任何错误,应用程序没有启动。我指的是这里列出的选项https://jersey.github.io/documentation/latest/deployment.html#deployment.servlet.3Tomcat 日志/catalina.out 中的错误17-Aug-2018 21:46:06.062 SEVERE [http-nio-8080-exec-39] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/Users/konathal/Software/apache-tomcat-9.0.10/webapps/jaq-stack-webapp.war] java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Application    at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.addServletWithDefaultConfiguration(JerseyServletContainerInitializer.java:240)pom.xml <dependency>   <groupId>org.glassfish.jersey.containers</groupId>   <artifactId>jersey-container-servlet</artifactId>   <version>2.26</version> </dependency> <dependency>   <groupId>org.glassfish.jersey.core</groupId>   <artifactId>jersey-server</artifactId>   <version>2.26</version> </dependency> <dependency>   <groupId>org.glassfish.jersey.inject</groupId>   <artifactId>jersey-hk2</artifactId>   <version>2.26</version> </dependency>网页.xml<servlet>  <servlet-name>javax.ws.rs.core.Application</servlet-name></servlet><servlet-mapping>  <servlet-name>javax.ws.rs.core.Application</servlet-name>  <url-pattern>/service/*</url-pattern></servlet-mapping>小服务程序类@Path("/dbservice")@Consumes(MediaType.APPLICATION_JSON)@Produces(MediaType.APPLICATION_JSON)public class MongoServlet {我错过了什么?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 332 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信