我将所有 Resteasy 依赖项更新为新版本,但现在,启动 tomcat 时总是遇到奇怪的错误。
这些是我的依赖项:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.13.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-servlet-initializer</artifactId>
<version>4.5.6.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<version>4.5.6.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cache-core</artifactId>
<version>4.5.6.Final</version>
</dependency>
这是我尝试启动服务器时遇到的错误:
Caused by: java.lang.IllegalArgumentException: The servlets named [org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher] and [org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher] are both mapped to the url-pattern [/RESTEASY_HttpServlet30Dispatcher] which is not permitted
at org.apache.tomcat.util.descriptor.web.WebXml.addServletMappingDecoded(WebXml.java:339)
at org.apache.tomcat.util.descriptor.web.WebXml.merge(WebXml.java:1634)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1148)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:776)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5063)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 43 more
我认为这可能与依赖项冲突有关,但我从maven中删除并再次下载,错误仍然存在。工作正常...
谢谢!
最佳答案
删除此依赖项:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.13.0.Final</version>
</dependency>
The resteasy-jaxrs and resteasy-client modules in RESTEasy 3 contain most of the framework classes and there's no real demarcation between what is internal implementation detail and what is for public consumption. In WildFly, the artifact archives from those modules are also included in a public module. Given the common expectation of full backward compatibility of whatever comes from public modules, to allow for easier project evolution and maintenance, in RESTEasy 4.0.0.Final those big components have been split as follows:
Resteasy documentation: https://docs.jboss.org/resteasy/docs/4.5.6.Final/userguide/html/Migration_from_older_versions.html
关于java - 升级后启动服务器时出现 Resteasy 错误。 "both mapped to the url-pattern [/RESTEASY_HttpServlet30Dispatcher] which is not permitted",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63748105/