I am facing following problem. I have spent more than 3 days on this but cannot find a solution. Please guide me what I am doing wrong here. I am new to Resteasy with wildfl
I faced the same problem (javax.ws.rs.NotFoundException: Could not find resource for full path ...). Based on this link, the steps to solve the issue are below:
1) Set the application class:
/**
* Application class
*/
package com.abc.admin.services.config;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/services") // the begining of the Webservice URL
public class WebConfig extends Application {
private Set<Object> singletons = new HashSet<Object>();
public WebConfig() {
singletons.add(new UserResource());
}
@Override
public Set<Object> getSingletons() {
return singletons;
}
}
2) Set the Resource class:
/**
* Resource class
*/
package com.abc.admin.service;
import java.io.Serializable;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.abc.commons.ws.entity.UserWsPojo;
@Path("/user")
public class UserResource implements Serializable {
private static final long serialVersionUID = 6766329501327292893L;
@GET
// there is a URL concatenation to access the method (.../services/user/getUser)
@Path("/getUser")
@Produces(MediaType.APPLICATION_JSON)
public UserWsPojo getUser(String id) {
UserWsPojo uwp = new UserWsPojo();
uwp.setName("Aayush");
uwp.setSurname("Devmurari");
return uwp;
}
}
3) Set the 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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>restContext</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.abc.admin.services.config.WebConfig</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern> <!-- /* is not a comment, but part of the setting -->
</servlet-mapping>
</web-app>
4) Test the configuration in a browser:
http://localhost:8080/restContext/rest/services/user/getUser