Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3358282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:44:02+00:00 2026-05-18T02:44:02+00:00

I was messing around with JAX-RS and made an application which calls REST services

  • 0

I was messing around with JAX-RS and made an application which calls REST services which produce JSON. I tried Jersey and everything went fine, but I had to switch to RESTEasy as my application needs to be built with JDK5. I changed my web.xml to something like this:

<web-app>
<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>true</param-value>
</context-param>

<listener>
    <listener-class>
     org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
    </listener-class>
</listener>

<servlet>
    <servlet-name>RESTEasy</servlet-name>
    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>RESTEasy</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<!-- ... -->
</web-app>

So I expect every URL starting with /rest to be handled by RESTEasy. My services are as follows:

@Path("/services")
public class MyRESTServices {

    @GET
    @Path("service1")
    @Produces(MediaType.APPLICATION_JSON)
    public Object service1(Blah blah) {

    }
}

This worked fine using Jersey, http://localhost/MyContext/rest/services/service1 was bound to my service1() method. When I change to RESTEasy, though, I had a 404:

HTTP Status 404 – Could not find resource for relative : /rest/services/service1 of full path: http://localhost/MyContext/rest/services/service1

Which means that RESTEasy handled the request but could not find any service bound to this URL.

On my class, changing @Path("/services") to @Path("/rest/services") worked, though. Do you have any idea why I got this strange behaviour? All the tutorials/docs I read mentionned only relative paths, not including the /rest prefix…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:44:02+00:00Added an answer on May 18, 2026 at 2:44 am

    Solution: add the following in your web.xml

    <context-param>
        <param-name>resteasy.servlet.mapping.prefix</param-name>
        <param-value>/rest</param-value>
    </context-param>
    

    Where /rest is the beginning of your <url-pattern>/rest/*</url-pattern>

    (Source: http://docs.jboss.org/resteasy/docs/2.0.0.GA/userguide/html/Installation_Configuration.html#d0e72)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just messing around with templates, when I tried to do this: template<typename
Just messing around with Rails 3.1, which separates stylesheets via controllers. I'm assuming there
after messing around with parsing a JSON response with GSON for a day, I
I've been messing around with Android development. I made a simple form that has
ive been messing around in android and have made my first screen. Its nothing
While messing around with the custom formatting options in Eclipse, in one of the
I just started messing around with the lastfm API and I'm not sure why
I am messing around with a toy interpreter in Java and I was considering
I was messing around with RhinoMocks this morning and couldn't run my tests because
I am messing around with Doctrine (version 1.0.3) to see if would make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.