Seemingly related issue:
http://stackoverflow.com/questions/969693/compatibility-issue-of-asm-3-1-and-hibernate-and-jax-rs
http://opensource.atlassian.com/projects/hibernate/browse/EJB-358
But I still don't perceive an obvious conflict.
Yet the problem reeks of a bytecode manipulation conflict of some sort.
On Sat, Feb 19, 2011 at 6:17 PM, Mark Petrovic <mspetrovic_at_gmail.com> wrote:
> Here is a list of jars that get bundled into the war file:
>
> drwxr-xr-x 22 petrovic staff 748 Feb 19 18:02 .
> drwxr-xr-x 5 petrovic staff 170 Feb 19 18:02 ..
> -rw-r--r-- 1 petrovic staff 443432 Feb 16 08:21 antlr-2.7.6.jar
> -rw-r--r-- 1 petrovic staff 43033 Feb 16 09:46 asm-3.1.jar
> -rw-r--r-- 1 petrovic staff 559366 Feb 16 08:21
> commons-collections-3.1.jar
> -rw-r--r-- 1 petrovic staff 109043 Feb 4 09:02 commons-io-1.4.jar
> -rw-r--r-- 1 petrovic staff 32357 Feb 19 18:02
> datamodel-1.0-SNAPSHOT.jar
> -rw-r--r-- 1 petrovic staff 313898 Feb 4 09:11 dom4j-1.6.1.jar
> -rw-r--r-- 1 petrovic staff 203035 Feb 16 13:57 ehcache-1.6.2.jar
> -rw-r--r-- 1 petrovic staff 50583 Feb 16 08:21
> ejb3-persistence-1.0.2.GA.jar
> -rw-r--r-- 1 petrovic staff 279714 Feb 16 08:21
> hibernate-annotations-3.4.0.GA.jar
> -rw-r--r-- 1 petrovic staff 66993 Feb 16 08:21
> hibernate-commons-annotations-3.1.0.GA.jar
> -rw-r--r-- 1 petrovic staff 2309955 Feb 16 08:21
> hibernate-core-3.3.2.GA.jar
> -rw-r--r-- 1 petrovic staff 614203 Feb 16 18:27
> javassist-3.11.0.GA.jar
> -rw-r--r-- 1 petrovic staff 371174 Feb 19 18:02 jersey-core-1.2.jar
> -rw-r--r-- 1 petrovic staff 970250 Feb 19 18:02 jersey-server-1.2.jar
> -rw-r--r-- 1 petrovic staff 46367 Feb 16 18:27 jsr311-api-1.1.1.jar
> -rw-r--r-- 1 petrovic staff 15071 Feb 16 08:21 jta-1.1.jar
> -rw-r--r-- 1 petrovic staff 785998 Feb 17 11:07
> mysql-connector-java-5.1.15.jar
> -rw-r--r-- 1 petrovic staff 25496 Feb 16 12:06 slf4j-api-1.6.1.jar
> -rw-r--r-- 1 petrovic staff 8890 Feb 16 12:06 slf4j-jdk14-1.6.1.jar
> -rw-r--r-- 1 petrovic staff 109318 Feb 2 07:49 xml-apis-1.0.b2.jar
>
> I've done a bit of reading on this type of problem, and I don't see any
> obvious conflicts. Hibernate is using javassist for byte code operations,
> and afaik, has no interest in asm.jar
>
> Total headscratcher.
>
> On Sat, Feb 19, 2011 at 4:54 PM, Mark Petrovic <mspetrovic_at_gmail.com>wrote:
>
>> I've looked at this for two hours, and I can't see why this simple
>> injection does not work.
>>
>> Any ideas? I'm using Jersey 1.5, under Tomcat 7 (the error happens under
>> Jetty 6, too).
>>
>> If I remove the @Context injection, the GET works fine. I've never seen
>> anything like this in two years of using Jersey. Obviously I'm blanking on
>> something important.
>>
>> The resource class:
>>
>> import javax.servlet.ServletContext;
>> import javax.ws.rs.GET;
>> import javax.ws.rs.Path;
>> import javax.ws.rs.core.Context;
>>
>> @Path("testme")
>> public class TestResource {
>>
>> public TestResource(@Context ServletContext servletContext) { }
>>
>> @GET
>> public String testGet() { return "hello"; }
>> }
>>
>> The service invocation:
>>
>> curl -i http://localhost:8080/server/ds/testme
>>
>> The exception:
>>
>> Feb 19, 2011 4:45:57 PM
>> com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
>> SEVERE: The RuntimeException could not be mapped to a response,
>> re-throwing to the HTTP container
>> com.sun.jersey.api.container.ContainerException: Unable to create resource
>> class com.f.rest.p.TestResource
>> at
>> com.sun.jersey.server.impl.resource.PerRequestFactory$PerRequest._getInstance(PerRequestFactory.java:193)
>> at
>> com.sun.jersey.server.impl.resource.PerRequestFactory$AbstractPerRequest.getInstance(PerRequestFactory.java:144)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:225)
>> at
>> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:69)
>> at
>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
>> at
>> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1347)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1279)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1219)
>> at
>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>> at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>> at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
>> at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
>> at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
>> at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
>> at
>> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> at java.lang.Thread.run(Thread.java:680)
>> Caused by: java.lang.IllegalArgumentException: argument type mismatch
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> at
>> com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:200)
>> at
>> com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:182)
>> at
>> com.sun.jersey.server.impl.resource.PerRequestFactory$PerRequest._getInstance(PerRequestFactory.java:182)
>> ... 29 more
>>
>>
>> --
>> Mark
>>
>
>
>
> --
> Mark
>
--
Mark