0 Replies Latest reply on Nov 9, 2012 2:46 PM by ndipiazza

    JBoss 5.1 - Cannot use varia System properties in JBoss configuration xml files unless varia mbean is specified in jboss-context.xml

    ndipiazza

      We are moving from JBoss 4.3.0.EAP to JBoss 5.1.0.GA EAP.

       

      In JBoss 4.3.0, we deploy an XML mbean with code="org.jboss.varia.property.SystemPropertiesService" to create some system properties:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>
      <server>
      
        <mbean code="org.jboss.varia.property.SystemPropertiesService" 
        name="ndipiazza.config.props:type=Service,name=testSysProp">
          <attribute name="Properties">     
       test.local.jndi.localname=ejb/ExLocEJB
       test.remote.jndi.localname=ejb/ExRemEJB
          </attribute>
        </mbean>
      
      </server>
      
      

       

      We can then use these properties in web applications' JBoss configuration files such as jboss.xml:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC
            "-//JBoss//DTD JBOSS 4.2//EN"
            "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
      <jboss>
       <enterprise-beans>
        <session>
         <ejb-name>ExRemEJB</ejb-name>
         <jndi-name>${test.remote.jndi.localname}</jndi-name>
         <depends>ndipiazza.config.props:type=Service,name=testSysProp</depends>
        </session>
        <session>
         <ejb-name>ExLocEJB</ejb-name>
         <jndi-name>${test.local.jndi.localname}</jndi-name>
         <depends>ndipiazza.config.props:type=Service,name=testSysProp</depends>   
        </session>  
       </enterprise-beans> 
      
      </jboss>
      
      

       

      This was nice, because then we could hot-deploy system properties to the server without having to edit the configuration of the domain.

       

      However, in JBoss 5.1.0.GA, this seems to have stopped working. The jboss.xml will not evaluate these system properties presumably because they are not deployed in time.

       

      Some things:

       

      1) I am aware of this post: https://community.jboss.org/thread/152996 - which correctly says it will work if we specify the mbean for the SystemPropertiesService in jboss-service.xml. But this is NOT an option for us. We need to be able to deploy those system properties dynamically.

       

      2) Note how I tried to use <depends> to make it so the mbean depended on that Service. But it just seems to ignore it.

       

      3) If I wait until the server is fully deployed before deploying the ejb jar file, this works. But I have the requirement that the ejb-jar must load on server startup with everything else. So no delayed deploy trick will work here unfortunately.

       

      Is there some way I can achieve this how we have it working in JBoss 4.3.0?

       

      I have attached some files to help test this:

       

      1) test-testSysProp-service.xml

         Defines the system properties. Copy this in your server/PROFILE/deploy directory to deploy it.

      2) TestEJB.jar

         An EJB jar that will use system properties from test-testSysProp-service.xml. The EJB will only deploy if those properties are able to be resolved. Otherwise, you will get this error:

       

       

      ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:jar=TestEJB.jar,name=ExRemEJB,service=EJB3_IORFactory state=Createorg.omg.CosNaming.NamingContextPackage.InvalidName: IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0
      
      

       

      3) TestEJBProject.zip

         The eclipse EJB project TestEJB