-
1. Re: How to use resteasy on jboss as 7?
swd847 Aug 29, 2011 4:03 AM (in response to baecks)You need to use one of the 3 options here:
https://docs.jboss.org/author/display/AS7/JAX-RS+Reference+Guide
The ApplicationPath annotation you have commented out in your POJO will not work, as it is on a resource class, not an application class.
-
2. Re: How to use resteasy on jboss as 7?
baecks Aug 29, 2011 7:35 AM (in response to swd847)Hi Stuart,
Thanks for your answer. I tried the options mentioned in the link you sent, but still it's not fully working. When e.g. I change my web.xml into:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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">
<servlet-mapping>
<servlet-name>org.test.resttest.RestRequest1</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
</web-app>
And my POJO code is:
package org.test.resttest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Application;
//@ApplicationPath( "api" )
//@Path("api")
public class RestRequest1 extends Application{
@GET
@Path("helloworld")
public String helloworld() {
return "Hello World!";
}
}
I get the folloing error for a get on "http://localhost:8080/RestTest1/hello/helloworld":
HTTP Status 404 - Could not find resource for relative : /helloworld of full path: http://localhost:8080/RestTest1/hello/helloworld
Would you have any idea?
Thanks,
Sven.
-
3. Re: How to use resteasy on jboss as 7?
smtrax Sep 19, 2011 8:53 AM (in response to baecks)Did you found a solution?
I have the same problem.
Here sais how to configure on JBoss M4 and Higher:
http://docs.jboss.org/resteasy/docs/2.3-beta-1/userguide/html_single/index.html#d0e219
On JBoss 6.0 Final works fine, but on JBoss 7.0.0 Final does not!
HTTP Status 404 - Could not find resource for relative
Does someone have idea, how to fix this?
-
4. Re: How to use resteasy on jboss as 7?
smtrax Sep 19, 2011 9:22 AM (in response to smtrax)1 of 1 people found this helpfulI found out how to do it:
1.) You have to extends javax.ws.rs.core.Application:
@Path("/library")
public class Test extends Application {
@GET
@Path("/books")
public String getBooks() { ... }
}
2.) annotate it with @ApplicationPath or add a servlet-mapping in web.xml
-
5. Re: How to use resteasy on jboss as 7?
smtrax Sep 20, 2011 8:28 AM (in response to smtrax)1 of 1 people found this helpfulAnother way to use RestEasy:
Without javax.ws.rs.Application....only properties in web.xml
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</init-param>
<init-param>
<param-name>resteasy.resources</param-name>
<param-value>
si.xxxx.sdp.rest.RestSmsService,
si.xxxx.sdp.rest.RestMailService
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
-
6. Re: How to use resteasy on jboss as 7?
prinzm Feb 4, 2012 2:08 PM (in response to smtrax)Should this solution work for JBoss AS 7.1 CR1?
Neither the ApplicationPath nor the Path annotation is working for me. I also tried the servlet entry in the web.xml, but without success.
I am always getting the same error message: HTTP Status 404 - Could not find resource for relative :...
-
7. Re: How to use resteasy on jboss as 7?
paulf70 Apr 2, 2013 10:14 PM (in response to prinzm)I'm having the same issue with 7.1 - REST service doesn't seem to deploy using the ApplicationPath annotation method. URL returns a 404. No error on the deploy or the fetch. Does someone have a working example for 7.1?