« Customizing any BPEL Project Artifact using <customizeDocument> | Main | Scanning text files using java.util.Scanner »

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
  1. Selectively undeploy BPEL Processes
  2. Selectively purge BPEL process instances.
  3. Cancel and Recover Invocation Messages
  4. Cancel and Recover Callback Messages
  5. Get one or more domain configuration properties
  6. Set one or more domain configuration properties
  7. Fetch the latest domain log from the Server
  8. Create/delete a domain on the BPEL server

Setup and Usage

To setup this task, perform the following steps.
  1. Copy the admintasks.jar from http://blogs.oracle.com/ramkumarMenon/gems/admintasks.jar into $ORACLE_HOMEintegrationlib directory.
  2. Open up ant-orabpel.xml in $ORACLE_HOMEbpelutilities directory and paste the following piece of code into the file within the &lt;project> element.
&lt;path id="admin.tasks.class.path">
      &lt;pathelement location="${bpel.home}/../lib/admintasks.jar"/>
  &lt;/path>
  &lt;property name="admin.tasks.class.path" refid="admin.tasks.class.path"/>
  &lt;taskdef name="serverAdmin" classname="com.collaxa.cube.ant.taskdefs.ServerAdmin">
    &lt;classpath>
      &lt;pathelement path="${admin.tasks.class.path}"/>
    &lt;/classpath>
  &lt;/taskdef>
Illustrative Command Syntax
      &lt;serverAdmin  providerURL="opmn:ormi://&lt;hostName>:&lt;opmnRequestPort>:&lt;oc4jInstanceName>/orabpel" userName="oc4jadmin" password="&lt;pwdforoc4jadmin>">
       &lt;createDomain domainName="testDomain"/>
       &lt;deleteDomain domainName="testDomain"/>
       &lt;manageDomain domain="default">
              &lt;undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>
              &lt;undeployProcesses select="TestXPath"  type="retired" revision="all"/>
             &lt;undeployProcesses select="Sample.*" type="all" revision="2.0"/>
             &lt;undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
         &lt;!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->
         &lt;!--example date format "yyyy-MM-dd"   "1994-11-05"-->
          &lt;purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          &lt;purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
             &lt;getProperties propertyNames="dspMinThreads,dspMaxThreads,syncMaxWaitTime"/>
              &lt;setProperty name="dspMinThreads" value="5"/>
              &lt;cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
              &lt;recoverInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
              &lt;cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              &lt;recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              &lt;printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
          &lt;purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
          &lt;purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
          &lt;purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>
          &lt;purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
          &lt;purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
         &lt;purgeInstances/>
        &lt;/manageDomain>
      &lt;/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 &lt;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
  1. closed.aborted
  2. closed.cancelled
  3. closed.completed
  4. closed.faulted
  5. closed.stale
  6. closed.pendingCancel
  7. initiated
  8. open.running
  9. open.faulted
  10. open.suspended
Each serverAdmin task can be used to administer a different BPEL runtime. Within each serverAdmin, you can provide multiple &lt;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. &lt;p/> Sample Build File
&lt;?xml version="1.0" encoding="iso-8859-1"?>
&lt;project name="ServerAdminBuild" default="deploy" basedir=".">
    &lt;!--=============================-->
    &lt;!-- Process deployment targets  -->
    &lt;!--=============================-->
    &lt;!-- Set bpel.home from developer prompt's environment variable BPEL_HOME -->
    &lt;condition property="bpel.home" value="${env.BPEL_HOME}">
        &lt;available file="${env.BPEL_HOME}/utilities/ant-orabpel.xml"/>
    &lt;/condition>
    &lt;!-- If bpel.home is not yet using env.BPEL_HOME, set it for JDev -->
    &lt;property name="bpel.home" value="${oracle.home}/integration/bpel"/>
    &lt;!-- First override from build.properties in process.dir, if available -->
    &lt;property file="${process.dir}/build.properties"/>
    &lt;!-- import custom ant tasks for the BPEL PM -->
    &lt;import file="${bpel.home}/utilities/ant-orabpel.xml"/>
    &lt;target name="adminTasks">
      &lt;serverAdmin  providerURL="opmn:ormi://server.host.com:6004:oc4j_soa/orabpel" userName="oc4jadmin" password="welcome1">
        &lt;manageDomain domain="default">
              &lt;undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>
             &lt;getProperties propertyNames="dspMinThreads"/>
              &lt;setProperty name="dspMinThreads" value="5"/>
              &lt;cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
              &lt;recoverlInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
              &lt;cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              &lt;recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              &lt;printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
              &lt;undeployProcesses select="TestXPath"  type="retired" revision="all"/>
             &lt;undeployProcesses select="Sample.*" type="all" revision="2.0"/>
             &lt;undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
         &lt;!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->
         &lt;!--example date format "yyyy-MM-dd"   "1994-11-05"-->
          &lt;purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          &lt;purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          &lt;purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
          &lt;purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
          &lt;purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>
          &lt;purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
          &lt;purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
         &lt;purgeInstances/>
        &lt;/manageDomain>
      &lt;/serverAdmin>
    &lt;/target>
&lt;/project>

Comments (11)

Terry Hagan:

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

Ramkumar Menon:

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

rb:

I am getting following error

java.lang.NoClassDefFoundError: com/oracle/bpel/client/IInstanceConstants
I'm running OAS/BPEL 10.1.3.1

Thanks

Ramkumar Menon:

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

denf:

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

Bhargavi Ch:

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

Mingsheng Xie:

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

Steve Wall:

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

Steve Wall:

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

Guido Mueller:

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

Rafael:

Hi,

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

Thanks.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on November 26, 2007 5:44 PM.

The previous post in this blog was Customizing any BPEL Project Artifact using <customizeDocument>.

The next post in this blog is Scanning text files using java.util.Scanner.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle