ejb-jar.xml unable to read system properties defined in standalone.xml

1.6k Views Asked by At
     <?xml version="1.0" encoding="UTF-8"?>  
     <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"  
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
                        http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"  
      version="3.0"  
       >  
  <enterprise-beans>  
    <message-driven>  
        <ejb-name>MyMDB</ejb-name>  
        <ejb-class>  
            com.foo.MyMDB  
        </ejb-class>  
        <messaging-type>javax.jms.MessageListener</messaging-type>  
        <transaction-type>Container</transaction-type>  
        <activation-config>  
            <activation-config-property>  
                <activation-config-property-name>  
                    destinationType  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    javax.jms.Queue  
                </activation-config-property-value>  
            </activation-config-property>  
            <activation-config-property>  
                <activation-config-property-name>  
                    destination  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    ${jms.queue.mymdb}  
                </activation-config-property-value>  
            </activation-config-property>  
            <activation-config-property>  
                <activation-config-property-name>  
                    useJNDI  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    false  
                </activation-config-property-value>  
            </activation-config-property>                  
            <activation-config-property>  
                <activation-config-property-name>  
                    channel  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    ${jms.queue.manager.channel}  
                </activation-config-property-value>  
            </activation-config-property>                  
            <activation-config-property>  
                <activation-config-property-name>  
                    hostName  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    ${jms.queue.manager.host}  
                </activation-config-property-value>  
            </activation-config-property>                  
            <activation-config-property>  
                <activation-config-property-name>  
                    queueManager  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    ${jms.queue.manager.name}  
                </activation-config-property-value>  
            </activation-config-property>                  
            <activation-config-property>  
                <activation-config-property-name>  
                    port  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    ${jms.queue.manager.port}  
                </activation-config-property-value>  
            </activation-config-property>                  
            <activation-config-property>  
                <activation-config-property-name>  
                    transportType  
                </activation-config-property-name>  
                <activation-config-property-value>  
                    CLIENT  
                </activation-config-property-value>  
            </activation-config-property>                  
        </activation-config>  
    </message-driven>  
    </enterprise-beans>  
  </ejb-jar>  

The above is my ejb-jar.xml file.

The below is from standalone-full.xml

    <system-properties>  
          <!-- JMS properties for ejb-jar.xml -->  
           <property name="jms.queue.manager.channel"  value="QUEUE_MANAGER_CHANNEL"/>  
           <property name="jms.queue.manager.host"     value="QUEUE_MANAGER_HOST"/>  
           <property name="jms.queue.manager.name"     value="QUEUE_MANAGER_NAME"/>  
           <property name="jms.queue.manager.port"     value="QUEUE_MANAGER_PORT"/>  
           <property name="jms.queue.mymdb"            value="MYMDB_QUEUE"/>  
     </system-properties>  

But when I deploy my MDB or restart the server after having the MDB, it gives errors that the ejb-jar.xml is not able to read the values for destination, hostName ect. They are empty. I am using JBOSS 7.2.0.

I am also making sure that I start jboss using standalone.bat -c standalone-full.xml because I am placing the system properties here.

1

There are 1 best solutions below

0
On

Make sure that your standalone-full.xml has spec-descriptor-property-replacement turned on. This property enables jboss to replace property values in descriptors like ejb-jar.xml.

The property is located in

<subsystem xmlns="urn:jboss:domain:ee:1.1">
        <spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
        <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
</subsystem>

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