java - 升级后启动服务器时出现 Resteasy 错误。 "both mapped to the url-pattern [/RESTEASY_HttpServlet30Dispatcher] which is not permitted"

标签 java maven tomcat resteasy

我将所有 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/

相关文章:

java - 警告 :/%3C%=request. getContextPath()%%3E/trailpath/trailpath.nocache.js : java. lang.NumberFormatException: =r

java - 像 Python 字典一样循环 Java HashMap?

java - 如何将 Csv 文件从专用服务器上传到非专用服务器,然后执行以下任务

java - 无法在项目上执行目标 org.codehaus.mojo :exec-maven-plugin:1. 2.1:exec (default-cli):命令执行失败

java - mvn jetty :run failing Caused by: java. lang.RuntimeException : Error scanning entry META-INF/versions/9/javax/xml/bind/ModuleUtil. 类

python-2.7 - requests.delete 在 Artifactory 上引发 GET 而不是 DELETE

tomcat - 子容器失败,无法启动组件

java - cucumber testng 运行程序失败

java - 如何通过 Telnet 发送字符串?

Java Maven MOJO - 从项目 POM 中获取信息