2 Replies Latest reply on Jun 25, 2004 9:32 AM by jardia

    Deployment Descriptors & System Properties Subsitution

    jiwils

      System properties substitution is allowed in jboss-service.xml deployment descriptors using ${system property name} syntax. Is this true for all deployment descriptor files (including the ones specified by the various J2EE standards)?

        • 1. Re: Deployment Descriptors & System Properties Subsitution

          Amazingly, it does work in most all the XML files. I wouldn't recommend using it in your web.xml, but you certainly could if you wanted to.

          • 2. Re: Deployment Descriptors & System Properties Subsitution

            Hmmm,

            did you actually test this in any of the standard deployment descriptors (application.xml, ejb-jar.xml, web.xml)?

            I just tried it:

            ejb-jar.xml

             <env-entry>
             <env-entry-name>testEnvEntry</env-entry-name>
             <env-entry-type>java.lang.String</env-entry-type>
             <env-entry-value>${test.replaceme}</env-entry-value>
             </env-entry>
            

            bean
            System.out.println("!!! " + System.getProperty("test.replaceme"));
            try
            {
             InitialContext ic = new InitialContext();
             String test = (String)ic.lookup("java:comp/env/testEnvEntry");
             System.out.println("!!! env entry = " + test);
            }
            catch(NamingException ne)
            {
             ne.printStackTrace();
            }
            

            run.bat
            set JAVA_OPTS=%JAVA_OPTS% -Dtest.replaceme=REPLACED_VALUE
            

            output
            15:36:39,171 INFO [STDOUT] !!! REPLACED_VALUE
            15:36:39,171 INFO [STDOUT] !!! env entry = ${test.replaceme}
            


            The system property is set.
            The reference to it in the deployment descriptor does not work.

            Am i missing something?
            Have others seen it work elswhere?
            JBoss3.2.3

            cheers