glassfish
  1. glassfish
  2. GLASSFISH-20534

@Inject not working within JAX-RS @Provider

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0.1
    • Component/s: embedded
    • Labels:
      None
    • Environment:

      Glassfish embedded 4.0

      Description

      Using https://maven.java.net/content/groups/promoted/org/glassfish/main/extras/glassfish-embedded-all/4.0/
      Injection of stateless EJB into JAX-RS @Provider fails, same EJB injected into regular servlet works fine within the same app.

      @Stateless
      public class AuthService {}

      @Provider
      public class HmacAuthFilter implements ContainerRequestFilter, ContainerResponseFilter {
      @Inject
      private AuthService authService;
      ...
      }

      monospaced
      MultiException stack 1 of 3
      org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=AuthService,parent=HmacAuthFilter,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,1462515663)
      at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
      at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:191)
      at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:214)
      at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
      at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
      at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
      at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
      at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
      at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
      at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
      at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
      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.processWithException(Errors.java:286)
      at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
      at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      MultiException stack 2 of 3
      java.lang.IllegalArgumentException: While attempting to resolve the dependencies of io.scrub.http.HmacAuthFilter errors were found
      at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:226)
      at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
      at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
      at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
      at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
      at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
      at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
      at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
      at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
      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.processWithException(Errors.java:286)
      at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
      at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      MultiException stack 3 of 3
      java.lang.IllegalStateException: Unable to perform operation: resolve on io.scrub.http.HmacAuthFilter
      at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:340)
      at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
      at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
      at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
      at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
      at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
      at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
      at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
      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.processWithException(Errors.java:286)
      at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
      at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      monospaced

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            buddypine
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: