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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:42:57+00:00 2026-06-11T04:42:57+00:00

I am looking into REST and protocol buffers atm. Therefore I found [this][1] tutorial

  • 0

I am looking into REST and protocol buffers atm.
Therefore I found [this][1] tutorial which creates a sample application

Unfortunately Ive got a problem with the libraries to import I cant resolve:

In this line:

return GrizzlyServerFactory.create(uri, initParams);

I am getting a syntax error:

The method create(URI, ResourceConfig) in the type
GrizzlyServerFactory is not applicable for the arguments (URI,
Map<String,String>)

GrizzlyServerFactory is in this library which I have imported:

import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory;

For reference I am pasting the whole class here:

package com.sampullara.jaxrsprotobuf.tutorial;

import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.core.UriBuilder;

import com.sun.grizzly.http.SelectorThread;
import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory;
import com.sun.jersey.api.core.ResourceConfig;

public class Main {
    public static final URI BASE_URI = UriBuilder.fromUri("http://localhost/").port(9998).build();

    public static void main(String[] args) throws IOException {
        System.out.println("Starting grizzly...");
        URI uri = BASE_URI;
        SelectorThread threadSelector = createServer(uri);
        System.out.println(String.format("Try out %sperson\nHit enter to stop it...", uri));
        System.in.read();
        threadSelector.stopEndpoint();
    }

    public static SelectorThread createServer(URI uri) throws IOException {
        Map<String, String> initParams = new HashMap<String, String>();
        initParams.put("com.sun.jersey.config.property.packages", "com.sampullara");

        // error happens in next line - constructor doesnt exist with the given parameters
        return GrizzlyServerFactory.create(uri, initParams);
    }
}

EDIT1:

Ive modified the code but still cant get it working:

public static SelectorThread createServer(URI uri) throws IOException {
    //Map<String, String> initParams = new HashMap<String, String>();
    //initParams.put("com.sun.jersey.config.property.packages", "com.sampullara");
    // original code: return GrizzlyServerFactory.create(uri, initParams);

    DefaultResourceConfig rscfg = new DefaultResourceConfig();
    return GrizzlyServerFactory.create( uri , rscfg );
}

Eclipse throws the following runtime error at me:

SCHWERWIEGEND: The ResourceConfig instance does not contain any root
resource classes. Exception in thread “main”
com.sun.jersey.api.container.ContainerException: The ResourceConfig
instance does not contain any root resource classes. at
com.sun.jersey.server.impl.application.RootResourceUriRules.(RootResourceUriRules.java:99)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1300)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:163)
at
com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:769)
at
com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:765)
at
com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765)
at
com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:172)
at
com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:134)
at
com.sun.jersey.api.container.grizzly.GrizzlyServerFactory.create(GrizzlyServerFactory.java:151)
at
com.sampullara.jaxrsprotobuf.tutorial.Main.createServer(Main.java:34)
at com.sampullara.jaxrsprotobuf.tutorial.Main.main(Main.java:21)

  • 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-11T04:42:59+00:00Added an answer on June 11, 2026 at 4:42 am

    GrizzlyServerFactory.create takes two parameter:

    1. java.net.URI
    2. com.sun.jersey.api.core.ResourceConfig

    Using Map<String, String> as the second parameter is wrong.

    See Publishing Jersey service instance to Grizzly for another question dealing with GrizzlyServerFactory.

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

Sidebar

Related Questions

I've been looking into which javascript frameworks to use lately and have seen REST
I'm looking into using this library for our Java-application: http://code.google.com/p/aparapi/ . One requirement for
Looking into org.pentaho.reporting.engine.classic.core.DataFactory and more specifically into the initialize method (which was formerly part
Looking into selector performance between $('#ID1, #ID2, #ID3') vs $('1X CLASS'). Which is faster?
By looking into the Open JPA website i've found that i can log the
Am looking into developing an iPhone native app using Titanium Developer Since this is
I'm looking into changing the ASP.NET session state mode of our application from SQLServer
I am looking into using WCF for a project which would require the ability
I've been looking into building a REST api using the Azure SDK for node
I'm looking into building an ASP.NET MVC application that exposes (other than the usual

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.