Blog maintained by TechnoGems

Thursday, January 1, 2009

Oracle ESB deploy script

If you need to deploy your ESB projects to multiple environments without jDeveloper, there is not a elegant solution. The ANT deployment tasks that comes part of the 10.3.1.3 packages helps a good deal. You can refer to the documentation on that at
http://www.oracle.com/technology/products/integration/esb/files/esbdeploymentautomation.zip or it is included in your ORACLE_HOME/integration/deployment/documentation.zip file.

Using the deployment script described there, you can extract the deployment plan from the esb project files. Once you have extracted the deployment plan file, all your settings will be in one single file which you can edit/make multiple copies with different settings for different environments. Even though this approach is far better than having to maintain several versions of several esb file, it still falls short of my expectation.

For most of the ESB projects dealing with various adapters and such, the deployment plan file has too much information it it so every time the ESB project changes (adding/removing adaptors or adaptor settings), you will have to regenerate the deployment plan file and make the copies for your different information. However, in most cases the only information that changes per environment are the endpoint properties that specify file directories, server specific properties etc. From a development and deployment perspective, it would be much nicer, if oracle had provided a way to specify the endpoint properties in a single location on the server, so every time a new version of ESB project is deployed, the endpoint properties are not impacted. In the absence of such feature, the closest that I could do minimize the impact of maintaining the endpoint properties is to generate the deployment plan file using the ant task and edit it using another custom task that takes the endpoint properties from a properties file that just has the properties you want to be different for each environment.

The source code and the sample ant task for this can be found here.

Using this approach, you create a property file that contains the endpoint property as the key and the value you want as a simple java style property file. You will need to create one such file per environment. The java program takes the template file, the properties file and the new deployment file name as arguments and creates the deployment file that can be used by the ant task that comes with oracle. Using this procedure, a typical build will have the following steps.
1) Extract deployment plan file using the oracle provided task.
2) Invole the ESBDeploymentPlanEditor class to create a server/environment specific deployment plan using the custom task
3) Deploy the ESB project using the deployment plan created on the above step using the oracle provided task.

2 comments:

John Kliff said...

Hi. This post met quite perfectly the requirements I'm dealing with in a current project (namely, have the ESBs built automatically, as well as all of our other project's components).

Upon usage, unfortunatelly, I met the following jaxb problem right after " [echo] Creating deployment plan esb/GravaClienteEBS_RS/build/GravaClienteEBS_RS-esbplan-dev.xml":

[java] javax.xml.parsers.FactoryConfigurationError: Provider oracle.xml.jaxp.JXDocumentBuilderFactory not found
[java] at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:129)
[java] at build.ESBDeploymentPlanEditor.updateEndPointProperties(ESBDeploymentPlanEditor.java:80)
[java] at build.ESBDeploymentPlanEditor.main(ESBDeploymentPlanEditor.java:50)

(etc...)

Even though I'm familiar with such issues within the Oracle iAS (where I can handle it trough library definitions) I couldn't figure out quite well how to deal with it in this situation. I couldn't event point out exactly what was requiring this specific provider (though I believe it to be something within ESBMetadataMigration.jar).

Was there any special setup in your environment needed to run through ant in order for the required parser to be found? Could you share any idea whatsoever about what may I be missing or doing wrong?

I appreciate very much any help and your time.

Jean said...

John, Sorry it took a long time to respond. I must have missed the email notification about your comment. Hopefully you have figured out what the issue was. Just for the benefit of others, I thought I should put in my answer.

I have the following jsr173 related jars in my class path.

jsr173_1.0_api.jar
jaxb1-impl.jar
jaxb-xjc.jar
jaxb-impl.jar
jaxb-api.jar
commons-logging.jar

Hope this helps.