users@grizzly.java.net

grizzly + jersey hangs

From: <koert_at_tresata.com>
Date: Wed, 27 Jun 2012 21:57:12 +0000 (GMT)

i create a simple grizzly webserver that handles my jersey based jax-rs
requests.

the trouble is, as soon as i do anything in my jax-rs annotated methods
that involves logging, or writing to stdout, the webserver never
responds to any requests

using wget, i see "HTTP request sent, awaiting response..", and it will
stay like that forever.
if i remove my logging or printing statements (or if i change the
logging level so that there is no logging) everything works fine.

any suggestions?

this is how i start my webserver:

    private static HttpServer startServer() throws IOException {
        System.out.println("Starting grizzly...");
        final HttpServer server = new HttpServer();
        server.addListener(new NetworkListener("grizzly",
NetworkListener.DEFAULT_NETWORK_HOST, 9998));
        final WebappContext ctx = new WebappContext("main");
        ctx.addServlet("demo", new ServletContainer(new
DemoApplication())).addMapping("/demo");
        ctx.deploy(server);
        server.start();
        return server;
    }


this is a simpel jax-rs annotated method:

    @Path("/items/{name}")
    @GET
    @Produces("application/json")
    public JSONObject get(@Context SecurityContext sec,
@PathParam("name") final String name) throws IOException {
        LOGGER.debug("gettting {}", name);
        return jsonStore.get(name); // throws IOException
    }