JaxRS injection broken at REL_2.3-20141028230028+0000, works at REL_2.3-20141027230029+0000

When upgrading between these two gradle versions JAX RS injections break (in a junit test case) with the following stack trace:

org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=RoleRepository,parent=RolesResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,2015348878)

at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)

at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:965)

at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:899)

at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:974)

at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:965)

at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:170)

at org.glassfish.jersey.server.internal.JerseyResourceContext.getResource(JerseyResourceContext.java:102)

at no.nrk.dra.infrastructure.adapters.rest.api.ApiResource.roles(ApiResource.java:62)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter$2.run(SubResourceLocatorRouter.java:228)

at org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.getResource(SubResourceLocatorRouter.java:247)

at org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.apply(SubResourceLocatorRouter.java:129)

at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)

at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:116)

at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:116)

at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:116)

at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:116)

at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:94)

at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:63)

at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)

at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:263)

at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

at org.glassfish.jersey.internal.Errors.process(Errors.java:267)

at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)

at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)

at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1030)

at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:377)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)

at org.glassfish.grizzly.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:147)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.glassfish.grizzly.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:137)

at org.glassfish.grizzly.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:106)

at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:221)

at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:169)

at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:219)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)

at java.lang.Thread.run(Thread.java:745)

I had a look at the changes between these two nightly builds and I have absolutely no clue as to why any of the changes should cause this breakage. It does seem quite severe :slight_smile:

It’s going to be very to track down without a way to reproduce.

Any chance you could provide a sample project that we could use?

It turned out spring dependency injection was not working inside jaxrs because jersey relies on the “jersey-spring3” module being on the classpath.

“Someone” had included this module with the following syntax:

compile (project.libraries.jersey_spring3) {

exclude module: ‘*’

}

With the version upgrade, this notation has the effect of removing the entire dependency from the classpath; earlier it would have the same effect as transitive=false.

I am not really sure if the exclude module: ‘*’ syntax is supposed to work or is just some kind of mishap in our build. Looking at the official docs I don’t even see this syntax anywhere. I’m sure you guys know if this is basically user error or something that needs to be fixed/documented.

Kristian