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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:42:20+00:00 2026-06-03T07:42:20+00:00

I am trying to develop a basic Restful service using Jersey Maven and Eclipse

  • 0

I am trying to develop a basic Restful service using Jersey Maven and Eclipse.

I am following the example given here.

I followed the steps as given in the link but when I try to run the project I get a Request Resource Not available error.

This is my modified dependency in pom.xml file

 <dependencies>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
</dependency>
<dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.4</version>
  <scope>provided</scope>
 </dependency>

and modified Build in pom.xml

<finalName>maven.secondrest</finalName>
<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
        <configuration>
            <port>9999</port>
            <path>/</path>
                <warFile>${project.basedir}/target/${project.build.finalName}.war</warFile>
        </configuration>
    </plugin>
</plugins>

The web.xml is very much the same as given in the example:

<display-name>Restful Web Application</display-name>

<servlet>
    <servlet-name>jersey-serlvet</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>rest.model</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>jersey-serlvet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

and this is altered java code:

package rest.model;
//imports
@Path("/hello")
public class HelloWorldService {
@GET
@Path("/{param}")
public Response getMsg(@PathParam("param") String msg) {
    String output = "Jersey say : " + msg;
    return Response.status(200).entity(output).build();
}
}

I am trying to run it by using: mvn tomcat:run

When I enter localhost:9999 it displays a message “Hello World”. But when I enter the url as given in the example I get a resource not found error.

This is the url I run: http://localhost:9999/maven.secondrest/rest/hello/nelo

  • 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-03T07:42:21+00:00Added an answer on June 3, 2026 at 7:42 am

    I seems like I was using the URL incorrectly. The correct URL to access this service would be localhost:9999/rest/hello/nelo. That is, leaving out the project name as it has already been mentioned in the plugin.

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

Sidebar

Related Questions

I am trying to develop my first restful service in Java and having some
I am trying develop a basic referrer system to my Django website, system will
I am trying to develop a .NET Web Project using NHibernate and Spring.NET, but
I am trying to develop an online translation service (sort of a personal challenge)
I'm trying to develop a basic GPA Calculator. I have an AllCourses class that
I am currently trying to develop a basic pixel editor application to build up
I am trying to learn something basic and very important to develop decent iPhone
I am trying to develop a very basic console application that will retrieve a
I am trying to develop a basic app to display information in 2 tabs,
I am trying to develop a simple webpage with all the newly added basic

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.