Miscellaneous Ant tasks for Managing the BPEL Server

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 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" providerURL="opmn:ormi://::/orabpel">
      <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


1. 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 ="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.

2. 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 tasks, one for each domain to purge and undeploy processes and instances in each domain.


3. Print Log Subtask


Prints the domain log

4. SetProperty subtask


Sets a domain property. e.g. dspMaxThreads

5. GetProperties subtask


Gets the property values for the given set of domain properties.[comma separated]

6. 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]

7. Create Domain subtask


Creates a domain with the given name.

8. Delete Domain subtask


Deletes the domain with the given name.
Notes:
Ensure that BPEL_HOME and ORACLE_HOME are properly set.
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:

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 on February 13, 2008 at 03:19 AM PST #

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 on February 13, 2008 at 03:55 AM PST #

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 on April 08, 2008 at 02:26 AM PDT #

you should have orabpel.jar in the classpath. This will resolve the above issue.

Posted by Ramkumar Menon on April 10, 2008 at 05:38 PM PDT #

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 on July 16, 2008 at 12:16 AM PDT #

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 on September 29, 2008 at 08:26 PM PDT #

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 on October 01, 2008 at 01:54 AM PDT #

Hello, I'm get the same deserializing error as Denis. Any resolution? Thx! Steve

Posted by Steve Wall on October 08, 2008 at 12:01 AM PDT #

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 on October 08, 2008 at 12:45 AM PDT #

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 on November 12, 2008 at 10:34 PM PST #

Hi, I´m getting the same error that Guido is getting. Has anyone managed to solve this? Thanks.

Posted by Rafael on April 13, 2009 at 02:45 AM PDT #

Hi, I would like to undeploy: BPEL Process: MwfBpelGetDataForDemandNetInfrastructure Lifecycle: Retired Version: 1.2 I use this syntax: But response is: [undeployProcesses] Jan 13, 2010 2:09:38 PM com.collaxa.cube.ant.taskdefs.UndeployProcesses undeployAllProcessesExceptTaskProcesses [undeployProcesses] INFO: Starting undeployment [undeployProcesses] Jan 13, 2010 2:09:38 PM com.collaxa.cube.ant.taskdefs.UndeployProcesses undeployAllProcessesExceptTaskProcesses [undeployProcesses] INFO: No BPEL Processes matched your request [undeployProcesses] Jan 13, 2010 2:09:38 PM com.collaxa.cube.ant.taskdefs.UndeployProcesses undeployAllProcessesExceptTaskProcesses [undeployProcesses] INFO: Undeployment complete What could be wrong? Thank you in advance Juraj

Posted by Juraj on January 12, 2010 at 11:00 PM PST #

I am running 10.1.3.5 and it fails with the error: -bash-3.00$ ant -f admin-task.xml adminTasks Buildfile: admin-task.xml [java] Java Result: 1 [taskdef] Could not load definitions from resource com/collaxa/cube/ant/orabpel-antlib.xml. It could not be found. BUILD FAILED /app/oracle/product/APP/10.1.3/bpel/samples/admin-task.xml:15: The following error occurred while executing this line: /app/oracle/product/APP/10.1.3/bpel/utilities/ant-orabpel.xml:51: taskdef class com.collaxa.cube.ant.taskdefs.ServerAdmin cannot be found Total time: 0 seconds please help

Posted by guest on February 24, 2010 at 03:54 AM PST #

I don't think you can change your cats preference or choice of food. Cats are very picky and very particular about thev foods they eat. That changes as the cat matures and gets older, much like humans. Good luck though.

Posted by Roscoe Thimmesch on November 05, 2010 at 02:19 AM PDT #

What would all of us do without the wonderful concepts you reveal on this site? Who comes with the persistence to deal with critical topics with regard to common visitors like me? I actually and my pals are very happy to have your web blog among the ones we often visit. Hopefully you know how very much we love your hard work! Best wishes from us all.

Posted by prestiti inpdap on April 27, 2011 at 09:16 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Principal Product Manager

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today