NoSuchMethodError javax.ws.rs.core.Application.getProperties()Ljava/util/Map

别说谁变了你拦得住时间么 提交于 2019-12-06 16:31:25

As mentioned in the JBoss AS 7 documentation, the version of the JAX-RS specification used is 1.1.

Therefore, in order to use Jsersey 2.X, which provides support for JAX-RS APIs and serves both JAX-RS 1.x and JAX-RS 2.x reference implementations, you need to exclude the conflicts with RESTEasy by adding the following to your WEB-INF/jboss-deployment-structure.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <!-- Exclude RestEasy conflicts -->
            <module name="javaee.api" />
            <module name="javax.ws.rs.api"/>
            <module name="org.jboss.resteasy.resteasy-jaxrs" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Also, you need to add the following to your web.xml:

<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.providers</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>false</param-value>
</context-param>

The related JBoss forum threads are the following:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!