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

  • Home
  • SEARCH
  • 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 6468259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:52:23+00:00 2026-05-25T05:52:23+00:00

I am using Jersey 1.8 and the tutorials that I am referring are quiet

  • 0

I am using Jersey 1.8 and the tutorials that I am referring are quiet old. Nothing works. I am referring to the tutorial given here

And get a class not found exception. as per the tutorial I made my Java Class as well as configured my web.xml. It shows me an exception and I am not getting a way to fix this. I would like to have a complete up to date tutorial for Jersey implementation. And if something is better than Jersey for REST implementation please suggest. I have rescently started with REST based web services and would appreciate if you can suggest me where to start from(I am only interested in REST). Below is the code that I wrote and compiled using eclipse.

Hello.java

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class Hello {

    //This method prints the Plain Text
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayPlainTextHello()
    {
        return "Hello Jersey";
    }

    //This is the XML request output

    @GET
    @Produces(MediaType.TEXT_XML)
    public String sayXMLHello()
    {
        return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
    }

    //This result is produced if HTML is requested

    @GET
    @Produces(MediaType.TEXT_HTML)
    public String sayHTMLHello()
    {
        return "<html> " + "<title>" + "Hello Jersey" + "</title>"
        + "<body><h1>" + "Hello Jersey" + "</body></h1>" + "</html> ";
    }

}

web.xml is as follows

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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>RESTFullApp</display-name>
  <servlet>
  <servlet-name>JerseyRESTService</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>RESTFullApp</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>JerseyRESTService</servlet-name>
  <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
<!--  <welcome-file-list>-->
<!--    <welcome-file>index.html</welcome-file>-->
<!--    <welcome-file>index.htm</welcome-file>-->
<!--    <welcome-file>index.jsp</welcome-file>-->
<!--    <welcome-file>default.html</welcome-file>-->
<!--    <welcome-file>default.htm</welcome-file>-->
<!--    <welcome-file>default.jsp</welcome-file>-->
<!--  </welcome-file-list>-->
</web-app>

Noe the error I get while I try to run is

exception 

javax.servlet.ServletException: Servlet.init() for servlet JerseyRESTService threw exception
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)


root cause 

com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
    com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
    com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1298)
    com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
    com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
    com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
    com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
    com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
    com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
    com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
    com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
    javax.servlet.GenericServlet.init(GenericServlet.java:212)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)
  • 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-25T05:52:24+00:00Added an answer on May 25, 2026 at 5:52 am

    You’re not exactly following the tutorial. You changed bits here and there without actually understanding what they represents. In this particular case, according to the exception,

    com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

    the following init param is wrong

    <init-param>
       <param-name>com.sun.jersey.config.property.packages</param-name>
       <param-value>RESTFullApp</param-value>
    </init-param>
    

    It should refer to the package containing the services. Put your service in a package and specify that in the init param value. Jersey or not, using the default package is always a bad practice.

    As to the tutorials, why don’t you just read Jersey’s own documentation? Jersey Wiki and Jersey User Guide.

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

Sidebar

Related Questions

Using Jersey/JAX-RS I have a get handler that contains code to copy a large
How do I send GET requests using the Jersey Client API to a server
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I follow tutorial here on how to create web service using RESTful web service
Using Jersey and Jackson to create a REST interface, how do I get List
I have a JAX-RS web service (using jersey) that accepts a JAXB object as
We are developing a restful api using jersey (1.9.1) and tomcat 5.5. A given
I'm trying to debug a rest/json service that i build using Jersey and Amazon
I have a REST- Server here using JERSEY. I must log the IP (better
I am using Jersey 1.4, the ApacheHttpClient , and the Apache MultiThreadedHttpConnectionManager class to

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.