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 8087665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:51:06+00:00 2026-06-05T18:51:06+00:00

I am learning to implement restful webservices with Jersey. I always get POST http://localhost:8080/rest/welcome/post

  • 0

I am learning to implement restful webservices with Jersey. I always get “POST

http://localhost:8080/rest/welcome/post 

returned a response status of 404 Not Found” – What is wrong with my code below? Context root on the server side is rest and I have @Path welcome at class level and @pPath post at method level.

Client

public class WelcomeRestJsonClient {

    @Produces("application/json")
    @Consumes("text/plain")
    public void send() {
        MyObject myObject = new MyObject();

        ClientConfig clientConfig = new DefaultClientConfig();
        clientConfig.getClasses().add(com.restclient.MyJsonProvider.class);
        Client client = Client.create(clientConfig);
        WebResource webResource = client.resource("http://localhost:8080/rest/welcome/post");
        ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, myObject);
        System.out.println("success");
    }
}

Server

@Path("/welcome")
public class WelcomeRestJson {

    @POST
    @Path("/post")
    @Produces("text/plain")
    @Consumes("application/json")

    public String processPostData(MyObject myObject) {
        System.out.println("Inside processPostData");
        return "success";
    }
 }

Am I facing this problem because of incorrect JsonProvider configuration? On the client side, I am using MyJsonProvider which extends JacksonJaxbJsonProvider to convert MyObject to Json. My code on the server side simply accepts MyObject. Do I need some code to hook up Json provider on server side too?

Here is my web.xml

<servlet>
    <servlet-name>Jersey REST Service</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>com.rest</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Jersey REST Service</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

I can access rest index.html. I see the following in the log file.
INFO: Root resource classes found: class com.rest.WelcomeRestJson
I removed “/” with the path. Still same 404 error. Please help.

  • 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-06-05T18:51:08+00:00Added an answer on June 5, 2026 at 6:51 pm

    After adding Jersey Servlet to web.xml, get with no parameter started working. But post still failed. Adding the following init parameter to Jersey Servlet and replacing the Jersey Servlet mapping from /rest/* to /* fixed the issue.

    <init-param>
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
    </init-param>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´ve just started learning GWT and I´m trying to implement http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload and but failing
Has anyone tried to implement Numenta's most recent cortical learning theory ( http://www.numenta.com )?
As part of learning ruby/rails, I'm trying to implement http://github.com/professionalnerd/simple-private-messages into my application from
I'm still learning about Objective-C memory management. I'm trying to implement several simple classes
I'm trying to implement a basic jQuery infinite carousel. As much for the learning
I am learning OOP with python. I want to implement something like to display:
i just got some more questions while learning PHP, does php implement any built
I'm a Python guy. Learning C language and I've been trying to implement Binary
Background: I have created sample windows application for learning to implement localization. My each
I am learning how to implement some basic design patterns. Whilst learning the Singleton

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.