Migrate the Oracle WebLogic Server plan.xml Deployment Descriptor Configuration to JBoss Enterprise Application Platform 6 or 7

Updated -

Summary

The Oracle WebLogic Server plan.xml deployment descriptor file provides a way to target the application deployment for a specific environment, for example, development, integration testing, quality assurance, or production. In Red Hat JBoss Enterprise Application Platform 6 and 7, you achieve the same outcome using property substitution. Using this technique, you pass the new values to the deployment descriptors based on the deployment environment. This article describes how to change the target deployment environment in JBoss EAP.

Use Property Substitution to Specify the Target Deployment Environment

Enable Property Substitution in the Server Configuration File

First, you must enable property substitution in the JBoss EAP server configuration file.

  • The <spec-descriptor-property-replacement> element in the ee subsystem of the server configuration file is used to enable or disable property substitution in the ejb-jar.xml and persistence.xml descriptor files.
  • The <jboss-descriptor-property-replacement> element in the ee subsystem of the server configuration file is used to enable or disable property substitution in the jboss-ejb3.xml, jboss-app.xml, jboss-web.xml, *-jms.xml, and *-ds.xml descriptor files.

To enable property substitution, the value must be set to true. This is the default value. The following is an example of the ee subsystem element configured to enable property substitution.

<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>
</subsystem>

For more information about property substitution, see Enabling/Disabling Descriptor Based Property Replacement in the chapter entitled Securing JBoss Enterprise Application Platform in the Administration and Configuration Guide.

Bind Strings for JNDI Runtime Mapping

For values outside deployment descriptors that change depending on the target environment, you can bind string values to JNDI and then map them into the application.

Assume the application's web.xml file contains the following resource reference:

<resource-env-ref>
    <description>IP address of the destination</description>
    <resource-env-ref-name>destination/ip-address</resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>

To bind simple strings into JNDI, create a <simple> element in the naming subsystem of the server configuration file. The following is an example of the naming subsystem element configured for JNDI substitution.

<subsystem xmlns="urn:jboss:domain:naming:1.4">
    <bindings>
        <simple name="java:/my/jndi/key" value="MyJndiValue"/>
    </bindings>
</subsystem>

Add an entry to the application's jboss-web.xml to map the global JNDI entry to the application's java:comp/env/ Environment Naming Context (ENC). The <resource-env-ref-name> element value must match the value specified in the web.xml and the <jndi-name> element must match the <simple> element name in the server configuration file.

<jboss-web>
    <resource-env-ref>
        <resource-env-ref-name>destination/ip-address</resource-env-ref-name>
        <jndi-name>java:/my/jndi/key</jndi-name>
    </resource-env-ref>
</jboss-web>

Follow the same procedure to implement property substitution for other descriptor files.

For more information about how to manage the server configuration files, see the chapter entitled Management Interfaces in the Administration and Configuration Guide for JBoss EAP.