Integration testing

195 views
Skip to first unread message

Fredrik Hedberg

unread,
Feb 16, 2013, 6:34:24 AM2/16/13
to dropwiz...@googlegroups.com
Hi,

First of all, thanks for a great product - we're extremely happy with Dropwizard so far. However, when we're running integration tests using ResourceTest we stumbled on this error:

SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.IllegalStateException
at com.sun.jersey.server.impl.ThreadLocalHttpContext.getProperties(ThreadLocalHttpContext.java:98)
at com.sun.jersey.api.container.filter.LoggingFilter.setId(LoggingFilter.java:141)
at com.sun.jersey.api.container.filter.LoggingFilter.filter(LoggingFilter.java:255)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1432)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
at com.sun.jersey.test.framework.impl.container.inmemory.TestResourceClientHandler.handle(TestResourceClientHandler.java:119)
at com.sun.jersey.api.client.Client.handle(Client.java:648)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:692)
at com.sun.jersey.api.client.WebResource.access$300(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.method(WebResource.java:626)

Any ideas?

Thanks,

Fredrik

Carlo Barbara

unread,
Feb 16, 2013, 3:11:12 PM2/16/13
to dropwiz...@googlegroups.com
Sounds like a runtime exception in your code. To figure out whats happening, register an exception mapper via provider interface to handle runtime exceptions, then put a break point. 
--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Fredrik Hedberg

unread,
Feb 16, 2013, 5:44:30 PM2/16/13
to dropwiz...@googlegroups.com
Are you sure? From what I gather the Jersey/DW runtime seems to not bind the @HttpContext thing for the current thread?

Carlo Barbara

unread,
Feb 16, 2013, 8:40:21 PM2/16/13
to dropwiz...@googlegroups.com
You're right. I didn't look at the code at first, just the stack trace. Looking at the code, you're right that the context appears to be null. Is the context being set in WebApplicationImpl.handleRequest()? If so, then maybe the loggingfilter is running under a different thread and losing the context. If it's not being set in  WebApplicationImpl.handleRequest(), then that's something to dig into it. 

Sorry if I'm stating the obvious, I'm shooting in the dark and just trying to helpful. 
Reply all
Reply to author
Forward
0 new messages