Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-1751

Can't resole ejb injection in interceptor class

XMLWordPrintable

    • Workaround Exists
    • Hide

      1) use mappedName attribute instead of beanName
      OR
      2) rename the jar file (alphabetical ordering), containing the EJB, such that it is deployed before the interceptor jar

      Show
      1) use mappedName attribute instead of beanName OR 2) rename the jar file (alphabetical ordering), containing the EJB, such that it is deployed before the interceptor jar

      problem deploying ear with interceptors classes:

      Code:

      ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to
      Real: name=vfszip:/product/mnfc/jboss/jboss-5.0.0.GA/server/default/deploy/testInterceptor_EAR.ear
      state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying testInterceptor.jar: null
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:203)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:104)
      at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeplo
      yer.java:45)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:5
      0)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157
      )
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210
      )
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:34
      8)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadP
      oolExecutor.java:65)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThread
      PoolExecutor.java:142)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExec
      utor.java:166)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
      at org.jboss.ejb3.javaee.JavaEEComponentHelper.createObjectName(JavaEEComponentHelper.java:46)
      at org.jboss.ejb3.deployers.JBoss5DeploymentScope.getEjbContainer(JBoss5DeploymentScope.java:170)
      at org.jboss.ejb3.Ejb3Deployment.getEjbContainer(Ejb3Deployment.java:407)
      at org.jboss.ejb3.EJBContainer.resolveEjbContainer(EJBContainer.java:1408)
      at org.jboss.injection.AbstractHandler.addDependency(AbstractHandler.java:50)
      at org.jboss.injection.EJBRemoteHandler.ejbRefDependency(EJBRemoteHandler.java:146)
      at org.jboss.injection.EJBRemoteHandler.handleFieldAnnotations(EJBRemoteHandler.java:393)
      at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:160)
      at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:197)
      at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:605)
      at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:415)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:523)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
      ... 28 more

      This problem occurs when injects a local ejb in interceptor class :

      Code:

      public class testInterceptor {

      private static final Logger log = Logger.getLogger("TEST_INTERCEPTOR");

      @EJB(name="ejb/testSessionLocal", beanInterface=testSessionLocal.class)
      private testSessionLocal test;

      @AroundInvoke()
      public Object showMessage(InvocationContext ctx) throws Exception {

      log.debug("Persist entity from testSessionBeanLocal...");

      for (Object o :ctx.getParameters()){

      log.debug("Interceptor parameter : "+ o);
      if (o instanceof String)

      { test.persist(o.toString()); }

      }
      Object o = null;
      o=ctx.proceed();
      return o;

      }

      the method intercepted by this class is as follows:
      Code:

      @Remote(testSessionRemote.class)
      @Stateless(name="testSessionRemote", mappedName="testSessionBeanRemote")
      public class testSessionBeanRemote implements testSessionRemote {

      private static final Logger log = Logger.getLogger("TEST_INTERCEPTOR");

      @Interceptors(testInterceptor.class)
      public void persist(String cmdParam)

      { log.info("Persist entity from testSessionBeanRemote..."); }

      }

        1. connectadministration-ejb.jar
          198 kB
        2. japase.zip
          61 kB
        3. server.zip
          1.28 MB
        4. testInterceptor_EAR.ear
          14 kB

              jaikiran Jaikiran Pai (Inactive)
              nouredine13_jira John smith (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: