1 Reply Latest reply on Apr 29, 2003 11:55 AM by Tim McCune

    getEJBLocalObject returns null (JBoss 3.2.0)

    Tim McCune Novice

      I've written a custom interceptor that I use with certain entity beans. It is configured as the last interceptor in the chain. I'm seeing some unexpected behavior. Calling getEnterpriseContext() on the invocation always returns a non-null EntityEnterpriseContext to me. However, sometimes, the call to getEJBLocalObject() on this context returns null. Other times, it returns the expected local object. The behavior isn't random, but it does seem to happen about half of the time that I make calls on my entity bean. I haven't yet dug deep enough to find out what the difference is. I am hoping maybe someone can jump in with a quick suggestion before I get in too deep. Thanks for any help.

      --Tim

        • 1. Re: getEJBLocalObject returns null (JBoss 3.2.0)
          Tim McCune Novice

          I have a workaround for the problem. I basically just duplicated the code that should be setting this. Still don't know why it's not hooked up when it gets to me though. Seems like a bug.

          EntityEnterpriseContext context = (EntityEnterpriseContext)
          _invocation.getEnterpriseContext();
          EJBLocalObject rtn = context.getEJBLocalObject();
          if (rtn == null) {
          //This should never happen as far as I can tell, but it does.
          //We can still get at the local object; we just have
          //to dig around a little.
          EntityContainer container = (EntityContainer) _container;
          rtn = container.getLocalProxyFactory().getEntityEJBLocalObject(
          context.getCacheKey());
          }
          return rtn;