This post is to summarize and correct some of the information which can be found on this thread: Dealing with changing service wsdl locations in the ESB. (A big thanks to all the people who participated on this thread!)
Let’s start with some issues a lot of people, including me, have run into.
jaxb.properties not found
If you’re using Ant 1.6.5, you need to put some libraries on the classpath before starting ant. In the OTN forum thread some people state that you need to use Ant 1.7, and although Ant 1.7 has some improvements in how it handles classpaths, you do not need to use it. You just need to make sure that the oracle xmlparserv2 jar, the jaxb jars (i’m using version 2.0.5), and apache commons codec jar is on the classpath. In JDeveloper you can do it as displayed below (click image for full size).
NullPointerException when trying to extract a deployment plan
This is caused by a bug in an older version of ESBMetadataMigration.jar. As is mentioned on the thread, this can be solved by using the jar included with Soasuite 10.1.3.3. (you can find it in soasuite/integration/esb/deployment/documentation.zip).
Error detected while reading the Deployment Plan
If you see this error when deploying an ESB, you can solve this by running Ant in a separate JVM. You can specify this in the project properties as is displayed below.
Dynamically determining ESB component GUIDs
Ant has some default tasks that you can use to determine the GUID of a esb service. Using xmlproperty you can read an xml file and extract the value of a guid. Here’s an example:
<xmlproperty file="MyEsb.esbsvc" prefix="myesb"/>
<property name="myesb.guid" value="${myesb.service(guid)}"/>
Complete example
Since Ant 1.6 you have the ability to define macros. Using some simple macros deploying esbs becomes quite simple. Here’s an example:
<target name="deploy">
<!--
== Undeploy esb components, by determining the guid from the esbsvc file
-->
<xmlproperty file="MyEsb.esbsvc" prefix="myesb"/>
<property name="myesb.guid" value="${myesb.service(guid)}"/>
<undeploy-esb guid="${myesb.guid}"/>
<!--
== deploy esb project
-->
<deploy-esb/>
</target>
<target name="extract.esb.deployment.plan">
<!--
== extract deployment plan from deployed esb component
-->
<extract-esb-deployment-plan/>
</target>
ESB deployment macros
I’m using the following macro definitions:
<project default="init" name="build-macros" xmlns:esb="antlib:oracle.tip.esb.client.anttasks">
<taskdef uri="antlib:oracle.tip.esb.client.anttasks"
resource="oracle/tip/esb/client/anttasks/antlib.xml"
loaderref="oracle.esb.ant">
<classpath>
<path refid="oracle.esbant.lib"/>
<path refid="apache.commons.httpclient.lib"/>
<path refid="apache.commons.logging.lib"/>
<path refid="apache.commons.codec.lib"/>
<path refid="oracle.esb.lib"/>
<path refid="java.jaxb.lib"/>
<path refid="oracle.xmlparser.lib"/>
</classpath>
</taskdef>
<!--
============================================================================
== deploy esb
============================================================================
-->
<macrodef name="deploy-esb">
<attribute name="deploymentplanFile"
default="${basedir}/${src.dir}/${ant.project.name}-esbplan-${build.env}.xml"/>
<attribute name="esbHost" default="${integration.server.host}"/>
<attribute name="esbPort" default="${integration.server.port}"/>
<attribute name="esbAdminUser"
default="${integration.server.admin.username}"/>
<attribute name="esbAdminPassword"
default="${integration.server.admin.password}"/>
<sequential>
<echo>Deploying esb project ${ant.project.name} using plan @{deploymentplanFile}</echo>
<property name="esbplan" location="@{deploymentplanFile}"/>
<esb:deployESBSuitcase esbmetadataserverhostname="@{esbHost}"
esbmetadataserverport="@{esbPort}"
username="@{esbAdminUser}"
password="@{esbAdminPassword}"
deploymentplanfilename="${esbplan}"
sourcedirectory="${basedir}"></esb:deployESBSuitcase>
</sequential>
</macrodef>
<!--
============================================================================
== extract esb deployment plan
============================================================================
-->
<macrodef name="extract-esb-deployment-plan">
<attribute name="templateDeploymentplanFile"
default="${basedir}/${srcgen.dir}/${ant.project.name}-esbplan-template.xml"/>
<sequential>
<mkdir dir="${srcgen.dir}"/>
<delete file="@{templateDeploymentplanFile}"/>
<echo>Creating deployment plan @{templateDeploymentplanFile}</echo>
<esb:extractESBDeploymentPlan sourcedir="${basedir}"
deploymentplanfile="@{templateDeploymentplanFile}"/>
</sequential>
</macrodef>
<!--
============================================================================
== undeploy esb
============================================================================
-->
<macrodef name="undeploy-esb">
<attribute name="guid"/>
<attribute name="esbHost" default="${integration.server.host}"/>
<attribute name="esbPort" default="${integration.server.port}"/>
<attribute name="esbAdminUser"
default="${integration.server.admin.username}"/>
<attribute name="esbAdminPassword"
default="${integration.server.admin.password}"/>
<sequential>
<echo>Undeploying ESB from @{esbHost}</echo>
<esb:undeployESBEntities esbmetadataserverhostname="@{esbHost}"
esbmetadataserverport="@{esbPort}"
username="@{esbAdminUser}"
password="@{esbAdminPassword}">
<system guid="@{guid}"/>
</esb:undeployESBEntities>
</sequential>
</macrodef>
</project>
Most macros have sensible default values for the attributes which usually means you don’t have to specify any attributes. The properties used in the defaults are read from a property file.
The deployment macro expects a deployment plan in the src directory. You need to specify a build.env property to tell it which deployment to use.

