4 Replies Latest reply on Oct 16, 2008 6:11 AM by jaikiran pai

    @Depends and ObjectName key-value pair ordering

    jaikiran pai Master

      System details - JBoss-5 CR2, Sun Java 1.5, Windows 2003 Server OS

      I have a @Service with a @Depends annotation as follows:

      @Service (objectName = "vieo.ccs:service=Migration")
      @Management(MyService.class)
      @Depends({"jboss.jca:service=DataSourceBinding,name=DefaultDS"})
      public class MyServiceImpl implements MyService {
      .....
      }


      Nothing fancy with the implementation. When deployed on JBoss-5 CR2 this fails to deploy with a dependency error:

      11:56:16,383 INFO [JBossASKernel] Created KernelDeployment for: myapp_ejb3.jar
      11:56:16,399 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=ServiceTest.ear,jar=myapp_ejb3.jar,name=MyServiceImpl,service=EJB3
      11:56:16,399 INFO [JBossASKernel] with dependencies:
      11:56:16,399 INFO [JBossASKernel] and demands:
      11:56:16,399 INFO [JBossASKernel] jboss.jca:service=DataSourceBinding,name=DefaultDS
      11:56:16,399 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      11:56:16,399 INFO [JBossASKernel] and supplies:
      11:56:16,399 INFO [JBossASKernel] jndi:ServiceTest/MyServiceImpl/local
      11:56:16,399 INFO [JBossASKernel] jndi:ServiceTest/MyServiceImpl/local-org.myapp.service.MyService
      11:56:16,399 INFO [JBossASKernel] Class:org.myapp.service.MyService
      11:56:16,399 INFO [JBossASKernel] jndi:ServiceTest/MyServiceImpl/remote
      11:56:16,399 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=ServiceTest.ear,jar=myapp_ejb3.jar,name=MyServiceImpl,service=EJB3) to KernelDeployment of: myapp_ejb3.jar
      11:56:16,727 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
      
      jboss.j2ee:ear=ServiceTest.ear,jar=myapp_ejb3.jar,name=MyServiceImpl,service=EJB3
       -> <UNKNOWN jboss.j2ee:ear=ServiceTest.ear,jar=myapp_ejb3.jar,name=MyServiceImpl,service=EJB3>{Described:** UNRESOLVED Demands 'jboss.jca:service=DataSourceBinding,name=DefaultDS' **}
      
      
      *** CONTEXTS IN ERROR: Name -> Error
      
      <UNKNOWN jboss.j2ee:ear=ServiceTest.ear,jar=myapp_ejb3.jar,name=MyServiceImpl,service=EJB3> -> ** UNRESOLVED Demands 'jboss.jca:service=DataSourceBinding,name=DefaultDS' **
      


      Note that the DefaultDS datasource binding has already been deployed. The jmx-console confirms this, under jboss.jca

      name=DefaultDS,service=DataSourceBinding


      If you notice closely, my @Depends annotation has a different order of key-value pairs (which as far as i know is valid for ObjectName) :

      @Depends({"jboss.jca:service=DataSourceBinding,name=DefaultDS"})


      I then change my Service to change the key-value pair ordering to match what is seen in the jmx-console:

      @Depends({"jboss.jca:name=DefaultDS,service=DataSourceBinding"})


      and this deploys fine.

      Isn't the ObjectName key/value pair supposed to be unordered? I tried to lookup the code responsible for this dependency management in the Microcontainer, but unfortunately this section of the documentation is still under construction. So i don't have much clue which piece of code is responsible for this.

      P.S: I thought of posting this in the EJB3 forum but since this looks like a generic issue, i decided to post here. Let me know if this is not the right place.