Jersey-quickstart-archetype Hello World Example

In this example, we will create a jersey RESTful API web application using jersey-quickstart-webapp maven archetype in eclipse.

Table of Contents

Install remote archetypes in eclipse
Create new maven project using jersey-quickstart-webapp
Generated Files
Run The Application

Install remote archetypes in eclipse

The very first step before creating actual maven quick-start application, is to install quick-start definitions in eclipse. It’s very simple process and I have already covered this information in previous tutorial.

Read More: How to Import Maven Remote Archetype Catalogs in Eclipse

Create new maven project using jersey-quickstart-webapp

Now let’s create new maven project.

Create new maven project
Create new maven project

Select default/other workspace.

Select workspace location
Select workspace location

Select jersey-quickstart-webapp version.

Select jersey quick start version
Select jersey quick start version

Fill artifact Id and Group Id.

Fill Artifact id and Group Id
Fill Artifact id and Group Id

Click ‘OK’ to create this project. Project will be created in workspace.

Generated Files

Let’s look at generated files.

Folder Structure

Default Generated Files
Default Generated Files


<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml file is not required when using Servlet 3.0 container,
     see implementation details -->
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="; version="2.5">
    <servlet-name>Jersey Web Application</servlet-name>
    <servlet-name>Jersey Web Application</servlet-name>


<project xmlns="" xmlns:xsi=""





            <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
            <!-- artifactId>jersey-container-servlet</artifactId -->
        <!-- uncomment this to get JSON support

package com.howtodoinjava.demo;


 * Root resource (exposed at "myresource" path)
public class MyResource {

     * Method handling HTTP GET requests. The returned object will be sent
     * to the client as "text/plain" media type.
     * @return String that will be returned as a text/plain response.
    public String getIt() {
        return "Got it!";

Run the Application

For hello world usage, you don’t need to do anything in this project. Everything is configured. Just deploy the application.

Hit URL : http://localhost:8080/JerseyDemo/webapi/myresource

Application Output
Application Output

Drop me your questions in comments section.

Happy Learning !!

Was this post helpful?

Join 7000+ Awesome Developers

Get the latest updates from industry, awesome resources, blog updates and much more.

* We do not spam !!

5 thoughts on “Jersey-quickstart-archetype Hello World Example”

  1. After deploying to the server tomcat v7 ,I’m seeing 404 error found for class .Any inputs what am i missing here?

  2. When I try to run this app, getting following error:
    SEVERE: StandardWrapper.Throwable
    at org.glassfish.jersey.server.ApplicationHandler.(
    at org.glassfish.jersey.servlet.WebComponent.(
    at org.glassfish.jersey.servlet.ServletContainer.init(
    at org.glassfish.jersey.servlet.ServletContainer.init(
    at javax.servlet.GenericServlet.init(
    at org.apache.catalina.core.StandardWrapper.initServlet(
    at org.apache.catalina.core.StandardWrapper.loadServlet(
    at org.apache.catalina.core.StandardWrapper.load(
    at org.apache.catalina.core.StandardContext.loadOnStartup(
    at org.apache.catalina.core.StandardContext.startInternal(
    at org.apache.catalina.util.LifecycleBase.start(
    at org.apache.catalina.core.ContainerBase$
    at org.apache.catalina.core.ContainerBase$
    at Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$ Source)
    at Source)


Leave a Comment


A blog about Java and related technologies, the best practices, algorithms, and interview questions.