Je fais face au problème suivant. J'ai passé plus de 3 jours sur ce sujet mais je ne trouve pas de solution. Veuillez me guider ce que je fais mal ici. Je suis nouveau sur Resteasy avec wildfly.
Voici le stacktrace
19:05:57,610 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-14) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUser
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.Java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.Java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.Java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.Java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.Java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.Java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.Java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.Java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.Java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.Java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.Java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.Java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.Java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.Java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.Java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.Java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.Java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.Java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.Java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.Java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.Java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.Java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.Java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.Java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.Java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.Java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.Java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142) [rt.jar:1.8.0_20]
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617) [rt.jar:1.8.0_20]
at Java.lang.Thread.run(Thread.Java:745) [rt.jar:1.8.0_20]
Voici mon web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>
Voici la classe Application.
package com.abc.admin.services.config;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/services")
public class WebConfig extends Application {
}
Voici la classe de service Web.
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
@Path("/services/user/getUser")
@Produces(MediaType.APPLICATION_JSON)
public UserWsPojo getUser(String id) {
UserWsPojo uwp = new UserWsPojo();
uwp.setName("Aayush");
uwp.setSurname("Devmurari");
return uwp;
}
}
Maintenant, dans la classe mentionnée ci-dessus, j'ai également essayé de changer le chemin de @Path avec/getUser et j'ai également essayé le chemin complet, c'est-à-dire @Path ("/ services/user/getUser"), aucun de ceux-ci ne fonctionne à chaque fois que je reçois la même erreur.
Si vous avez besoin de voir autre chose, faites-le moi savoir. Je vais le poster ici.
Merci d'avoir lu et aidé.
P.S J'ai essayé de lire d'autres questions sur SO, la documentation sur RestEasy rien de tout cela ne m'a beaucoup aidé. Cependant j'ai corrigé mon code en cherchant la solution.
Sur la base des réponses, je l'ai fait aussi
@Path("/user")
public class UserResource implements Serializable {
private static final long serialVersionUID = 6766329501327292893L;
@GET
@Path("/getUser")
@Produces(MediaType.APPLICATION_JSON)
public UserWsPojo getUser() {
UserWsPojo uwp = new UserWsPojo();
uwp.setName("Aayush");
uwp.setSurname("Devmurari");
return uwp;
}
}
Les autres choses sont les mêmes qu'elles sont, mais je reçois toujours la même erreur.
22:15:58,489 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-5) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUsers
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.Java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.Java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.Java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.Java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.Java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.Java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.Java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.Java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.Java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.Java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.Java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.Java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.Java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.Java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.Java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.Java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.Java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.Java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.Java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.Java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.Java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.Java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.Java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.Java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.Java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.Java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.Java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.Java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142) [rt.jar:1.8.0_20]
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617) [rt.jar:1.8.0_20]
at Java.lang.Thread.run(Thread.Java:745) [rt.jar:1.8.0_20]
Base:
(1) http://localhost:8080/admin-ws (I assume `admin-ws` is the app name)
@ApplicationPath("/services")
== ajoutez /services
à Base
(2) http://localhost:8080/admin-ws/services
@Path("/user")
== ajouter /user
au précédent
(3) http://localhost:8080/admin-ws/services/user
@Path("/services/user/getUser")
== ajouter /services/user/getUser
au précédent
(4) http://localhost:8080/admin-ws/services/user/services/user/getUser
//This is the winner with your current set up
Ce que vous utilisez:
http://localhost:8080/admin-ws/services/user/getUser
Qu'est ce qui est different?
@ApplicationPath("/services")
public class WebConfig extends Application {
}
@Path("/users")
public class UserResource implements Serializable {
@Inject
private UserService userService;
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public UserWsPojo getUser(@PathParam("id") String id) {
UserWsPojo uwp = userService.getUserById(id);
return uwp;
}
}
Accès:
http://localhost:8080/admin-ws/services/users/12344
// some user id
J'ai eu le même problème lorsque j'ai essayé avec 3.0.11.Final
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.11.Final</version>
</dependency>
mais quand j'ai essayé avec une autre version ça a marché.
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.4.Final</version>
</dependency>
J'espère que cela t'aides.
La consolidation de toutes les réponses et du code ci-dessous devrait fonctionner. Testé dans Tomcat 7.0.56, RESTEasy 3.0.10, Netbeans 8.0.2
WebConfig.Java:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/services")
public class WebConfig extends Application {
// No methods defined inside
}
SayHello.Java:
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.Produces;
@Path("/greet")
public class SayHello {
@GET
@Path("/{username}")
@Produces("text/html")
public Response printMessage(@PathParam("username") String username) {
return Response.status(200).entity("Hello " + username).build();
}
}
Web.xml généré par Netbeans: aucun changement nécessaire
<?xml version="1.0" encoding="UTF-8"?>
<!-- With RESTEasy no web.xml configuration required-->
<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">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
RL de votre REST SERVICE:
http://hostname:<port>/<yourappcontext>/services/greet/<enterusername>
Réponse attendue:
Hello <username>
Netbeans a généré POM.XML: (assurez-vous d'inclure la dépendance resteasy-servlet-initializer si vous utilisez Tomcat et la version 2.3 ou supérieure pour maven-war-plugin)
<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.easyrest</groupId>
<artifactId>easyrest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>easyrest</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Add POM dependencies -->
<repositories>
<repository>
<id>org.jboss.resteasy</id>
<url>http://repo.maven.Apache.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.10.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-servlet-initializer</artifactId>
<version>3.0.10.Final</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
J'ai rencontré le même problème (javax.ws.rs.NotFoundException: impossible de trouver la ressource pour le chemin complet ...). Basé sur ce lien , les étapes pour résoudre le problème sont les suivantes:
1) Définissez la classe d'application:
/**
* 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) Définissez la classe de ressources:
/**
* 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) Définissez le fichier 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) Testez la configuration dans un navigateur:
http: // localhost: 8080/restContext/rest/services/user/getUser
Cela fonctionne pour tous mes services.
This is a runtime exception indicating a resource requested by a client was not found on the server.
Add below entry into your web.xml :
<context-param>
<param-name>resteasy.resources</param-name>
<param-value>com.org.abc.xyz.MainClassName</param-value>
</context-param>
Vous pouvez spécifier le nom complet de votre nom de classe de ressources JAX-RS que vous souhaitez enregistrer. Si vous avez plusieurs entrées de classes, utilisez un délimiteur de virgule.
J'ai le même problème (NotFound). Après le débogage, il s'est avéré que j'ai raté la méthode. (@GET, @POST ...) sur le contrôleur
@Path("/create")
public Response createObject(){
}
//correct
@GET // or @POST
@Path("/create")
public Response createObject(){
}
C'est difficile à dire avec certitude, mais une chose que je vois est que vous passez un paramètre mais ne mappez aucun paramètre dans l'URL. Ce serait plus correct:
@GET
@Path("/getUser/{id}")
@Produces(MediaType.APPLICATION_JSON)
public UserWsPojo getUser(@PathParam("id") String id) {
// do things with stuff
}
Et puis l'URL complète serait/admin-ws/services/user/getUser/1 pour obtenir un utilisateur avec l'ID 1.