Not able to call RestEasy Url - rest

I am new to RestFul API. I have a sample Project which uses Maven. Am using Jboss server to deploy.
Problem is file is deployed but when i try to access the URl it says 404 error
url : http://localhost:8080/RESTEasy/rest/RESTEasyHelloWorld/data
There is no error in Console
Following are my files:
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>com.rest</groupId>
<artifactId>RESTEasy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.4.Final</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://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>RESTEasy</display-name>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<!-- Auto scan REST service -->
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<!-- this should be the same URL pattern as the servlet-mapping property -->
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
</web-app>
Rest Java file:
package com.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
#Path("/RESTEasyHelloWorld")
public class RESTEasyHelloWorldService {
#GET
#Path("/{pathParameter}")
public Response responseMsg( #PathParam("pathParameter") String pathParameter
) {
String response = "Hello from: " + pathParameter;
return Response.status(200).entity(response).build();
}
}
Server Log:
08:51:54,288 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876:
Starting deployment of "RESTEasy-0.0.1-SNAPSHOT.jar" (runtime-name: "RESTEasy-0.0.1-SNAPSHOT.jar")
08:51:54,300 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565:
Replaced deployment "RESTEasy-0.0.1-SNAPSHOT.jar" with deployment "RESTEasy-0.0.1-SNAPSHOT.jar"

The app needs to be deployed in a war (with the correct webapp structure) not a jar.
If you don't change the final name, the war will have the -0.0.1-SNAPSHOT suffix, which will be needed in the path. You could add <finalName>${project.artifactId}</finalName> to the <build> in the pom and that would just make the war the project name

Related

Can't get resteasy client to work

I've tried many different ways to make the resteasy client work for me, but I'm stuck on an error.
java.lang.LinkageError: Failed to link org/jboss/resteasy/client/jaxrs/internal/ClientConfiguration
Here is the method I'm using as a client
public void createIssue() {
issue = new Issue();
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("api-being-posted-to");
Response response = target.request().header("Authorization: ", "Basic Foo")
.post(Entity.entity(issueJson, "application/json"));
}
I can POST and GET with the same data this is using, and I've tried making a client work with different data and posting to different places and always get the same error. Here's my pom:
<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>org.foo.bar</groupId>
<artifactId>foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>example</name>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>3.0.8.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.1.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</build>
and here's my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
I'm using JBoss EAP 6.4 if that helps.
As far as I can tell the provided version of resteasy in JBoss EAP 6.4 is 3.0.21.Final and not 3.1.0.Final but you might have modified that (see https://developer.jboss.org/thread/262213 for reference).
You use different versions and different scopes for your resteasy libraries (3.0.8.Final for jaxrs-api) but that might still be ok.
I would always recommend to use the Resteasy Proxy Framework. It might be a bit more code to write but makes things easier and clearer in total:
Define an Interface:
public interface IssueIF
{
#POST
#Path("/issue")
#Produces("text/plain")
Issue postIssue(Issue i);
}
Use it:
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("http://example.com/base/uri");
SimpleClient simple = target.proxy(IssueIF.class);
Issue issue = new Issue();
client.postIssue(issue);
I did not compile this code, it is mostly copy/pasted from the docs but it should be close to what you need.
Edit:
From the docs:
Subclasses of LinkageError indicate that a class has some dependency
on another class; however, the latter class has incompatibly changed
after the compilation of the former class.
This suggest that you have a problem with different library versions you use for compilation and on runtime so see above at no 1.
Especially if you use different scopes it is essential that the versions are the same for compilation and runtime! So try to find out which versions your JBoss supplies and only use these versions. Also find out which of your referenced libraries are supplied and mark all of them with scope provided.

Web service maven build jar does not work

I would like to build a web service project in jar which can be deployed on a JBoss server. This can be done if I compile a .war project, which makes 12Mo with this content
but in my pom.xml when I want to specify that I would like a .jar project I get an archive which makes 10Ko and which contains almost nothing like this picture
Here's my pom.xml file
<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>MonWebServiceFacility</groupId>
<artifactId>MonWebServiceFacility</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!--<packaging>war</packaging>-->
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<cxf.version>3.1.7</cxf.version>
</properties>
<dependencies>
...SOME DEPENENCIES...
</dependencies>
So how can I build jar archive to be deployed in my JBoss server ?
Here's my project architecture :
you need to use <packaging>jar</packaging> in pom.xml and also need to create web.xml into webaap>WEB_INF folder.
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:ApplicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>

ear deploying to jboss 7 is successfully but context-root doesn't work

I'm using maven 3.3.3 for create ear application(with war and jars).
web-xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<welcome-file-list>
<welcome-file>/landingPage.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
ear pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>com.csaszi</groupId>
<artifactId>topModule</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>berszamfejto-ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-web</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-ejb</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-persistence</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<includeLibInApplicationXml>true</includeLibInApplicationXml>
<finalName>berszamfejto</finalName>
<modules>
<webModule>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-web</artifactId>
<bundleFileName>berszamfejto-web-1.0.war</bundleFileName>
<contextRoot>/berszamfejto</contextRoot>
</webModule>
<jarModule>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-ejb</artifactId>
<bundleFileName>berszamfejto-ejb-1.0.jar</bundleFileName>
</jarModule>
<jarModule>
<groupId>com.csaszi</groupId>
<artifactId>berszamfejto-persistence</artifactId>
<bundleFileName>berszamfejto-persistence-1.0.jar</bundleFileName>
</jarModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
application.xml(generated by maven install):
<display-name>berszamfejto-ear</display-name>
<module>
<web>
<web-uri>berszamfejto-web-1.0.war</web-uri>
<context-root>/berszamfejto</context-root>
</web>
I tried the following urls but none of them worked:
localhost:8081/landingPage.xhtml
localhost:8081/berszamfejto/landingPage.xhtml
localhost:8081/berszamfejto-web/landingPage.xhtml
localhost:8081/berszamfejto-ear/landingPage.xhtml
localhost:8081/berszamfejto-web/
localhost:8081/berszamfejto-ear/
localhost:8081/berszamfejto-web
localhost:8081/berszamfejto-ear
localhost:8081/berszamfejto-web-1.0
localhost:8081/berszamfejto-ear-1.0
and following logical names...
I think I use maven wrong because without it I found the url and the war works well. I'm sure that port number 8081 is good and I can login into administration console and deploy my ear.
Here is the end of log of deploying:
[2016-05-28 03:04:02,872] Artifact berszamfejto-ear:ear exploded:
Artifact is being deployed, please wait...
15:04:03,204 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876:
Starting deployment of "berszamfejto-ear-1.0"
15:04:03,474 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS018559:
Deployed "berszamfejto-ear-1.0"
[2016-05-28 03:04:03,507] Artifact berszamfejto-ear:ear exploded:
Artifact is deployed successfully
[2016-05-28 03:04:03,507] Artifact berszamfejto-ear:ear exploded:
Deploy took 635 milliseconds

Hello world of RESTful based on Jersey and Jetty

I'm following this guide to build my hello world web service and get kind of stuck, here are my codes:
MyResource.java:
package com.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
#Path("myresource")
public class MyResource {
#GET
#Produces("text/plain")
public String getIt() {
return "Got it!";
}
}
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ts</groupId>
<artifactId>mtest</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>mtest Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jetty-http</artifactId>
<version>2.19</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jetty-servlet</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<build>
<finalName>mtest</finalName>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.0.M1</version>
</plugin>
</plugins>
</build>
web.xml:
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Servlet declaration can be omitted in which case
it would be automatically added by Jersey -->
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/myresource/*</url-pattern>
</servlet-mapping>
Now my problems are:
After launching Jetty, I can get a hello world of my jsp from http://localhost:8080/, but http://localhost:8080/myresource returns 404
Intellij complains Element web-app must be declared
Add your servlet declaration in the web.xml like this
<servlet>
<servlet-name>javax.ws.rs.core.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.example</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
that should work. And sometimes the path needs a bar like this.
#Path("/myresource")
And see that, if you put
<url-pattern>/myresource/*</url-pattern>
you have to hit
http://localhost:8080/myresource/myresource
one by your web configuration, and another by the path of your resource.
but, if you are trying this in tomcat, you need to include the artifactId too, like this:
http://localhost:8080/mtest/myresource/myresource
I hope that this help you.

Deploying a Jersey webapp on Jboss AS 7

Currently running some webapps on Jboss AS 4/5 and I am testing migration to jboss7. When I try to deploy a jersey based webapp on JBoss AS 7 (full profile with standalone-preview config file), I get:
org.jboss.as.server.deployment.DeploymentUnitProcessingException: Only one JAX-RS Application Class allowed.
I've done a bit of hunting around on it and found that RestEasy is the default JAX-RS implementation embedded into Application Server. Posts like http://community.jboss.org/message/579996 and https://issues.jboss.org/browse/JBAS-8830) mention that the RestEasy deployer takes over.
In AS 6, it seems easier to remove the deployer whereas I have not seen any solutions for AS 7.
it has already been mentioned in this post : https://community.jboss.org/message/744530#744530 , you can just ask the resteasy module to not scan for other JAX RS implementations in your webapp; just add this 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>
worked fine for me
Besides removing the entire jaxrs subsystem in standalone.xml as mentioned in the other posts excluding the RESTEasy modules in jboss-deployment-structure.xml may also work.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-atom-provider" />
<module name="org.jboss.resteasy.resteasy-cdi" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-jaxb-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jsapi" />
<module name="org.jboss.resteasy.resteasy-multipart-provider" />
<module name="org.jboss.resteasy.async-http-servlet-30" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Also check out
JBoss Deployment Structure File
Implicit module dependencies for deployments
I believe the correct approach is to use app server agnostic JAX-RS application deployment. No need to mess with any JBoss configuration. All you need is, extend javax.ws.rs.core.Application in your JAX-RS web application. You can find an example here. Then, you need to put this in your web.xml.
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>jersey.MyApplication</param-value>
</init-param>
<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>
<load-on-startup>1</load-on-startup>
</servlet>
Package scanning mechanism does not work correctly on JBoss 7.x. I have tested this approach successfully in JBoss 7.0.2.Final and JBoss 7.1.1.Final.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
Will do the trick, works great with 7.3AS.ctomc just missed a tiny slash in the end to terminate the section.:-)
I managed to run Jersey WS on my JBOSS AS7.
What i do for JBOSS is just remove everything related to jax-rs in standalone.xml
My jersey sample code got from:
http://www.ibm.com/developerworks/web/library/wa-aj-tomcat/
The only thing i do for the jersey is remove the init-param from web.xml and copy jersey lib to WebContent/WEB-INF/lib.
<!--<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>sample.hello.resources</param-value>
</init-param>-->
In web.xml file add the files
<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>
and comment out the init-param
<!-- <init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value></param-value>
</init-param> -->
This worked out for me in jboss-as-7.1.1.Final and i did not do any changes in standalone.xml.
Ahother option:
Edit standalone/configuration/standalone.xml and comments out all jaxrs entries. This will configure Jersey instead of RESTEasy.
Remove jboss-web.xml from WEB-INF/web.xml. This file no longers works with JBoss 7
Edit web.xml, add an init-param com.sun.jersey.config.property.packages configured to your resource's package, like:
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.foo</param-value>
</init-param>
https://github.com/Atmosphere/atmosphere/wiki/Deploying-Atmosphere-Jersey-in-JBoss-7.1.x
You can get past this in the standalone configuration by modifying configuration/standalone.xml and removing references to jaxrs in the extensions and profile section. Note, even though I commented those portions out in my standalone.xml, JBoss will automagically remove those references altogether on next startup...
Here is what worked for me for JBoss 7.1.1 and Jersey 1.17.1. No need to modify standalone.xml or domain.xml. Besides filtering restEasy in web.xml instruct Jersey to use Jackson. You can read about this configuration here.
To save time in configuration guesses, I am posting web.xml and pom.xml from test project.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>TestJerseyonJBoss</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.test.rest</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<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>
</web-app>
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>TestJerseyOnJBoss</groupId>
<artifactId>TestJerseyOnJBoss</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
You should exclude jaxrs subsystem from being activated for your deployment
add this into META-INF/jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
<deployment>
</jboss-deployment-structure>
or you can go to standalone.xml and remove subsystem there.
To do so, you need to remove
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0">
...
...
<subsystem>
part of configuration, extension part of on top can stay it wont hurt either way.
or you can connect to server with CLI and run
/subsystem=webservices:remove()
Just a note, exclude-subsystems functionality and deployment-strucure:1.2 was added in 7.1.2 and as such will not work on on 7.1.1.