javax.ws.rs.NotFoundException: Could not find resource for full path with RESTEasy and Wildfly 8.1.0.Final

43,335

Solution 1

  • Base:

    (1) http://localhost:8080/admin-ws  (I assume `admin-ws` is the app name)
    
  • @ApplicationPath("/services") == append /services to Base

    (2) http://localhost:8080/admin-ws/services
    
  • @Path("/user") == append /user to previous

    (3) http://localhost:8080/admin-ws/services/user
    
  • @Path("/services/user/getUser") == append /services/user/getUser to previous

    (4) http://localhost:8080/admin-ws/services/user/services/user/getUser
               //This is the winner with your current set up
    
  • What you are using:

    http://localhost:8080/admin-ws/services/user/getUser
    

    What's different?

How it Should Look : to follow good REST (naming included) practices

@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;
    }
}

Access:

http://localhost:8080/admin-ws/services/users/12344
                                       // some user id

Solution 2

I got the same issue when I tried with 3.0.11.Final

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.11.Final</version>
</dependency>

but when I tried with another version it worked.

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.4.Final</version>
</dependency>

Hope this helps.

Solution 3

Consolidating all the response and below code should work. Tested in 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();
    }

}

Netbeans generated web.xml: no change needed

<?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>

URL to Your REST SERVICE:

http://hostname:<port>/<yourappcontext>/services/greet/<enterusername>

Expected Response:

Hello <username>

Netbeans generated POM.XML: (make sure to include resteasy-servlet-initializer dependency if using tomcat and version 2.3 or greater for 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>

Solution 4

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

Solution 5

This works for all my 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>

You can specify fully qualified name of your JAX-RS resource class name you want to register. If you have multiple classes entries, use comma delimiter.

Share:
43,335
Bilbo Baggins
Author by

Bilbo Baggins

Hello everyone, I am working as a Java Developer recently joined in a Company. And just finished my Post graduation in Computer application ..... :) :) :) #SOreadytohelp

Updated on July 12, 2022

Comments

  • Bilbo Baggins
    Bilbo Baggins almost 2 years

    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 wildfly.

    Here is the 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]
    

    Here is my 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>
    

    Here is the Application class.

    package com.abc.admin.services.config;
    
    import javax.ws.rs.ApplicationPath;
    import javax.ws.rs.core.Application;
    
    @ApplicationPath("/services")
    public class WebConfig extends Application {
    
    }
    

    Here is the web service 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
        @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;
        }
    }
    

    Now in the above mentioned class I also tried to change the path of @Path with /getUser and also tried full path i.e. @Path("/services/user/getUser") none of these are working everytime I get the same error.

    If you need to see anything else please let me know. I will post it here.

    Thanks for reading and helping.

    P.S I have tried reading other questions on SO, documentation on RestEasy none of this helped me much. However I corrected my code while looking for the solution.

    Based on the answers I did this too

    @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;
        }
    }
    

    Other things are same as they are, still I am getting the same error.

    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]
    
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    Updated my question as you have explained here tried that too but still the same error. :( :(
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    I removed the parameter still I am getting the same error, I have updated my question please have a look.
  • Paul Samsotha
    Paul Samsotha over 9 years
    Your @Path is getUser (no s). Your request is getUsers (with s)
  • Paul Samsotha
    Paul Samsotha over 9 years
    Please also note the REST naming convention. /users for a collection resource (plural). We also make use of {id} path parameters for values that will vary
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    I have removed the extra "s" while trying your answer, please view my updated code in question, I have updated my question. Thanx for replying fast :)
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    pardon me for the url, i seem to have copied older stack trace. But I still get the same error. :)
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    Yes, I am using maven, I now the error has changed from resource not found to "Not Found". Do you want me to post the pom??
  • Paul Samsotha
    Paul Samsotha over 9 years
    It looks fine, please try changing all the annotations to exactly like I have it and using this path http://localhost:8080/admin-ws/services/users/12344. Also you should clean and build your project. Look in the Wildfly standalone/deployment and delete the war and and unpackaged war, and deploy the newly clean and built war. I have no problems with the code I have posted
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    Thanks but I am already doing these steps before deploying to wildfly, alway clean and build, However I will try to change the annotation as you have, one more thing I also have the jboss-deployment-structure.xml to load the resteasy modules in wildfly.
  • Paul Samsotha
    Paul Samsotha over 9 years
    Get rid of that. The JAX-RS module will automatically deploy with the Application class and @ApplicationPath annotation
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    Still the same error now the resource not found one :( :( Using java 8 is fine?? or its not yet compatible??
  • Paul Samsotha
    Paul Samsotha over 9 years
  • Paul Samsotha
    Paul Samsotha over 9 years
    @SamwiseGamgee See the project as Github. You should be able to import it to Developer Studio, then run it as is. I tested it and it works fine. You should be able to access http://localhost:8080/admin-ws/services/users/1234. Let me know if you have any questions.
  • Paul Samsotha
    Paul Samsotha over 9 years
    Please let me know if/when you get the project. I'd like to delete it afterwards.
  • Bilbo Baggins
    Bilbo Baggins over 9 years
    Hey there I follow this link examples.javacodegeeks.com/enterprise-java/rest/resteasy/… here if you can see sending a student is ok, I am doing the same in my code but its not working, i want to know why, I saw your code in your code if your remove the parameter and simply return a UserPojo instead of building a response and sending it should work as per the link I specified.
  • Paul Samsotha
    Paul Samsotha over 9 years
    Yes you don't need to build a response, but I do it out of preference as you can fine tune the response. Either way will be the same result for the body. I really don't get why you need me to test that link. Did you run my example? It works fine. Look from my code what you may be doing wrong. If you cannot run my example, then it may be something wrong that does not deal with the code. I ran it from Developer Studio
  • Bilbo Baggins
    Bilbo Baggins over 9 years
  • PAA
    PAA about 8 years
    I expect, code should work with latest dependencies as well. Did someone able to run code with 3.0.11.Final or 3.0.16.Final ????
  • Admin
    Admin over 7 years