Good day!
By the nature of the work (Documentum developer), I was faced with the need to debug the processes that I create in Process Builder. Found an easy way to do this. And I would like to share this knowledge with Documentum developers, who are certainly present at Habré.
Introduction
Consider the process of local debugging method caused by activities in Process Builder (PB) in mode in Debug. The reasons for this are obvious - to debug and check for minimal operability of the methods, you do not need to “flood” them into the Java Method Server (JMS) with its restart. And it’s okay if only you work with him alone, and if several people at the same time develop their methods?
What do you need?
Process Builder version 6.6 and higher (tested and at 6.7). IDE with remote debug support.
Add PB startup parameters for debug mode -Xdebug -Xnoagent -Djava.compiler = NONE -Xrunjdwp: transport = dt_socket, address = 4444, server = y, suspend = n. Since after this the launch line has become too long and does not fit in the shortcut (here we are talking about Windows 7), then you need to create a bat-file to start PB. It will contain the following lines:
cd "C: \ Program Files \ Documentum \ bpm \ classes"
"C: \ Program Files \ Documentum \ jreForPB \ bin \ javaw.exe" -Xdebug -Xnoagent -Djava.compiler = NONE -Xrunjdwp: transport = dt_socket, address = 4444, server = y, suspend = n -Xms128m -Xmx512m - Dfile.encoding = UTF-8 -Dawt.useSystemAAFontSettings = on -cp ".; Lib \ bpm.jar; .. \ .. \ dctm.jar; C: \ Documentum \ config" WorkflowEditor -locale en_US
')
All methods that will run in PB debugging mode (and not just those that will be debugged in the IDE!) And that use the session in DQL queries should receive it not through the workitem.getSession () method, but completely through the connection to the content server . This is due to the fact that the DfQuery object, when executing a DQL query, uses a specific ISession class, which is only present in the DfSession object. PB, when debugging, uses its IDfSessionManager and IDfSession implementations. In which class ISession is missing. As a result, when using the session object obtained using workitem.getSession (), DfQuery generates an error of class reduction (ClassCastException).
Copy the jar files with the code of the methods being debugged and the dependent classes (of course, except for DFC) in the <BPM DIRECTORY PATH> directory bpm \ classes \ custom \. (eg C: \ Program Files \ Documentum \ bpm \ classes \ custom \)
The methods used must be installed on the content server. Those. you need to create a method artifact in Composer with the correct path to the method class and install it on the content server.
In PB, create a process with automatic activity that will execute the method being debugged.
Launch
For debugging itself, you need to run PB with the above parameters. Join the IDE to the debug port. Put a breakpoint on the desired method. In PB, start the process being debugged in debug mode. (Debug process button) As soon as the process on the PB screen reaches the execution of the automatic activity that starts the debugged method (which has a breakpoint), the debugging process starts in the IDE. Everything after that you can debug the code as usual.
Restrictions
The behavior of both Java methods and activities in debug mode in PB is different from what happens during live execution on BPM and JMS. This is expressed not only by the specific implementation of the session. I also noticed the inability to perform activities to start a child process.