Wednesday, 10 July 2013

IBM Business Process Manager - Exporting Snapshots using Scripts

Having just gone through this process, I wanted to write up my notes for future reference.

The objective is to export a process application snapshot to a file on disk, without using a web browser.

(A) Start WSAdmin

$ cd /opt/IBM/WebSphere/AppServer/profiles/dmgr/bin/
./wsadmin.sh -host processcenter01.uk.ibm.com -port 91302 -user tw_admin -password ******

Notes

(i) You need to connect to one of the application server JVM(s) running the BPM workload ( i.e. AppTarget cluster ) rather than the Deployment Manager, thus SOAP port will NOT be the normal used for DM-related wsadmin tasks
(ii) You need to authenticate as a BPM user i.e. tw_admin or equivalent, rather than the WAS/cell administrator account; we're running a BPM task, rather than a "pure" WAS task

(B) Export the snapshot

wsadmin> $AdminTask BPMCreateOfflinePackage {-containerAcronym HSS -containerSnapshotAcronym 7.5.1 -containerTrackAcronym Main -serverName ProcessServer01 }

Notes

(i) Note that the target Process Server needs to have been "registered" as an off-line Process Server on Process Center ( via Servers > Add a New Offline Server )
(ii) The Server Name used to "register" the server e.g. ProcessServer01 is what is used in the wsadmin script above

This should return: -

BPMCreateOfflinePackage passed.

In one case, the export took rather a long time ( ~60 minutes ), because the snapshot contained lots of toolkit snapshots ), and resulted in a 20 MB+ file.

Therefore, I needed to increase com.ibm.SOA.requestTimeout ( either via soap.client.props or via an override file )

(C) Generate a ZIP file containing the snapshot

wsadmin> $AdminTask BPMExtractOfflinePackage {-containerAcronym HSS -containerSnapshotAcronym 7.5.1 -containerTrackAcronym Main -serverName ProcessServer01 -outputFile  /tmp/hss_snapshot1.zip}

This should return: -

BPMExtractOfflinePackage passed.

resulting in: -

-rw-r--r-- 1 wasadmin1 wasadmin1 502418 Jul  9 16:24 /tmp/hss_snapshot1.zip

Troubleshooting 

If you see: -

[09/07/13 15:51:59:296 BST] 00000020 PALAdminComma I   BPMCreateOfflinePackage failed due to: null
                                 java.lang.NullPointerException
        at com.ibm.bpm.pal.commands.impl.internal.BPMCreateOfflinePackage.execute(BPMCreateOfflinePackage.java:63)
        at com.ibm.ws.management.cmdframework.impl.RemoteCommandMgrImpl.adminCmdExecute(RemoteCommandMgrImpl.java:335)
        at com.ibm.ws.management.cmdframework.impl.RemoteCommandMgrImpl.execute(RemoteCommandMgrImpl.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)


it is likely that the offline server has NOT been added to Process Center ( via the Servers tab ) - see above

If you see: -

WASX7015E: Exception running command: "$AdminTask BPMCreateOfflinePackage {-containerAcronym HSS -containerSnapshotAcronym 7.5.1 -containerTrackAcronym Main -serverName gbrdsr000000073_base-bpmPCapp01-server01 }"; exception information:

javax.management.MBeanException

com.ibm.websphere.management.cmdframework.CommandLoadException

java.io.IOException: java.io.IOException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http:///com/ibm/websphere/management/cmdframework/commanddata.ecore' not found. (file:///opt/IBM/WAS/wasadmin1/app/profiles/dmgr/Command.xmi, 2, 336)


check the SOAP port being used - it should be the SOAP port of one of the managed nodes NOT the DMGR - see above.

If you see: -

WASX7015E: Exception running command: "$AdminTask BPMCreateOfflinePackage {-containerAcronym HSS -containerSnapshotAcronym 7.5.1 -containerTrackAcronym Main -serverName ProcessServer01 }"; exception information:

java.lang.Exception: java.lang.Exception: Server gbrdsr000000073_base-bpmPCapp01-server01 doesn't exists in Proces Center.


ensure that the target Process Server is registered within Process Center as an off-line server, via Process Admin > Servers > Add a New Offline Server

If you see: -

WASX7015E: Exception running command: "$AdminTask BPMCreateOfflinePackage {-containerAcronym HSS -containerSnapshotAcronym 7.5.1 -containerTrackAcronym Main -serverName ProcessServer01 }"; exception information:

java.lang.Exception: java.lang.Exception: You are not authorized to deploy this snapshot


ensure that you're running wasadmin as a BPM, rather than WAS, user e.g. tw_admin or equivalent

With thanks to this article: -


for the overall process, as well as the IBM Information Center: -




3 comments:

raj.chaudhary said...

If I do snapshot export from Process Center (for an app ~16MB), would it take same amount of time to export (~ 20mins)

raj.chaudhary said...
This comment has been removed by the author.
Dave Hay said...

@Raj - please check this IBM Technote: -

Exporting large applications from IBM Business Process Manager (BPM) might take over an hour

as it explicitly covers issues of this nature, regards, Dave

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...