The serverAdmin ANT task
This news item describes a simple ant task that I had come up named serverAdmin that allows you to
- Selectively undeploy BPEL Processes
- Selectively purge BPEL process instances.
- Cancel and Recover Invocation Messages
- Cancel and Recover Callback Messages
- Get one or more domain configuration properties
- Set one or more domain configuration properties
- Fetch the latest domain log from the Server
- Create/delete a domain on the BPEL server
Setup and Usage
To setup this task, perform the following steps.
- Copy the admintasks.jar from http://blogs.oracle.com/ramkumarMenon/gems/admintasks.jar into $ORACLE_HOMEintegrationlib directory.
- Open up ant-orabpel.xml in $ORACLE_HOMEbpelutilities directory and paste the following piece of code into the file within the <project> element.
<path id="admin.tasks.class.path">
<pathelement location="${bpel.home}/../lib/admintasks.jar"/>
</path>
<property name="admin.tasks.class.path" refid="admin.tasks.class.path"/>
<taskdef name="serverAdmin" classname="com.collaxa.cube.ant.taskdefs.ServerAdmin">
<classpath>
<pathelement path="${admin.tasks.class.path}"/>
</classpath>
</taskdef>
Illustrative Command Syntax
<serverAdmin providerURL="opmn:ormi://<hostName>:<opmnRequestPort>:<oc4jInstanceName>/orabpel" userName="oc4jadmin" password="<pwdforoc4jadmin>">
<createDomain domainName="testDomain"/>
<deleteDomain domainName="testDomain"/>
<manageDomain domain="default">
<undeployProcesses select="BPELProcess.*" type="all" revision="all"/>
<undeployProcesses select="TestXPath" type="retired" revision="all"/>
<undeployProcesses select="Sample.*" type="all" revision="2.0"/>
<undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
<!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z" "1994-11-05T08:15:30 -0800-->
<!--example date format "yyyy-MM-dd" "1994-11-05"-->
<purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
<purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
<getProperties propertyNames="dspMinThreads,dspMaxThreads,syncMaxWaitTime"/>
<setProperty name="dspMinThreads" value="5"/>
<cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
<recoverInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
<cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
<recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
<printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
<purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
<purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
<purgeInstances select="SampleProcess" type="closed.completed" toDateTime="2007-10-31"/>
<purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
<purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
<purgeInstances/>
</manageDomain>
</serverAdmin>
Short Description
UnDeployProcesses subtask:-
The select argument for "undeployProcesses" subtask accepts both exact process names, as well as java regex expressions. For instance, the above example shows undeployment for all processes whose name starts with the string "BPELProcess".
All arguments are mandatory.If you wish to specify "all" values for one or more arguments, specify them in the format <argName>="all". For instance, you can specify type="all" or revision="all" or select="all" to indicate selection of all process states, all revisions or all processes.
PurgeInstances subtask :-
If fromDateTime/fromDate is omitted, it purges every matching instance upto and including the "toDateTime/toDate". Note that in case you specify a date as opposed to a dateTime, the time is defaulted to the beginning of the date. [i.e. 12 AM]
If the "toDateTime/toDate" is omitted, it purges every matching instance till the present.
If both are specified, the task purges all matching instances including and between the given timespan.
If both are omitted, the task purges all matching instances irrespective of the time.
The dateTime has to be specified in the format given in the above example.
The "type" attribute, if omitted, is equivalent to "all". The other values are
- closed.aborted
- closed.cancelled
- closed.completed
- closed.faulted
- closed.stale
- closed.pendingCancel
- initiated
- open.running
- open.faulted
- open.suspended
Each serverAdmin task can be used to administer a different BPEL runtime.
Within each serverAdmin, you can provide multiple <manageDomain> tasks, one for each domain to purge and undeploy processes and instances in each domain.
Print Log Subtask
Prints the domain log
SetProperty subtask
Sets a domain property. e.g. dspMaxThreads
GetProperties subtask
Gets the property values for the given set of domain properties.[comma separated]
Recovery/Cancellation/Deletion of Invocation or callback subtasks
Recovers, deletes or cancels invocations/callback. Arguments to this task are the processName, revision, the from/to date or dateTimes in the given format as specified in the example. [yyyy-MM-dd'T'HH:mm:ss Z or yyyy-MM-dd]
Create Domain subtask
Creates a domain with the given name.
Delete Domain subtask
Deletes the domain with the given name.
Notes:
Ensure that BPEL_HOME and ORACLE_HOME are properly set.
<p/>
Sample Build File
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="ServerAdminBuild" default="deploy" basedir=".">
<!--=============================-->
<!-- Process deployment targets -->
<!--=============================-->
<!-- Set bpel.home from developer prompt's environment variable BPEL_HOME -->
<condition property="bpel.home" value="${env.BPEL_HOME}">
<available file="${env.BPEL_HOME}/utilities/ant-orabpel.xml"/>
</condition>
<!-- If bpel.home is not yet using env.BPEL_HOME, set it for JDev -->
<property name="bpel.home" value="${oracle.home}/integration/bpel"/>
<!-- First override from build.properties in process.dir, if available -->
<property file="${process.dir}/build.properties"/>
<!-- import custom ant tasks for the BPEL PM -->
<import file="${bpel.home}/utilities/ant-orabpel.xml"/>
<target name="adminTasks">
<serverAdmin providerURL="opmn:ormi://server.host.com:6004:oc4j_soa/orabpel" userName="oc4jadmin" password="welcome1">
<manageDomain domain="default">
<undeployProcesses select="BPELProcess.*" type="all" revision="all"/>
<getProperties propertyNames="dspMinThreads"/>
<setProperty name="dspMinThreads" value="5"/>
<cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
<recoverlInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
<cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
<recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
<printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
<undeployProcesses select="TestXPath" type="retired" revision="all"/>
<undeployProcesses select="Sample.*" type="all" revision="2.0"/>
<undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
<!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z" "1994-11-05T08:15:30 -0800-->
<!--example date format "yyyy-MM-dd" "1994-11-05"-->
<purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
<purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
<purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
<purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
<purgeInstances select="SampleProcess" type="closed.completed" toDateTime="2007-10-31"/>
<purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
<purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
<purgeInstances/>
</manageDomain>
</serverAdmin>
</target>
</project>
Comments (11)
Hi, useful stuff but I can't get it working, seems to be missing a class from the oc4jclient.jar
oracle.oc4j.admin.management.mbeans.proxies.MessageDrivenBeanJCAMBeanProxy is missing, any idea why I don't have this in my oc4jclient.jar file?
I'm running OAS/BPEL 10.1.3.3
thanks
Terry
Posted by Terry Hagan | February 13, 2008 11:19 AM
Posted on February 13, 2008 11:19
I have removed certain unused classes from the binaries. Please try again with the revised jar uploaded http://blogs.oracle.com/ramkumarMenon/gems/admintasks.jar
Posted by Ramkumar Menon | February 13, 2008 11:55 AM
Posted on February 13, 2008 11:55
I am getting following error
java.lang.NoClassDefFoundError: com/oracle/bpel/client/IInstanceConstants
I'm running OAS/BPEL 10.1.3.1
Thanks
Posted by rb | April 8, 2008 9:26 AM
Posted on April 8, 2008 09:26
you should have orabpel.jar in the classpath. This will resolve the above issue.
Posted by Ramkumar Menon | April 11, 2008 12:38 AM
Posted on April 11, 2008 00:38
Hi,
I am trying to undeploy a BPEL Process but I get following exception:
java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.oracle.bpel.client.BPELDomainHandle; local class incompatible: stream classdesc serialVersionUID = -6384534326625967840, local class serialVersionUID = -8310067783665200608
at com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:843)
at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:287)
at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
at java.lang.Thread.run(Thread.java:595)
INFO: Failed to undeploy BPEL processes. - Error deserializing return-value: java.io.InvalidClassException: com.oracle.bpel.client.BPELDomainHandle; local class incompatible: stream classdesc serialVersionUID = -6384534326625967840, local class serialVersionUID = -8310067783665200608
Any ideas why?
thanks
Denis
Posted by denf | July 16, 2008 7:16 AM
Posted on July 16, 2008 07:16
Hi,
Really useful stuff...
I have tested it and it's working fine...
Thank you :-)
can you explain " how to deploy bpel process using BPEL API's"(java code).
Thanks in advance...
Bhargavi Ch
Posted by Bhargavi Ch | September 30, 2008 3:26 AM
Posted on September 30, 2008 03:26
Hi Ram,
I recently upgraded my SOA suite to 10.1.3.4. Now I have problem running bpelAdmin ant tasks.
The error is similar to the previous post by Dennis except that I used purgeInstances task:
[purgeInstances] INFO: An error occured while attempting to purge the instances.
- Error deserializing return-value: java.io.InvalidClassException: com.oracle.bpel.client.InstanceHandle; local class incompatible: stream classdesc serialVersionUID = 5024836627090697194, local class serialVersionUID = -7266285449626847770
Please help me to resolve this issue.
I used this task a lot in previous versions (upto 10.1.3.3) of SOA Suite without any issue.
Thanks,
Mingsheng
Posted by Mingsheng Xie | October 1, 2008 8:54 AM
Posted on October 1, 2008 08:54
Hello,
I'm get the same deserializing error as Denis. Any resolution?
Thx!
Steve
Posted by Steve Wall | October 8, 2008 7:01 AM
Posted on October 8, 2008 07:01
Hello,
I found the problem with the serialization error. The orabpel.jar used by my Jdev (10.1.3.3) differs from the jar in my App Server (10.1.3.1.0).
The fix is to get ant using the same jar as the app server. For me that involved selecting "Manage ant settings..." and adding the app server orabpel.jar to the classpath.
HTH,
Steve
Posted by Steve Wall | October 8, 2008 7:45 AM
Posted on October 8, 2008 07:45
I get this exception using version 10.1.3.3:
/pkg/pesa/home/pesaoas1/build.xml:19: Failed to create "ejb/collaxa/system/ServerBean" bean; exception reported is: "java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at com.oracle.bpel.client.util.BeanRegistry.lookupServerBean(BeanRegistry.java:96)
at com.oracle.bpel.client.auth.ServerAuthFactory.authenticate(ServerAuthFactory.java:73)
at com.collaxa.cube.ant.taskdefs.ServerAdmin.execute(ServerAdmin.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
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 org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.ClassCastException: __Proxy0
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
... 16 more
Posted by Guido Mueller | November 13, 2008 6:34 AM
Posted on November 13, 2008 06:34
Hi,
I´m getting the same error that Guido is getting.
Has anyone managed to solve this?
Thanks.
Posted by Rafael | April 13, 2009 9:45 AM
Posted on April 13, 2009 09:45