1 Reply Latest reply on Feb 19, 2010 1:24 PM by jaikiran pai

    How to using propertyService to substitute parameter in ejb-jar.xml file

    Louie Liu Newbie

      We have a MDB with some activation parameters needed to be externalized due to the security reason.  We we are running application in JBOSS 4.2, we are using the org.jboss.varia.property.SystemPropertiesService service to define the properties which are used in my ejb mdb configuration file (ejb-jar.xml).

       

      Here is the example:

       

      In my ejb-jar.xml, we define the activation attribute place holder like the following:

       

          <activation-config>
              <activation-config-property>
                  <activation-config-property-name>ConnectionURLs</activation-config-property-name>
                  <activation-config-property-value>${ConnectionURLs}</activation-config-property-value>
              </activation-config-property>
              .....
          </activation-config>

       

      and we define the properties service:

       

           <mbean code="org.jboss.varia.property.SystemPropertiesService"
             name="jboss:type=Service,name=SystemProperties">

              <attribute name="Properties">

                  ConnectionURLs=tcp://server:3507,tcp://server:3508

                  ......
              </attribute>

          </mbean>

       

      It works in JBOSS 4.2, meaning the value defined in properties service get substituted during the server startup.

       

      However, when we upgrade the JBOSS to 5.1, it is not working anymore.  Basically, eventhrough there is properties service available in JBOSS 5.1, but for some reason, if we have parameters defined in ejb-jar.xml, the values defined in the JBOSS 5.1 properties service mbean did not substitute the parameters in ejb-jar.xml and then MDB deploy FAILED.

       

      I would like to get help and pointing me the right directory of how to make it work.

       

      Thanks a lot.

       

      Louie Liu

        • 1. Re: How to using propertyService to substitute parameter in ejb-jar.xml file
          jaikiran pai Master
          Looks like a deployment ordering issue. I think the properties-service.xml is deployed after the parsing of ejb-jar.xml is done. So the system property values aren't set when the ejb-jar.xml is being parsed. You can do this:

          Add the following piece of MBean (it's actually does the same as what the MBean in properties-service.xml does)

          {code:xml}
          <mbean code="org.jboss.varia.property.SystemPropertiesService"
                       name="me:service=MyProperties">
                    <attribute name="Properties">
                        ConnectionURLs=tcp://server:3507,tcp://server:3508
                    </attribute>
                </mbean>
               
          {code}     

          in JBOSS_HOME/server/[servername]/conf/jboss-service.xml instead of setting it through properties-service.xml in the deploy folder. That way, the properties set by this service will always be available before any of his deployments in the deploy folder.