With Soa Suite 11g you can deploy your composite applications from JDeveloper or with Ant. In this blog I will do this with the soa 11g Ant scripts. These ant scripts can only deploy one project so I made an Ant script around the soa ant scripts which can deploy more composites applications to different Soa enviroments. So now you can use it to automate your deployment or use it in your build tool. In my ant script I will compile, build and package the composite application and deploy this to the soa server, after this I use an ant script to start the unit tests and generate a junit result xml. This junit xml can be used in your continious build system. You can easily extend this build script so you use it to manage the composite applications.
For more info over ant deployment see the official deployment documentation .
The official ant scripts are located in the jdeverloper\bin folder. Here is a summary what are and can do
- ant-sca-test.xml, This script can start the test suites of the composite and generates a juinit report and not Attaches, extracts, generates, and validates configuration plans for a SOA composite application, The official documentation description is not correct.
- ant-sca-compile.xml, Compiles a SOA composite application ,this script is also called in the package scrip, so we don't need to call this directly.
- ant-sca-package.xml, Packages a SOA composite application into a composite SAR file and also validates and build the composite application.
- ant-sca-deploy.xml, Deploys a SOA composite application.
- ant-sca-mgmt.xml, Manages a SOA composite application, including starting, stopping, activating, retiring, assigning a default revision version, and listing deployed SOA composite applications.
Here is the main build.properties where you have to define the jdeveloper and your application home, which composite applications you want to deploy and to which environment dev or acc.
# global
wn.bea.home=C:/oracle/MiddlewareJdev11gR1
oracle.home=${wn.bea.home}/jdeveloper
java.passed.home=${wn.bea.home}/jdk160_11
wl_home=${wn.bea.home}/wlserver_10.3
# temp
tmp.output.dir=c:/temp
applications.home=C:/projecten/workspace/11g_prod
applications=HelloWorld,SoaEjbReference
deployment.plan.environment=dev
# dev deployment server weblogic
dev.serverURL=http://laptopedwin:8001
dev.overwrite=true
dev.user=weblogic
dev.password=weblogic1
dev.forceDefault=true
# acceptance deployment server weblogic
acc.serverURL=http://laptopedwin:8001
acc.overwrite=true
acc.user=weblogic
acc.password=weblogic1
acc.forceDefault=true
Every application can have one or more soa projects so the main ant script will load the application properties file which contains all the project with its revision number.
Here is a example of SoaEjbReference.properties file
projects=SoaEjb,SoaEjb2
SoaEjb.revision=1.0
SoaEjb2.revision=1.1
Because in my example I have two soa environments so I need to create two configuration plans. With this plan ( which look the wls plan ) can change the url of endpoints so it matches with the environment.
Select the composite application xml and generate a configuration plan.
Add the dev or acc extension to the file name.
Here you see how the plan looks like.
And here is the main ant build script which can do it all and calls the Oracle Ant scripts.
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="soaDeployAll" default="deployAll">
<property file="build.properties"/>
<property environment="env"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<import file="${basedir}/ant-sca-deploy.xml"/>
<import file="${basedir}/ant-sca-package.xml"/>
<import file="${basedir}/ant-sca-test.xml"/>
<target name="deployAll">
<foreach list="${applications}" param="application" target="deployApplication" inheritall="true" inheritrefs="false"/>
</target>
<target name="deployApplication">
<echo>deploy application ${application}</echo>
<property file="${application}.properties"/>
<foreach list="${projects}" param="project" target="deployProject" inheritall="true" inheritrefs="false"/>
</target>
<target name="deployProject">
<echo>deploy project ${project} for environment ${deployment.plan.environment}</echo>
<property name="proj.compositeName" value="${project}"/>
<property name="proj.compositeDir" value="${applications.home}/${application}"/>
<propertycopy name="proj.revision" from="${project}.revision"/>
<echo>deploy compositeName ${proj.compositeName}</echo>
<echo>deploy compositeDir ${proj.compositeDir}</echo>
<antcall target="package" inheritall="false">
<param name="compositeDir" value="${proj.compositeDir}/${project}"/>
<param name="compositeName" value="${proj.compositeName}"/>
<param name="revision" value="${proj.revision}"/>
<param name="oracle.home" value="${oracle.home}"/>
<param name="java.passed.home" value="${java.passed.home}"/>
<param name="wl_home" value="${wl_home}"/>
<param name="sca.application.home" value="${proj.compositeDir}"/>
<param name="scac.application.home" value="${proj.compositeDir}"/>
<param name="scac.input" value="${proj.compositeDir}/${proj.compositeName}/composite.xml"/>
<param name="scac.output" value="${tmp.output.dir}/${proj.compositeName}.xml"/>
<param name="scac.error" value="${tmp.output.dir}/${proj.compositeName}.err"/>
<param name="scac.displayLevel" value="3"/>
</antcall>
<property name="deploy.sarLocation" value="${proj.compositeDir}/${proj.compositeName}/deploy/sca_${proj.compositeName}_rev${proj.revision}.jar"/>
<property name="deploy.configplan" value="${proj.compositeDir}/${proj.compositeName}/${proj.compositeName}_cfgplan_${deployment.plan.environment}.xml"/>
<propertycopy name="deploy.serverURL" from="${deployment.plan.environment}.serverURL"/>
<propertycopy name="deploy.overwrite" from="${deployment.plan.environment}.overwrite"/>
<propertycopy name="deploy.user" from="${deployment.plan.environment}.user"/>
<propertycopy name="deploy.password" from="${deployment.plan.environment}.password"/>
<propertycopy name="deploy.forceDefault" from="${deployment.plan.environment}.forceDefault"/>
<echo>deploy on ${deploy.serverURL} with user ${deploy.user}</echo>
<echo>deploy sarFile ${deploy.sarLocation}</echo>
<antcall target="deploy" inheritall="false">
<param name="wl_home" value="${wl_home}"/>
<param name="oracle.home" value="${oracle.home}"/>
<param name="serverURL" value="${deploy.serverURL}"/>
<param name="user" value="${deploy.user}"/>
<param name="password" value="${deploy.password}"/>
<param name="overwrite" value="${deploy.overwrite}"/>
<param name="forceDefault" value="${deploy.forceDefault}"/>
<param name="sarLocation" value="${deploy.sarLocation}"/>
<param name="configplan" value="${deploy.configplan}"/>
</antcall>
<antcall target="test" inheritall="false">
<param name="scatest.input" value="${project}"/>
<param name="scatest.format" value="junit"/>
<param name="scatest.result" value="${tmp.output.dir}"/>
<param name="jndi.properties.input" value="${deployment.plan.environment}.jndi.properties"/>
</antcall>
</target>
</project>
And finally the cmd script to run this ant script. To make this work we need the ant-contrib libray and put this in the classpath.
set ORACLE_HOME=C:\oracle\MiddlewareJdev11gR1
set ANT_HOME=%ORACLE_HOME%\jdeveloper\ant
set PATH=%ANT_HOME%\bin;%PATH%
set JAVA_HOME=%ORACLE_HOME%\jdk160_11
set ANT_CONTRIB=ant-contrib-1.0b3.jar
set CLASSPATH=%CLASSPATH%;%ANT_CONTRIB%
ant -f build.xml deployAll
Here is the zip with all the files and extract this and put this all in the jdeveloper/bin folder.

19 comments:
Really the blog is usefull and solved most of our questions around ant scripts..
I am facing an issue while running deployAll.bat file after setting my server properties into build.properties file. My 11g server is up and running.
Below is the error message:
deployComposite] Received HTTP response from the server, response code=404
[deployComposite] Problem in sending HTTP request to the server. Check standard
HTTP response code for 404
[deployComposite] ---->response code=404, error:null
Hi,
You can take a look at the admin or soa server log. There should be the real error.
and you can add more echos to the ant script to see the parameters.
thanks Edwin
Hi Edwin,
Thanks for your valueable inputs.
Could you please explain what is the importants of dev.jndi.properties file. Please provide deatils on eanch entry of this file.Could you please expalin more about the value " t3://localhost:8001/soa-infra ".
Where i can find this value for my local server.
Thanks and Regards
Veeresh
Hi Edwin,
Just wanted to thank you for the blog and the scripts....It was great help...we were facing the exact issue of finding a simpler way of attaching unit test scripts with deployment and this blog solved it all...
Hi
Could you please explain what is the importants of dev.jndi.properties file.
this is the jndi file for the ant test file so it can connect to wls server and dev is the development version of this file.
Please provide details on each entry of this file.
you mean jndi file. this are the default for wls. like the server and port number of wls , and username / password.
Could you please expalin more about the value " t3://localhost:8001/soa-infra ".
soa suite contains an admin server which runs on 7001 , this holds the em and console webapps. on port 8001 runs the soa wls server and this holds some webservices these are located at soa-infra.
Where i can find this value for my local server.
take a look in the wls console and select the soa servers and look at the port number
thanks Edwin
Hi Edwin,
Thanks for your reply.
I have some confusion around this below value. Please clarify.
t3://localhost:8001/soa-infra.
This looks as URL for SOA server.
why we use t3 instead of http.
if i use http://localhost:8001/soa-infra. the script error out with response code 500.
But if i use t3://localhost:8001/soa-infra. the script completed successfully.
Please explain why we use "t3"
Thank you
Veeresh
Hi,
in java you can also use rmi protocols, this is a lot faster then http and this java code needs the rmi protocol and t3 is the wls version of rmi, in oc4j you can use for example ormi.
http is used in browser and in web services because rmi has different implementation this can't be used everywhere. but this java code contains wls libraries so it can t3
hope this helps
Thanks for clearing up the command line deployment in Oracle 11g(WebLogic).
With your insight and experience, wondering if you can answer this question :
Is it possible to install or have multiple SOA Suites within a signle WebLogic home ? Maybe each SOA Suite in a separate Weblogic domain ? Independant, not load balanced or clustered.
The Oracle Documentation has a picture of it, but no instructions or additional details.
Hi,
That is easy just create two or more soa repositories and use the configuration wizard to create a new soa domain and the second soa domain should a different soa repos and have its own port numbers.
thanks
Hi Edwin, very useful blog. I am having some trouble deploying schemas and wsdl's that utilise the oramds importing technique; when deploying the mds cannot be seen. Is there a workaround?
Regards and thanks
Jason
Hi,
are you using PS1 then see this blog http://biemond.blogspot.com/2009/11/soa-suite-11g-mds-deploy-and-removal.html
when you create a mds connection to the database MDS do you see these files.
what is the error you get.
thanks
Edwin,
I can see the files within Jdeveloper when I create an MDS connection to it. I was using your script that you linked to above and the error in the .err file is:
scac:
[scac] Validating composite : 'C:\wesleyan\ReleaseCompositeScript/src/soa/ConfigurationsPS/composite.xml'
[scac] oracle.fabric.common.wsdl.XSDException: Error loading schema from file:/C:/wesleyan/ReleaseCompositeScript/src/soa/ConfigurationsPS/Config
urationsPS.wsdl [Cause=Error in getting XML input stream: oramds:/apps/xsd/Configurations_v1.xsd: unknown protocol: oramds]
[scac] at oracle.fabric.common.wsdl.SchemaBuilder.loadEmbeddedSchemas(SchemaBuilder.java:496)
Using (in WSDL):
import namespace="http://www.client.co.uk/client" schemaLocation="oramds:/apps/xsd/Configurations_v1.xsd"
Seems it doesnt resolve the oramds at deployment time using ANT. Hope this is clear the the error I am receiving. Regards, Jason
Edwin, quick update:
It seems your Build script does not import the following oramds.jar (Middle Line) inside the ant-sca-compile.xml
include name="oracle.mds_11.1.1/mdsrt.jar"/
include name="oracle.mds_11.1.1/oramds.jar"/
include name="oracle.webservices_11.1.1/orawsdl.jar"/
So for anyone that has this problem - make sure this library is being imported
Regards
Jason
Hi,
Ok thanks are you using PS1 and do start this build.xml from jdeveloper/bin folder else it cant find it.
I don't need to include these jars in version R1 & R1 PS1
i just need to start my build.xml from the jdev bin folder
thanks
Ah, theres the difference then. We wanted to run the deployAll.cmd from a network drive and not within a Jdeveloper sub directory. This is using 11gR1 PS1. Thanks a lot for the ANT build script.
Regards
Jason
hi,
My client wants to shut down the composite once it is deployed in the prod env using ant scripts.
Is there any 'sedate' ant scripts supplied with wls that can be called from the main ant build script.
Firstly Thanks a lot for the ANT build scripts.
Currently one of the other requirements that have come up is to "turn off" the composites once they are deployed.Is it possible to achieve the same?
Hi,
you can use or include ant-sca-mgmt.xml
this manages a SOA composite application, including starting, stopping, activating, retiring, assigning a default revision version, and listing deployed SOA composite applications.
thanks
Hi Edwin,
Hope you are doing good. I have same requirement of shot down the compoistes once it deployed to server. As you said , there is ant-sca-mgmt out of box Ant command.
Could you please leverage this in ur current example and post the same. I am wonder, how to use this in current build.xml for every composite.
Thanks
Veeresh
Post a Comment