4 Replies Latest reply on Dec 6, 2014 1:42 PM by jeisen

    JBAS7 ejb-jar.xml properties placeholder

    osnetwork

      Hello everyone,

       

      I'm trying to migrate a project from JBAS6 to JBAS 7.0.2.

      In my configuration I have an ejb-jar.xml file containing some placeholder values like that:

      <session>

                                    <ejb-name>TestOne</ejb-name>

                                    <ejb-class>org.test.TestOne</ejb-class>

                                    <session-type>Stateless</session-type>

                                    <env-entry>

                                              <env-entry-name>ppone</env-entry-name>

                                              <env-entry-type>java.lang.Long</env-entry-type>

                                              <env-entry-value>${test.ppone}</env-entry-value>

                                    </env-entry>

      </session>

      On JBAS6 I'm using the SystemPropertiesService to load a properties file containing the values, like that:

      <mbean code="org.jboss.varia.property.SystemPropertiesService"
      name="jboss:type=Service,name=SystemProperties">
      <attribute name="URLList">
      ./conf/test.properties
      </attribute>
      </mbean>

      Everything works smoothly and the placeholder values get replaced by the value in the properties file.

       

      In JBAS7 I couldn't find the SystemPropertiesService, but in the Application Console we have the System Properties page where we can configure the properties values which I guess will be available globally. So I have tried to insert these values under the system properties but the values on the ejb-jar.xml doesnt get replaced.

       

      How can I achieve the behaviout of the SystemPropertiesService on JBAS7?

       

      Thanks in advance for help

       

      LM

        • 1. Re: JBAS7 ejb-jar.xml properties placeholder
          sfcoy

          You can add:

           
              <system-properties>
                  <property name="font.files" value=""/>
              </system-properties>
                          

          to your standalone.xml file. If you poke around you may find a way to drag in a properties file too.

          • 2. Re: JBAS7 ejb-jar.xml properties placeholder
            osnetwork

            Well, the problem is not about how to add the properties file, I can add the single properties without using a separate file. The problem is that the placeholder values ${name_of_the_property} in the ejb-jar.xml file does not get replaced with the property value while the deployment is performed.

            • 3. Re: JBAS7 ejb-jar.xml properties placeholder
              sfcoy

              I wondered about that. Property expansion in the ejb-jar.xml file would be a non-portable extension provided in some versions of JBoss (between 5.1 and 6.0 I think).

               

              This feature had worked for sometime in the jboss*.xml deployment descriptors, but NOT the standard deployment descriptors.

               

              That said, it's probably about time that this functionality was formally added to the various JEE specs. It's pretty darn handy.

              • 4. Re: JBAS7 ejb-jar.xml properties placeholder
                jeisen

                It must be enabled in the standalone.xml:

                 

                        <subsystem xmlns="urn:jboss:domain:ee:1.2">

                            <spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>

                            <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>

                            <annotation-property-replacement>true</annotation-property-replacement>

                        </subsystem>

                 

                More information can be found here:

                http://blog.akquinet.de/2012/11/21/property-substitution-of-deployment-descriptor-in-eap6-and-jboss-as7/