Camunda BPM – Manual Retry

The Camunda BPM is a lightweight, opensource BPM platform (See here: https://camunda.com/bpm/features).

The “Cockpit” application within Camunda is the admin dashboard where deployed processes can viewed at a glance and details of running processes are displayed by the process instance ids. Clicking on a process instance id reveals runtime details while the process is running – process variables, task variables etc. If there is an error thrown from any of the services in a flow, the Cockpit application allows “retrying” the service manually after the coded automatic-retries have completed.

The steps below show how to retry a failed process from the Cockpit administrative console

Manual Retry

From the Process Detail Screen select a failed process (click on the GUID link)

Then on the Right Hand side you should see under “Runtime” a “semi-circle with arrow” indicating “recycle” or “retry” – click on this

This launches a pop-up with check-boxes with IDs for the failed service tasks and option to replay them. Notice these are only tasks for “this” instance of the “flow”

After the “Retry” is clicked another pop-up indicates the status of the action (as in “was the engine able to process the retry request”. The actual Services may have failed again)

 

How to export XWindows display using PUTTY

Introduction

If you use PUTTY tool to ssh into a remote host and are trying to run a graphical tool …like say Mozilla or XClock or some Java Swing based installer that has screens you navigate …then you need to EXPORT your DISPLAY. Lets assume you are doing this from a Windows machine to a remote host (this applies to a Linux/Unix machine to a remote host too – where you are using “ssh” and a local xserver)

Get XServer on your local (Windows) machine

I got XMING from here ….

  http://transact.dl.sourceforge.net/project/xming/Xming/6.9.0.31/Xming-6-9-0-31-setup.exe
  • Start a command prompt and do ipconfig /all and see your IP Address
        Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : mycompany.com.au
        Description . . . . . . . . . . . : Broadcom NetXtreme 57xx Gigabit Controller
        Physical Address. . . . . . . . . : FX-XX-...
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : xx.xx.xx.xxx
        Subnet Mask . . . . . . . . . . . :
        Default Gateway . . . . . . . . . :
        DHCP Server . . . . . . . . . . . :
        DNS Servers . . . . . . . . . . . :

        Primary WINS Server . . . . . . . :
        Lease Obtained. . . . . . . . . . :
        Lease Expires . . . . . . . . . . :
  • Start a Putty Client, before you connect to your VM
      • Check/Select “X11 Forwarding” in Putty (see image below) by selecting check-box under “Category: Connection -> SSH -> X11” in the Left-hand panel and “SSH X11 forwarding” in the Right-Hand Panel

      • Check/Select “Port Forwarding” in Putty (see image below) by selecting check-box under “Category: Connection -> SSH -> Tunnels” in the Left-hand panel and “SSH Port forwarding” in the Right-Hand Panel

  • Putty into your VM and set the DISPLAY variable, I did
    • "export DISPLAY=<my ip address>:0"

Notes on Webcenter PS4 Install – Part II

Installing Webcenter ….

…okay I got a little stuck here because of the incorrect JDK version.  I extracted the “ofm_wc_generic_11.1.1.5.0_disk1_1of1.zip” file using “unzip <filename>” and it created 3 “DISK” folders. I went under “Disk1/bin/” and did

[oracle@xxxxxDisk1]$ ./runInstaller
Starting Oracle Universal Installer...

Checking if CPU speed is above 300 MHz.    Actual 2660 MHz    Passed
Checking Temp space: must be greater than 150 MB.   Actual 23647 MB    Passed
Checking swap space: must be greater than 512 MB.   Actual 4031 MB    Passed

Continue? (y/n) [n] y

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-05-27_03-33-20AM. Please wait ...
Please specify JRE/JDK location ( Ex. /home/jre ), <location>/bin/java should exist :/opt/app/Oracle/Middleware/jdk160_24

After a little while it displayed the following error in the Xterm window ….

[oracle@xxxxxxDisk1]$ java.lang.UnsatisfiedLinkError: /tmp/OraInstall2011-05-27_03-46-01AM/oui/lib/linux64/liboraInstaller.so: /tmp/OraInstall2011-05-27_03-46-01AM/oui/lib /linux64/liboraInstaller.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)

The reason for this was the incorrect JDK version (Using a 32 bit when I need a 64 bit – “architecture word width mismatch.

Check your JDK build in the following manner:

Goto your Java bin folder, say /…/jdk160_24/bin

Run the file command in the bin folder …i.e. “file java” in the bin folder.

[oracle@pdemora140rhv bin]$ file java"
 java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

The ELF 32-bit LSB executable tells you the build of the “java” binary.

So now that we know that the versions are incorrect, we down load the right Weblogic installer and JDK from the following sites

Next Steps…

  • Install 64bit JDK
  • Install Weblogic using 64bit jdk … use “java -jar”
  • Install the Webcenter Product (11.1.1.5)
  • Run config.sh to create a Domain – goto ORACLE_HOME/oracle_common/common/bin  & make sure display is exported (see earlier post)
  • Create the Webcenter Spaces weblogic domain
    • keep JDBC url handy (details coming soon on how to configure the different schema logins with the same JDBC url and password)
    • make sure you select the Administration Server settings and select the machine for Adminserver and the Webcenter managed server (this is so that the node manager can start it)
  • Change the managed server startup script under DOMAIN_HOME/bin folder to use a different tmp folder or run Admin server and select “No Stage” for Webcenter spaces server
  • Run the SetupNM script
  • Start the NodeManager
  • Start the Weblogic Admin Server
  • Goto http://<adminserver ip>:7001/console to deploy the Admin Console
  • Navigate to Servers -> Webcenter Spaces server and configure the options for Deployment -> No Stage
  • Start Webcenter Spaces server
  • Goto http://<webcenter spaces ip>:8888/webcenter to launch the application.  If the webcenter spaces startup logs show “127.0.0.1” or “localhost” then goto the Spaces Server settings in Admin Server and you will find “localhost” configured for the server’s listening IP.  Remove this (make this field blank) to have the spaces server listen to the machine’s configured IP

And when you are done this is the result …

 

Testing Data Logging RESTful Webservice – using Python and Thingsspeak

Your windows “TaskManager” just went LIVE!

Imagine being able to broadcast your CPU/MEM/Disk capacity data or data from a hardware device or appliance (Arduino based sensor) to a service. Now imagine being able to view this data in a live graphical manner and being able to share it with the rest of the world (power to correlate data sets).

This well written article at http://www.australianrobotics.com.au/content/how-talk-thingspeak-python-memorycpu-monitor  inspired me to test out this capability and this post is a testament to the ease with which it can be done and a log of some minor modifications I had to make to make the example work with the latest version of Python (3.2).

Thingsspeak provides a data logging webservice with RESTful APIs to update the data.  I outline the steps on how to use this service and provide links to live feed from my machine.

Steps:

CPU

Memory

The following code was obtain from https://github.com/sirleech/thingspeak and modified to use the python 3.2 libraries

 #--------------------------------------------------------------------
 #
 # Original Source: https://github.com/sirleech/thingspeak
 #--------------------------------------------------------------------
 import http.client, urllib.parse
 from time import localtime, strftime
 # download from http://code.google.com/p/psutil/
 import psutil
 import time
def doit():
 cpu_pc = psutil.cpu_percent()
 mem_avail_mb = psutil.avail_phymem()/1000000
 params = urllib.parse.urlencode({'field1': cpu_pc, 'field2': mem_avail_mb,'key':'XBYEL45GOXF7F760'})
 headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
 conn = http.client.HTTPConnection("api.thingspeak.com:80")
try:
 conn.request("POST", "/update", params, headers)
 response = conn.getresponse()
 print (cpu_pc)
 print (mem_avail_mb)
 print (strftime("%a, %d %b %Y %H:%M:%S", localtime()))
 print (response.status, response.reason)
 data = response.read()
 conn.close()
 except:
 print ("connection failed")
 print (response.status, response.reason)
#sleep for 16 seconds (api limit of 15 secs)
 if __name__ == "__main__":
 while True:
 doit()
 time.sleep(16)

Weblogic Application Deployment Error – “Changing the source location…”

Stack Trace:

[01:41:48 PM] Weblogic Server Exception: weblogic.management.ManagementException: [Deployer:149007]New source location, '\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\app\.ear', cannot be deployed to configured application, ''. The application source is at 'JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs\'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[01:41:48 PM]   See server logs or server console for more details.
[01:41:48 PM] weblogic.management.ManagementException: [Deployer:149007]New source location, '\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\app\.ear', cannot be deployed to configured application, ''. The application source is at 'JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs\'. Changing the source location is not allowed for a previously attempted deployment. Try deploying without specifying the source.
[01:41:48 PM] ####  Deployment incomplete.  ####
[01:41:48 PM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)

Reason:

I got this error when I did the following:
– first deployed the application to the embedded weblogic server by right-clicking on a JSF/JSP file
– then deployed the same WAR (and later the EAR) to the server by right-clicking on the Project

So instead of starting the embedded server using Run -> StartServerInstance in JDev, I had tried to start it by launching a JSF/JSP page and then tried to deploy the app onto it (why? I was testing a portlet deployment) …which apparently is bad because you are trying to deploy the same WAR/EAR to the two location using two different ways.

Workaround:

– Shutdown the embedded server
– Start it back up using Run -> StartServerInstance
– Deploy the WAR by right clicking on the project

Installing ofm_rcu_win_11.1.1.4.0 over an older version

Errors Observed:

MDS-00912: MDS repository is incompatible with the middle tier. Repository version "11.1.1.55.16" is older than minimum repository version "11.1.1.56.27" required.

 at oracle.mds.config.PConfig.loadFromBean(PConfig.java:690)
 at oracle.mds.config.PConfig.<init>(PConfig.java:499)
 at oracle.mds.config.MDSConfig.loadFromBean(MDSConfig.java:707)
 at oracle.mds.config.MDSConfig.loadFromElement(MDSConfig.java:764)
 at oracle.mds.config.MDSConfig.<init>(MDSConfig.java:420)
 at oracle.mds.core.MDSInstance.getMDSConfigFromDocument(MDSInstance.java:2055)
 at oracle.mds.core.MDSInstance.createMDSInstanceWithCustomizedConfig(MDSInstance.java:1197)
 at oracle.mds.core.MDSInstance.getOrCreateInstance(MDSInstance.java:580)
 at oracle.adf.share.config.ADFMDSConfig.parseADFConfiguration(ADFMDSConfig.java:137)
 ... 57 more
Caused by: oracle.mds.exception.MDSExceptionList: MDS-01329: unable to load element "persistence-config"
MDS-01370: MetadataStore configuration for metadata-store-usage "OWSM_TargetRepos" is invalid.
MDS-00912: MDS repository is incompatible with the middle tier. Repository version "11.1.1.55.16" is older than minimum repository version "11.1.1.56.27" required.

Workaround:

Oracle Fusion ADF – JSF Rich Text and Table Component (Data Input and Refresh)

Goal:

The ADF framework is quite powerful and you should be able to quickly create a page that will let you do Partial Page Rendering (PPR) in no time … there are plenty of good examples online about  how to do this (and you should be able to work things out on your own in no time).

However, my problem was that by using out of box “Partial Triggers” property on the table component, I was unable to “re-query” the underlying table model.  Instead, I used an explicit call to the underlying UI controls and ended up learning quite a bit in the process.

Build a very simple example with a basic java “Map” data model to accept “key/value” data pair as inputs on a page and display the growing “list”/”map” as a table below. Use framework based or custom built Partial Page Rendering (PPR) to refresh the table and tie this to the “Submit” button on the page.

The example below should walk you through a very basic ADF web application build using plain java classes to demonstrate MVC interaction in this framework.

Please Note: In an effort to quickly pen down my observations, the first draft might be not-so-polished.  I will work on refining this post over time.

Here’s what I was thinking of building/experimenting with:

<img class="alignnone size-full wp-image-363" title="Sample Page – Table from a List” src=”https://techiecook.files.wordpress.com/2011/02/page-view.jpg” alt=”” width=”489″ height=”285″ />

Outline

The application is a very simple, two project fusion web app. It has a Model and View project – the model was started from a POJO Service class (I don’t use any patterns to ensure that multiple instances of the service class refer to the same data model etc – it is very basic).

Here’s how you might build a service class … and after you are done – right click and create a Data Control

…. right click on the Service Java Class, to create/update the DataControl,  and select “Create Data Control”

The overall project will look something like this:  Data Controls built from the POJO service will be available to the UI via Data Bindings. The page will consist of 3-4 components (two Rich Input Texts, One Button and One Table). The page (and its 3-4 components) will be backed by a custom bean (Managed Bean) , that is …. there will be a “Java class” with RichInput Text fields, RichTable field and methods that accept ValueChangedEvent etc. There will be a definition in the ADF config file about this class which will tie this to the JSF page so that details of the fields are available to the class (as you change it on the screen) and when you click the button component on the screen it invokes a method on the class.

PPR – Using out-of-box features

As explained above, the page bean has the meat of the logic. We could have entirely avoided this using out-of-box PP, this is done by clicking on the Rich Component (you want to be refreshed) and  under “Properties -> Behavior” selecting “Partial Triggers” to specify a trigger that will cause a partial page refresh for this component.

Once you click on Edit – the wizard opens and you can use it to select “which component causes the trigger” …

PPR – Using custom method in page bean

The bean class,  notice:

  • the fields and  their accessors/mutators
  • the methods with ValueChangeEvent – these are tied to the RichTextInput components changing
  • The “cb3_action” method – this one is tied to the “button” on the page.  This calls the “refresh table”. Details on the method’s comments.

Code to handle the button event:

public String cb3_action() {
 // Should be final Strings in a shared class
 String insertMethodInPOJO = "insertIntoStringTable";
 String paramNameForKey = "key";
 String paramNameForValue = "value";

 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Steps to execute a method as defined in a Data Control
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 BindingContainer bindings =
 BindingContext.getCurrent().getCurrentBindingsEntry();
 OperationBinding operationBinding =
 bindings.getOperationBinding(insertMethodInPOJO);
 // mKey and mValue are instances of RichInputText class
 operationBinding.getParamsMap().put(paramNameForKey, mKey.getValue());
 operationBinding.getParamsMap().put(paramNameForValue,
 mValue.getValue());
 Object result = operationBinding.execute();

 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // REFRESH the table
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 refreshTable();

 if (!operationBinding.getErrors().isEmpty()) {
 return null;
 }

 //do Something with the errors
 return null;
 }

The table refresh code

/***
 * REFRESH Table Model:
 *    Grab the Collection Model, Get the JUCtrlHierBinding, Execute Query to force refetch
 */
 public void refreshTable() {
 CollectionModel cm = (CollectionModel)richTableBinding.getValue();
 JUCtrlHierBinding tableBinding =
 (JUCtrlHierBinding)cm.getWrappedData();
 tableBinding.executeQuery();
 }

Define/Assign Custom Paylod for your BPEL Human Task

When you create a BPEL Human Task, the payload type is not specified by default. You can specify a simple type from the drop down on the “Data” menu item on the BPEL Task Editor page.

In a BPEL Task, see which menu item to select ("Data") to change the payload type

By default if you have not assigned a menu item then your “payload” element is not defined in your BPEL Task’s Schema. The BPEL Human Task references the “ApproveTaskWorkflowTask” schema, which has an element called “Payload” which is imported from “ApproveTaskPayload.xsd” schema definition file.


When the payload is not defined the structure is show below in the subsequent images…. so in the “ApproveTaskWorkflowTask.xsd” we have an empty payload

…and in the “ApproveTaskPayload.xsd” we have

I created a simple schema for my Approval Process where the top-level element is “TimeSheet” (which as a list of TimeSheetDays, which have details in them).  I wanted to use this schema as a payload….

I will use this in the BPEL Human Task by choosing “Other Payload” in my “Data” menu item

Select the schema you want …

Assign a name to refer to this payload type by … you should see the Task -> Payload -> <name-you-gave> as the structure.

End result … your Task has your user defined type for a payload. Now you can add data to this from a BPEL flow or an external call (convert your Human Task to an invoke-able “Composite with Service Bindings” by selecting that option when creating the task).

To use the data you do the following:

Oracle Weblogic ADF – Application Module Datasource Connection

For a good idea about JDBC URL vs JDBC Datasource see:  http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcservices.htm#ADFFD1501

Configuring JDBC Datasource

According to Oracle “A data source is a vendor-independent encapsulation of a database server connection”.

When deploying an Oracle ADF application with a bc4j (Business Configuration) to a stand-alone Weblogic instance, you need to make sure your data-source is configured in your application and defined in your weblogic server.

FYI: The  “embedded” Weblogic Server (WLS) is the one that comes with JDeveloper i.e. the one that runs when you right click on a JSF page and click the play-button.  The “Stand-alone” Weblogic Server is something that you installed. So if you did not download Weblogic you can follow these links: [download from here ] and [install doc is here].

Once you have the stand-alone weblogic server up and running and have a database instance to connect to, go to the weblogic admin console http://<server-host&gt;:<server-port>/console and enter the admin login/password.  The default is “weblogic” and the password you supplied during the install process.

In the Weblogic admin console look at the menu items on the left side of the screen and under “Domain Structure” menu goto the “Services” node, expand it and then goto the “JDBC” node and expand that.  Click on the “Data Sources” child node of JDBC and you can see the configured data sources.  For example: In the image below you are seeing the datasources for my soa1_server WLS managed server instance and it has quite a few datasources configured.

Configuring Weblogic  Standalone server:

Steps to create a new data source are listed in the “Gallery” below … you need to go to through the Weblogic Wizard and enter your Database Url/Port.

Configuring the ADF Application:

Now you need to configure your ADF application to use this otherwise you may see errors like “password: null” etc. They are really vague messages but the stack trace tells the story – the Faces context tries to load the BC and the config cannot connect to a database because of missing or invalid connection properties.

Here are the steps for configuring your JDev Application … start with opening your Application Module XML (the Oracle editor for the XML opens up), select the “Configuration” tab and then set your datasource name there.

Java Fundamentals – Classes

It helps to look down from time to time and examine the very stuff we walk upon

I was reading code today (yes it would seem this is the only this I read these days), and I found something that puzzled me (and it should not have) :  “static class MyClass extends” – I know, I know! I should know what it means and I did take a good guess at it … “it means that the inner class is static and can be initiated from the top level class statically” – right?!  Well almost.  “okay ..”, I thought, “..what other unique ways of declaring a class do we have in Java? And why do we have them? How do we use them?!”

A little bit of googling let me to a great article on Java World [See JW Article On Static Classes] which talks in detail about the various way in Java Classes can be declared.

The JW Article Summary – Type of Java Class Declarations

There are 2 types of Java Class declarations – top level and inner. Inner classes can be Anonymous, Local, Member and Static Member.

  • Top-level Class:  The usual way of declaring a Java class, within a file which the name of the class.  Cannot declare this static. Class Name and Canonical class name are the same.
  • Inner Class: Classes defined within a top-level class
    • Anonymous Inner Class:
      • No name.
      • Instantiated only once.
      • You have seen these in Java Swing examples “new ActionListener(){…};” . You were implementing an interface using an anonymous class.
      • No class name
    • Local Class:
      • These are class declarations with a name, just like you would define a top-level class …except …
      • …they are declared within a “method block” in a top-level class
      • You can create as many instances but only within the method block
      • Outside the method you cannot access the class or instantiate it, just like a local var
      • Class Name and Canonical class name are the same
    • Member Class:
      • Just like member variables, these are classes declared within the top-level parent
      • …also just like member variables these are accessible through the instance of a parent
      • You cannot use the parent class to access these inner-classes, just like you cannot access non-static variables
      • Class Name is “Package.Parent.InnerClassName” and Canonical class name are of the form “Package.Parent$InnerClassName”
    • Static Member Class:
      • You use the static modifier when declaring the class
      • Declared within a parent class as an inner class
      • Accessible using the parent class or the parent instance (although this is discouraged)
      • Class Name is “Package.Parent.InnerClassName” and Canonical class name are of the form “Package.Parent$InnerClassName”

Hands-on Work

I created 5 top-level classes for each example and had the classes implement an interface which has a method called PrintDetails. I left the implementation of the print to the underlying inner classes and in a test harness I instantiated each of the five top-level classes and added them to a list.

After all the classes were added, I iterated through the list to invoke each interface’s print details.  Can you tell me what design pattern I have used here?

The examples and their implementation are given below. The readme.txt is a note that I keep for remember what I have learned about class declarations and static, member and local variables.  You can find this information on Sun/Oracle’s Java Fundamental tutorials.

Readme.txt

Implemented the examples for classes ... top-level, Anonymous Inner, Local, Member and Static Member.
Note: "static" does not do anything for the class like it does for the static variables
Class variables vs Object variables:
------------------------------------
-Static keyword makes a variable a Class variable
-It is then shared across all instances of the class
-Stored in one fixed memory location
-Any object can change the value, unless it is final
-Class variables can also be manipulated without creating an instance of the class
Static methods:
---------------
-to access Class variables or Static variables
-can be invoked using the ClassName or using the instance of the class (discouraged)
-cannot access instance variables
-cannot use 'this' keyword
Constants:
----------
-Variables declared using the "static" modifier and the "final" modifier are constants
-Their value cannot be reassigned in the program, compile time error results
-Compiler replaces the name of the variable with the value if a primitive type or a String is defined as a
constant. This is known as a compile time constant.

Sample Code