jersey
  1. jersey
  2. JERSEY-1747

@Inject seems not working correctly inside resources

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m12
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      promoted Glassfish b77

      Description

      I've simply added beans.xml to my application and declared a bean ( dependent scoped ) then tried to inject it inside my resource using @Inject after that I've got the following exception:

      org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=Faissal,parent=TaskCtrl,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,741639802)
      	at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
      	at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:174)
      	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:197)
      	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:294)
      	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:433)
      	at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:157)
      	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2099)
      	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:570)
      	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:557)
      	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:193)
      	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)
      	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:105)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:102)
      	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:62)
      	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
      	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:198)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:183)
      	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:852)
      	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:321)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
      	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:342)
      	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 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:176)
      	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:188)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:273)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:820)
      	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)
      

        Activity

        Hide
        Marek Potociar added a comment -

        Updated priority, added "release-stopper" tag.

        Show
        Marek Potociar added a comment - Updated priority, added "release-stopper" tag.
        Hide
        Marek Potociar added a comment -

        Jakub, please have a look.

        Show
        Marek Potociar added a comment - Jakub, please have a look.
        Hide
        b_faissal added a comment -

        The injection is working correctly on other servlets on the same project

        Show
        b_faissal added a comment - The injection is working correctly on other servlets on the same project

          People

          • Assignee:
            Jakub Podlesak
            Reporter:
            b_faissal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: