7 Replies Latest reply on Apr 4, 2012 2:06 AM by Sham Phadtale

    spi.NotBoundException

    Remi Ledzinski Newbie

      Hi all,

      first - sorry for mu English.

      I have following problem. I create the EJB3 bean DbCleanerBean which I want to be executed when JBoss (v5.0) starts. So I create the MBean AutostartService that is looking for the DbCleanerBean in JNDI and executing the method after start.

      In 98% it works fine but sometime I got such exception:

      ERROR [AbstractKernelController] Error installing to Start: name=jboss:service=AutostartService state=Create mode=Manual requiredState=Installed
      org.jboss.ejb3.common.registrar.spi.NotBoundException: Object is bound at key jboss.j2ee:ear=myear.ear,jar=myjar.jar,name=DbCleanerBean,service=EJB3, but is not fully installed, instead of state: ControllerState@180b4f9{Start}
      at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:169)
      at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:133)
      at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.getContainerLocally

      XML:

      <mbean code="com.myservice.mbeans.AutostartService"
       name="jboss:service=AutostartService">
       <depends>jboss.j2ee:ear=myear.ear,jar=myjar-ejb.jar,name=DbCleanerBean,service=EJB3</depends>
       </mbean>
      


      AutostartService.java
      public class AutostartService implements AutostartServiceMBean {
      
       protected Logger log = Logger.getLogger(getClass());
      
       @Override
       public void start() throws Exception {
       log.info("AutostartService started");
       DbCleanerBusinessLocal bean = (DbCleanerBusinessLocal)new InitialContext().lookup("DbCleanerBean");
       if (bean == null) {
       log.error("Cannot find bean DbCleanerBean in JNDI. Autostartfailed!");
       }
      
       bean.startup();
      
       log.info("AutostartService finished");
       }
      ...
      }
      


      As I said - it works in 98% but sometimes I got the NotBoundException.
      Why such problem occur? From second hand - how to handle this exception. I try to run this in the loop 3 times (each try after 10 seconds). So the loop execute following code:

      DbCleanerBusinessLocal bean = (DbCleanerBusinessLocal)new InitialContext().lookup("DbCleanerBean");
       if (bean == null) {
       log.error("Cannot find bean DbCleanerBean in JNDI. Autostartfailed!");
       }
      
       bean.startup();
      
      


      this doesn't help. How should I handle this exception correctly?

      Thanks in advance.

        • 1. Re: spi.NotBoundException
          fatbatman Novice

          I'm getting a similar error when calling try to access a bean from a service even though I see messages in the log telling me the bean has been installed.

          Can anyone help?

          • 2. Re: spi.NotBoundException
            jaikiran pai Master

            More details please - the java version, the JBoss AS version, the stacktrace, the console logs and more about your application. Also mention the exact issue you are running into.

            • 3. Re: spi.NotBoundException
              Remi Ledzinski Newbie

              Java: jdk1.6.0_04
              JBoss: 5.0.0.GA
              More stack (console)

              10:39:43,412 ERROR [AbstractKernelController] Error installing to Start: name=jboss:service=AutostartService state=Create mode=Manual requiredState=Installed
              
              org.jboss.ejb3.common.registrar.spi.NotBoundException: Object is bound at key jboss.j2ee:ear=myear.ear,jar=myjar.jar,name=DbCleanerBean,service=EJB3, but is not fully installed, instead of state: ControllerState@180b4f9{Start}
              
               at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:169)
              
               at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.lookup(Ejb3McRegistrar.java:133)
              
               at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.getContainerLocally(ProxyInvocationHandlerBase.java:211)
              
               at org.jboss.ejb3.proxy.handler.session.stateless.StatelessLocalProxyInvocationHandler.getContainer(StatelessLocalProxyInvocationHandler.java:74)
              
               at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:247)
              
               at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
              
               at $Proxy1766.startup(Unknown Source)
              
               at com.myejb.ejb.mbeans.AutostartService.start(AutostartService.java:38)
              
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              
               at java.lang.reflect.Method.invoke(Method.java:597)
              
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
              
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
              
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
              
               at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
              
               at $Proxy36.start(Unknown Source)
              
               at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
              
               at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
              
               at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
              
               at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
              
               at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
              
               at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
              
               at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
              
               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.system.ServiceController.doChange(ServiceController.java:688)
              
               at org.jboss.system.ServiceController.start(ServiceController.java:460)
              
               at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:146)
              
               at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:104)
              
               at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:45)
              
               at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
              
               at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
              
               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:1178)
              
               at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
              
               at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
              
               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:441)
              
               at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
              
               at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
              
               at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
              
               at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
              
               at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
              
               at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
              
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
              
               at java.lang.Thread.run(Thread.java:619)
              
              10:39:43,459 INFO [TomcatDeployment] deploy, ctxPath=/TriggerCallback, vfsUrl=myear.ear/mywar.war
              
              10:39:43,569 WARN [HDScanner] Failed to process changes
              
              org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
              
              
              
              *** CONTEXTS IN ERROR: Name -> Error
              
              


              Exception is thrown from line: bean.startup(); in AutostartService.java

              The issue: I got this exception sometimes (as I wrote almost always the code is running fine).
              Question: how to handle this or what should be changed to fix that?

              • 4. Re: spi.NotBoundException
                kwesy Newbie

                Hi, all
                I have the same problem too. I try to retrieve a SessionBean from a service (SAR) at startup time.

                From a Web Controller

                InitialContext ctx = new InitialContext();
                 GroupManagerLocal groupEJB = (GroupManagerLocal) ctx.lookup(GroupManagerLocal.JNDI_NAME);


                jboss-service.xml
                <depends>jboss.j2ee:jar=Middleware.jar,name=UserManagerBean,service=EJB3</depends>
                <depends>jboss.j2ee:jar=Middleware.jar,name=GroupManagerBean,service=EJB3</depends>
                

                STACK TRACE

                17:24:37,274 ERROR [AbstractKernelController] Error installing to Start: name=mib:service=MibScheduleService state=Create mode=Manual requiredState=In
                stalled
                org.jboss.ejb3.common.registrar.spi.NotBoundException: Object is bound at key jboss.j2ee:jar=Middleware.jar,name=GroupManagerBean,service=EJB3, but is
                 not fully installed, instead of state: ControllerState@d8bf42{Start}


                • 5. Re: spi.NotBoundException
                  kwesy Newbie

                  I think that EJB3 is not in INSTALLED state but I don't understand why?

                  • 6. Re: spi.NotBoundException
                    kwesy Newbie

                    I find solution using the following in the conf/boostrap/deployers.xml

                    <bean name="topContextComparator">
                     <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
                     <property name="suffixOrder" class="java.util.Map">
                     <map keyClass="java.lang.String" valueClass="java.lang.Integer">
                     <entry>
                     <key>.sar</key>
                     <value>700</value>
                     </entry>
                     </map>
                     </property>
                     </bean>



                    • 7. Re: spi.NotBoundException
                      Sham Phadtale Newbie

                      Hi, I am facing same problem. please can anyone tell me how the above solution works? What are these parameter? Will it break anything else.