8 Replies Latest reply on Aug 3, 2009 2:51 PM by howard goldberg

    ignored dependency

    howard goldberg Newbie

      boss 5.1 ga
      Setting a dependency in my service on an MBean to avoid a race condition.
      Setting dependency in my service as follows:

      . . .
      import org.jboss.beans.metadata.api.annotations.Depends;
      import org.jboss.ejb3.annotation.Service;
      
      /**
       * Service implementation class ResILogMgr
       */
      @Service
      @Depends("jboss.j2ee:ear=jrules-res-management-JBOSS5.ear;jar=res-model-mbean-7.0.0 jar;name=IlrJMXRepository;service=EJB3")
      public class ResILogMgr implements ILogMgrRemote, ILogMgrLocal {
      . . .
      
       public void create() throws Exception {
      . . .
      
      


      In the stack trace, no dependency is listed as the service is being processed, and the create method causes an error as it is not waiting for the first service to start. Works fine when the server is warm as the MBean has already been registered. Am I missing something, or is there a bug.

      Howard

      13:34:23,125 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=IMgrEar.ear,jar=ResILog70Mgr.jar,name=ResILogMgr,service=EJB3
      13:34:23,125 INFO [JBossASKernel] with dependencies:
      13:34:23,126 INFO [JBossASKernel] and demands:
      13:34:23,126 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      13:34:23,126 INFO [JBossASKernel] and supplies:
      13:34:23,126 INFO [JBossASKernel] jndi:IMgrEar/ResILogMgr/remote
      13:34:23,127 INFO [JBossASKernel] jndi:IMgrEar/ResILogMgr/local
      13:34:23,127 INFO [JBossASKernel] Class:org.goldberg.ilog.mgmt.ILogMgrRemote
      13:34:23,127 INFO [JBossASKernel] jndi:IMgrEar/ResILogMgr/remote-org.goldberg.ilog.mgmt.ILogMgrRemote
      13:34:23,127 INFO [JBossASKernel] jndi:IMgrEar/ResILogMgr/local-org.goldberg.ilog.mgmt.ILogMgrLocal
      13:34:23,128 INFO [JBossASKernel] Class:org.goldberg.ilog.mgmt.ILogMgrLocal
      13:34:23,128 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=IMgrEar.ear,jar=ResILog70Mgr.jar,name=ResILogMgr,service=EJB3) to KernelDeployment of: ResILog70Mgr.jar
      13:34:23,311 INFO [JBossClient] Server connected
      13:34:23,314 INFO [STDOUT] Starting IlogMgr create function
      13:34:23,314 INFO [STDOUT] jmxremote.JBossClient@1a8d53
      13:34:23,339 ERROR [STDERR] java.lang.reflect.UndeclaredThrowableException
      13:34:23,340 ERROR [STDERR] at $Proxy131.getRuleAppObjectNames(Unknown Source)
      13:34:23,340 ERROR [STDERR] at org.goldberg.ilog.mgmt.ResILogMgr.create(ResILogMgr.java:47)
      13:34:23,341 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:34:23,341 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      13:34:23,341 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:34:23,342 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      13:34:23,342 ERROR [STDERR] at org.jboss.ejb3.service.ServiceContainer.invokeOptionalMethod(ServiceContainer.java:369)
      13:34:23,342 ERROR [STDERR] at org.jboss.ejb3.service.ServiceContainer.create(ServiceContainer.java:206)
      13:34:23,342 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:34:23,343 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      13:34:23,343 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:34:23,343 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      13:34:23,343 ERROR [STDERR] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
      13:34:23,343 ERROR [STDERR] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
      13:34:23,344 ERROR [STDERR] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
      13:34:23,344 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
      13:34:23,344 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
      13:34:23,344 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
      13:34:23,345 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
      13:34:23,345 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
      13:34:23,345 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
      13:34:23,345 ERROR [STDERR] at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
      13:34:23,346 ERROR [STDERR] at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      13:34:23,346 ERROR [STDERR] at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      13:34:23,346 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      13:34:23,346 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      13:34:23,347 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
      13:34:23,347 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      13:34:23,347 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
      13:34:23,348 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      13:34:23,348 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
      13:34:23,348 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
      13:34:23,348 ERROR [STDERR] at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
      13:34:23,348 ERROR [STDERR] at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
      13:34:23,349 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
      13:34:23,349 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      13:34:23,349 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      13:34:23,349 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
      13:34:23,350 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
      13:34:23,350 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
      13:34:23,350 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
      13:34:23,350 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
      13:34:23,351 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      13:34:23,351 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
      13:34:23,351 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      13:34:23,351 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
      13:34:23,352 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      13:34:23,352 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      13:34:23,352 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      13:34:23,352 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
      13:34:23,353 ERROR [STDERR] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
      13:34:23,353 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
      13:34:23,353 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
      13:34:23,353 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
      13:34:23,354 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
      13:34:23,354 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      13:34:23,354 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
      13:34:23,354 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      13:34:23,355 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
      13:34:23,356 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      13:34:23,356 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      13:34:23,356 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      13:34:23,357 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
      13:34:23,357 ERROR [STDERR] at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
      13:34:23,357 ERROR [STDERR] at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
      13:34:23,357 ERROR [STDERR] at org.jboss.Main.boot(Main.java:221)
      13:34:23,358 ERROR [STDERR] at org.jboss.Main$1.run(Main.java:556)
      13:34:23,358 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
      13:34:23,358 ERROR [STDERR] Caused by: javax.management.InstanceNotFoundException: RES:type=IlrJMXRepository is not registered.
      13:34:23,359 ERROR [STDERR] at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:526)
      13:34:23,359 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:559)
      13:34:23,359 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:34:23,359 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      13:34:23,360 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:34:23,360 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      13:34:23,360 ERROR [STDERR] at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:263)
      13:34:23,360 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:34:23,361 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      13:34:23,361 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:34:23,361 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      13:34:23,370 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      13:34:23,370 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      13:34:23,371 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
      13:34:23,371 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
      13:34:23,371 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
      13:34:23,371 ERROR [STDERR] at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
      13:34:23,372 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
      13:34:23,372 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      13:34:23,372 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      13:34:23,373 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:180)
      13:34:23,373 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      13:34:23,373 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      13:34:23,373 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:34:23,374 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      13:34:23,374 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      13:34:23,374 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      13:34:23,374 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      13:34:23,375 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      13:34:23,375 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      13:34:23,375 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
      13:34:23,375 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
      13:34:23,376 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
      13:34:23,376 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
      13:34:23,376 ERROR [STDERR] at org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:66)
      13:34:23,376 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
      13:34:23,377 ERROR [STDERR] at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
      13:34:23,377 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
      13:34:23,377 ERROR [STDERR] at $Proxy130.getAttribute(Unknown Source)
      13:34:23,378 ERROR [STDERR] at jmxremote.JBossClient$JBossHandler.getAttribute(JBossClient.java:45)
      13:34:23,378 ERROR [STDERR] at jmxremote.CommonHandler.invoke(CommonHandler.java:81)
      13:34:23,378 ERROR [STDERR] ... 68 more
      13:34:23,379 INFO [EJBContainer] STARTED EJB: org.goldberg.ilog.mgmt.ResILogMgr ejbName: ResILogMgr

        • 1. Re: ignored dependency
          jaikiran pai Master

           

          import org.jboss.beans.metadata.api.annotations.Depends;
          


          Wrong import. Should be:

          import org.jboss.ejb3.annotation.Depends;


          • 2. Re: ignored dependency
            howard goldberg Newbie

            Thanks for the pickup. Using JBOSS tools plugins--that was the autofill import--I'll post a bug report.

            I'm trying to find the dependent MBean. From the stack trace, "RES:type=IlrJMXRepository" is what gets registered in the MBeanServer. Do I set the dependency on this, scanning the JMX-Console, I don't seem to find another entity to set as the dependency.

            Howard

            • 3. Re: ignored dependency
              jaikiran pai Master

               

              "goldberg.howard" wrote:

              I'm trying to find the dependent MBean. From the stack trace, "RES:type=IlrJMXRepository" is what gets registered in the MBeanServer. Do I set the dependency on this


              Yes, that would be the right dependency.

              • 4. Re: ignored dependency
                howard goldberg Newbie

                Hmm--still fails

                DEPLOYMENTS IN ERROR:
                Deployment "<UNKNOWN jboss.j2ee:ear=IMgrEar.ear,jar=ResILog70Mgr.jar,name=ResILogMgr,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'RES:type=IlrJMXRepository' **

                I can successfully retrieve the MBean entry from the MBean registry using the get method through the JMX-console using this objectname.

                General question is whether any MBean can participate in dependency relationships, or only certain MBeans, do they have to implement a particular interface to be valid service dependencies.

                • 5. Re: ignored dependency
                  jaikiran pai Master

                  Post your entire console logs (not server.log) and even the updated code. Who registers the RES:type=IlrJMXRepository service?

                  While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

                  • 6. Re: ignored dependency
                    howard goldberg Newbie

                    It's a vendor-based JMXBean--turns out, it doesn't implement the JBOSS-specific interfaces to support dependency management. Either I need a JBOSS-specific implementation, or may be remedied with EJB3.1 / @DependsOn as a vendor-neutral standard, although I don't have enough familiarity to know if most app servers support exposing EJB's as JMXBeans.

                    Thanks,
                    Howard

                    • 7. Re: ignored dependency
                      jaikiran pai Master

                      I might be missing something, but doesn't that vendor specific JMX Bean ultimately get registered in the JBoss MBean server with a specific MBean ObjectName? If it does, then specifying that ObjectName in the @Depends should work.

                      • 8. Re: ignored dependency
                        howard goldberg Newbie

                        The vendor specific JMX Bean doesn't implement or extend org.jboss.system.Service or implement any of the necessary lifecycle methods (per the vendor). Using the ObjectName as indicated below in the @Depends did not work. From the JBOSS documentation, it seems that there are some minimal requirements for MBeans to support the dependency framework. Is that not the case?