Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 4.0_b83
    • Fix Version/s: 4.0
    • Component/s: jax-rs
    • Labels:
      None

      Description

      It seems @Inject fails at random points in my application. This was not the case in a previous build. I get the strange exception below. The injection point is this:

      @Stateless
      @Path("/graph-traversal")
      public class GraphTraversalService {

      @Inject
      private GraphDao dao;

      The object injected is this:

      @ApplicationScoped
      public class GraphDao implements Serializable

      The most bizarre thing about this is that the injection works fine if I switch to @Singleton @Startup. If I were to venture a guess, this is some kind of strange class-loading issue.

      The application here demonstrates the problem: http://java.net/projects/cargotracker/downloads/download/cargotracker.zip.

      These are the steps to reproduce:

      • Build the app via Maven and deploy to GlassFish.
      • Open up a browser: http://localhost:8080/cargo-tracker/.
      • Click on booking and routing.
      • Click on book new Cargo.
      • Specify a sensible origin, destination and arrival date.
      • Click book.
      • Click route this cargo.
      • The page will blow up with the exception below.

      The most frustrating part of this is that it is very unpredictable, so you may have to do this a few times. Please advise.

      SEVERE: EJB5070: Exception creating stateless session bean : [GraphTraversalService]
      WARNING: EJB5184:A system exception occurred during an invocation on EJB GraphTraversalService, method: public java.util.List net.java.pathfinder.api.GraphTraversalService.findShortestPath(java.lang.String,java.lang.String,java.lang.String)
      WARNING: javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:435)
      at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2516)
      at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1906)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
      at $Proxy272.findShortestPath(Unknown Source)
      at net.java.pathfinder.api._EJB31_GeneratedGraphTraversalServiceIntf__Bean_.findShortestPath(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:311)
      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:318)
      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: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:188)
      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)
      Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:700)
      at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:246)
      at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:430)
      ... 56 more
      Caused by: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:514)
      at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:97)
      at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:698)
      ... 58 more
      Caused by: A MultiException has 1 exceptions. They are:
      1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=GraphDao,parent=GraphTraversalService,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,1350404804)
      at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
      at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:771)
      at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:780)
      at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:770)
      at org.glassfish.jersey.gf.ejb.EjbComponentInterceptor.inject(EjbComponentInterceptor.java:69)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:153)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
      at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
      at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:1949)
      at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:507)
      ... 60 more
      Caused by: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=GraphDao,parent=GraphTraversalService,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,1350404804)
      ... 81 more

        Issue Links

          Activity

            People

            • Assignee:
              Jakub Podlesak
              Reporter:
              reza_rahman
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: