Tuesday, January 06, 2009

BPEL 10.1.3.4 Deployment Framework

Why I want to write this?

I wanted to find some quick start material for using BPEL deployment framework in 10.1.3.4
Damn I could not find any. Nothing that looked like a quick start thing.
And the worst part was the closest I could find was oracle documentation about it.

At least I could not google any thing even close
But neither of them helped me quick start like a quick list of things to do. :(

I hope this post comes up in google for the help of those who want it.

What is the first thing to do?

The first thing to do is edit your build.xml file
If you open up your BPEL project you will find that in Folder called Resources
If you are looking in the actual physical folder then you will find this in ${process.dir} (the bpel ant terminology)
Basically the top project folder where you find your jpr file.

Why build.xml first?

Fundamentals first, as you are going to use ant to perform deployment automation, you need to edit the build.xml file that ant uses.

Do what in build.xml?

You need to include the ant things that oracle has come up with.
Basically it has 4 things new
generateplan - to generate a brand new plan for you, isn't that cool
attachplan - to attach the plan to your jar while deplyoing
validateplan - to validate the plan, use for developement purpose only and disbale in PROD
extractplan - to extract the plan out from your jar file

Down to business in build.xml

how the hell to use these.
First things first. You need to create plan file as a starting point.
generateplan is the good thing that help you do this.

Stick this piece of code before the </project>

<target name="generateMyPlanFromProjectFile">
<generateplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true" descfile="${process.dir}/bpel/bpel.xml"/>
</target>


What this does is, generate a file called MyPlanFile.xml in your ${process.dir}

If you want to generate the plan file from jar file, you can stick this piece there as well.

<target name="GenerateMyPlanFromSuitcaseFile">
<generateplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

What this does is, generate the plan fuile from jar file.
Here the use of some things like ${rev} etc can found some where below in build.properties
For now just know that this will pick the correct jar

Basically stick both the pieces there.

If you have not yet complied to generate the jar, do not be surprised to see the GenerateMyPlanFromSuitcaseFile fail

What the hell do I do with this generateplan thing....

Well what else but run as ANT
Right click the build.xml in Jdeveloper, Open up Run Ant Target
Choose generateMyPlanFromProjectFile

JDeveloper should fire up and generate a file for you called MyPlanFile.xml
If you are not able to see that in Resources folder (same place where the build.xml is located) click refresh mate and you should see it

Congrats you have completed the first step easily

Changes in build.properties file

There is a file called build.properties in the same good old folder ${process.dir}
Open that up and see 2 properties called domain and rev
These are commented out by default

uncomment them and change them as below
#if domain name is "commmon" then type in common domain = ${enter the name of the domain yoiu want to deploy}
#if revision is 2.0 then type in 2.0 rev = ${version number of the bpel process}

Good with all this but where is the search and replace thing


Open up the MyPlanFile.xml and you should see some thing there.
Some thing like wsdlAndSchema

There is a element called search and replace

Need to fill this up to search and replace. Read the documentation to find how all to use it. This is the easy part aint it!! Just fill in some strings to test your code.

How to attach the plan

Stick this thing into the build.xml file

<target name="AttachMyPlan">
<echo> -------------------------------------------------------------- | Attaching the plan file ------------------------------------------------ </echo>
<attachplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

What this does is attach the plan file to your jar.

What about extract plan

I am not sure if you want this or not, but here is the piece of code

<target name="ExtractMyPlan">
<extractplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

Ya ya I know that you know what this does.

Now what else?

The last part, add the new target you added to the default target process-deploy

In the depends part of &lttarget name="process-deploy"
Add the target AttachMyPlan after complie

So the new target will look like

<target name="process-deploy"
depends="validateTask, compile, AttachMyPlan, deployProcess, deployTaskForm, deployDecisionServices"/>

Why Am I not adding the generateplan thing in there

Well you do not want to generate the plans always and over write the search and replace that you have read form the documentation and build

If you did then do not be surprised but only thing is I will be laughing ha ha ha :)

How to deploy to other Environments

Well that is for you to discover and explore
Just that you need to run this in dev prompt. Go to the same old ${process.dir} directory and run the ANT as
command promt>ant process-deploy

Congrats mate you have done it.
There are other few things that you can learn from the documentation if you are interested at all

Links that I liked

I could hardly google a lot of stuff for this.
The best is oracle documentation
http://download.oracle.com/docs/cd/E12524_01/relnotes.1013/e12523/bpelrn.htm#BABCEBAA

The next best I could find was
http://blogs.oracle.com/reynolds/2008/11/bpel_deployment_framework.html

13 comments:

llarafernandes said...

Hello,

do you have any idea why it returns the following error?

attachplan] attachPlan: Started for jar file = C:\jdevstudio10134\jdev\mywork\TESTES\BPELProcess/ou
put/bpel_BPELProcess_1.0.jar using deploy plan = ${planfile}
attachplan]

Load deployment plan file ${planfile}
attachplan] java.io.IOException: Cannot read deployment plan file ${planfile}

Thank you!

Kalidass Mookkaiah said...

Have you placed the plan file in the right directory?

Anonymous said...

Hi,

do you know how to deploy a new version of bpel process without setting it default after deploy, please? f.e. If I have deployed bpel in ver. 1.0 as default, and then I deploy new ver. 2.0 it sets as default automatically. Do you know if there is a way how to avoid this behaviour, please?

Martin

Anonymous said...

Hi,

do you know how to deploy a new version of bpel process without setting it default after deploy, please? f.e. If I have deployed bpel in ver. 1.0 as default, and then I deploy new ver. 2.0 it sets as default automatically. Do you know if there is a way how to avoid this behaviour, please?

Martin

Unknown said...

Hi,

i am trying to change one of the JCA activation property using plan.xml but no Success.

----







BPELProcess1.wsdl







BankRecon
BankReconciliation





Pls. help me out here.

Nikhil

Unknown said...

Hi,

I am trying to change one of the JCA activation property using plan.xml but no Success.

---







BPELProcess1.wsdl







BankRecon
BankReconciliation





Pls. help me out here.

Nikhil

Unknown said...

The BPEL forum link is:

http://forums.oracle.com/forums/thread.jspa?threadID=1002750&tstart=75

Anonymous said...

Thanks. This was helpful.

Ravi said...

The jca property could be replaced by having it as the first child element of the .

Another issue I'm facing at the moment is that everything works fine initially and after sometime I restart the weblogic server it is noticed that few processes that have dependency on others aren't deployed as the order of deployment is not the same when the suitcases are deployed initially. This happens only if we use the deployment plan feature. Any help in this regard is highly appreciated.

Unknown said...

I am trying to attach a deployment plan and keep running into the following issues:

attach_plan:

BUILD FAILED
C:\product\10.1.3.1\OracleAS_1\bpel\samples\demos\AutoLoanDemo\AutoLoanFlow\build.xml:234: Could not create task or type of type: attachplan.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'attachplan'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using .
- You are attempting to use a task defined using
or but have spelt wrong or not
defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:493)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:391)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:295)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java:43)
at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:71)

Total time: 0 seconds

I am doing this via jdev. I get the same error when i try from dos prompt. Do you know which libs I am missing?

Unknown said...
This comment has been removed by the author.
Unknown said...

I am trying to attach a deployment plan and keep running into the following issues:

attach_plan:

BUILD FAILED
C:\product\10.1.3.1\OracleAS_1\bpel\samples\demos\AutoLoanDemo\AutoLoanFlow\build.xml:234: Could not create task or type of type: attachplan.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'attachplan'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using .
- You are attempting to use a task defined using
or but have spelt wrong or not
defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:493)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:391)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:295)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java:43)
at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:71)

Total time: 0 seconds

I am doing this via jdev. I get the same error when i try from dos prompt. Do you know which libs I am missing?

Sofia (Rocío Bareño) said...

Does anybody know what library should I include to use the ant task outside the build.xml file???

Thanks in advance!

Regards, Sofia