Tuesday, October 29, 2013

Integrating BAM with BPEL in SOA 11g

Oracle Business Activity Monitoring (BAM) provides ability to create real time dashboards. BAM can act as a centralized monitoring framework across enterprise application integrations. It can pull data from critical points of the business process flow and display those KPIs in real time reports/alerts. With this post I would like to show how simple it is to integrate BAM with BPEL processes (won't get into step wise details for same as there are Tutorials available on OTN and web for the same) . There are 2 ways of integration BAM with BPEL in SOA 11g:

  •  Using BAM adapter 
  •  Using Sensor/Sensor Action inside BPEL.
First and foremost login to your BAM console (http://hostname:port/OracleBAM ) and navigate to the BAM Architect to create the Data Object.











Designing the data object is critical because that determines what exact fields we want to capture from BPEL and send it across to the BAM Active Data Cache.









Next step is to navigate to the BAM Active Studio and create your real time report using the Data Object created above. Active Studio provides various report templates which you can incorporate to build interactive real time dashboards like Pie-Charts, Bar Graphs etc. Based on the requirement these can be designed.

















Once the report is ready and saved, next step is configuring the BAM adapter on the Weblogic Admin console of the SOA server where BPEL code runs (assuming BAM and SOA are running on different servers).

On Admin console, navigate to Deployments-OracleBAMAdapter - Configuration - Outbound Connection 

Pools and expand oracle.bam.adapter.adc.RMIConnectionFactory and click on eis/bam/rmi  (you can use your own JNDI name instead of using the default JNDI).









Once saved, redeploy the BAM adapter for the changes to take effect.

Next step is to move to Jdeveloper and open the BPEL code in the Monitor perspective. Create a BAM sensor variable and assign a sensor action to the same. Inside the orchestration flow you can assign appropriate values to the BAM sensor variable.




































BAM sensor action defines what kind of operation we want to perform. Here we are sending the data to the BAM Data Object created earlier (establish a connection to the BAM server from Jdeveloper to access the DO). The Mapper file maps elements from the BAM sensor variable to the Data Object fields.

Once the code is deployed and BPEL instances are initiated you can navigate back to BAM console and click on Active Viewer - Select your report and watch it get updated in Real-Time with data sent from BPEL. Below is a sample custom report created based on the above Data Object.












These reports have additional capabilities which can be enabled on them like Drill Down feature which lets you click on the Pie Chart/Bar graph and get additional details about that specific data set.

Apart from these custom reports, BAM also ships with an Out-Of-The-Box report feature called Monitor Express which helps in real time composite instance monitoring. Single click enablement from Jdeveloper by switching to Monitor perspective of .bpel file and selecting Monitor Configuration from top left and selecting the specific mode we want to monitor. We can monitor scope level activities or entire BPEL level.

The setup steps which need to be done from back end (BAM server) are :
  • Edit the SOA_HOME/bam/config/BAMICommandConfig.xml and set below 4 properties
  1. ICommand_Default_User_Name
  2. ICommand_Default_Password
  3. ADCServerName
  4. ADCServerPort
  • Next navigate to SOA_HOME/bam/samples/bam/monitorexpress/bin
  • Set JAVA_HOME and run the setup.sh. This script will load the required reports and data objects for the Monitor express dashboard.
You should see something similar to below once this is enabled at runtime.It helps to find how many instances completed/faulted, average processing time of the composites, fault details etc.















BAM is a very powerful and useful feature available from the Oracle SOA stack and can help in setting up Enterprise wide monitoring framework. Hope this post provides a basic understanding of how it can be easily implemented in SOA based integrations.

Sunday, September 15, 2013

Working With Weblogic JMS Bridge

Weblogic messaging bride is a type of forwarding mechanism for JMS messages which can be used to transfer messages between two different domains of weblogic server. Basically the bridge has a Source Destination and a Target Destination which used along with JMS adapter helps to send the messages from one place to other. In this blog post have captured some of the configuration steps for JMS bridge to work:

1. Create a persistent store 
In Admin console; Click Lock and Edit and Under Persistent Stores ; Select New ; Create  FileStore
Name the store and target it to a specific server and finally activate the changes.









2. Create a JMS Server
In Admin console ; Click Lock and Edit and Under JMS Servers ; Select New
Set a name and select the corresponding FileStore and set the target to a specific server and after finishing, finally activate the changes

3. Create JMS Module
In Admin console ; Click Lock and Edit and Under JMS Servers  ; Select New
Click Next and Target it to the Servers and again click next. In the below page select the Check Box and click finish.







Click on the JMSModule and navigate to the Subdeployments page and click on New. Select a name and also target it to the JMS servers created earlier.

4. Create Connection Factory













Provide Name and JNDI name leaving rest fields as default and in next page click on Advanced targeting and select the subdeployment created earlier












5. Create Queue
Next create a Distributed JMS queue providing name and JNDI and under Advanced targeting, select the subdeployment created. Once finished activate the changes.











6. Create JMS Bridge Destinations
First create the source bridge destination.
In Admin console ; Click Lock and Edit and Under JMS Bridge Destinations ; Select New 
Provide the below details:
Connection URL: t3://source hostname:port/
Connection Factory JNDI Name: 
Destination JNDI Name: 

Click on OK and then click on source bridge destination name and ensure that the Weblogic credentials are correctly set there. This would be source server/domain credentials from where messages will be read.

Similar fashion create a target bridge destination and provide corresponding details.

NOTE: If weblogic is installed on a clustered server, the Connection URL format will be:
t3://node1 hostname:port,node2 hostname:port

Once done activate changes.

7. Create JMS Bridge
In Admin console ;Click Lock & Edit and Under Bridges ; Select New.
Provide name, select the corresponding source and target JMS destinations and finally click on Finish.

If all configuration is correct, we should see the below status for the JMS bridge under Monitoring tab.









NOTE :
For the XA Adapter to work the following file has to be deployed to Weblogic with name
jms-xa-adp  from /MW_Home/wlserver_10. 3/server/lib/jms-xa-adp.rar
Else the JMS bridge may give an error  "WARN: Failed to find the source/target adapter "

Apart from the JMS bridge configuration, need to create the corresponding JNDI name under deployments which will be used at runtime and this should be have the correct Connection factory(created in step4) configured in it.

The same JNDI name configured above will be used at design time while configuring the JMS adapter in Jdeveloper. Also the target destination name (JMS queue created in step5) will be configured in JMS adapter.

Tuesday, April 9, 2013

SOA 11g: Managed server error "weblogic.messaging.kernel.KernelException"

Recently came across an issue where the Managed servers were failing with below error. Even though servers start and come to running mode, but the JMS queues are not showing up in admin console under JMS Servers->Monitoring -> Active Destinations


<Error> <JMS> <BEA-040123> <Failed to start JMS Server "JMS_DEV_SERVER1" due to weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Ignoring 2PC record for sequence=4706 queue=57 because the element cannot be found.
weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Ignoring 2PC record for sequence=4706 queue=57 because the element cannot be found
        at weblogic.jms.backend.BackEnd.open(BackEnd.java:1008)
        at weblogic.jms.deployer.BEAdminHandler.activate(BEAdminHandler.java:200)
        at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:239)
        at weblogic.management.utils.GenericServiceManager.activateDeployment(GenericServiceManager.java:131)
        at weblogic.management.internal.DeploymentHandlerHome.invokeHandlers(DeploymentHandlerHome.java:632)
        Truncated. see log file for complete stacktrace

This issue was after effect of the JMS file persistence store hitting 100% space utilization. As a result of which it got corrupted and was causing the JMS servers to fail while starting/activating.

To workaround this error, go to the Persistence File Store location (local/Shared SAN storage) and rename the existing *.DAT files to _bkp (say). Then go ahead and restart the managed servers. Now servers should come up fine without any issues/errors.

Oracle Metalink Note 1473826.1 "FileStore getting corrupted and WLS is unable to initialize JMS leading to BEA-040123 " suggests applying a Weblogic patch for Bug13900234. I haven't tried applying this patch but if issue persists inspite of workaround you can try this option as well.

Saturday, April 6, 2013

Automating SOA 11g Admin tasks using WLST

WLST (Weblogic Scripting Tool) is a powerful feature for Weblogic administrators who want to automate most of their day to day operational tasks. This was initiated back in the BEA Weblogic 8.1 days for standalone weblogic server administration. And since Oracle SOA Suite 11g is now based on Weblogic server, this tool has become handy for SOA suite administrators.

There are lot of good learning materials available online for people getting started with WLST apart from the standard Oracle documentation. Few noteworthy ones are mentioned below. These links provide some nice examples with sample code which you can use based on your needs.

With this post I just wanted to give an overview on the different use cases where WLST can be used and how it eases lot of the operational tasks for SOA suite admins.

Common Use Cases 
  • Monitoring STUCK threads/Hogging threads 
  • JMS thread pool monitoring
  • Retiring/Activating SCA composites
  • Enabling/Disabling OSB proxy/business services
  • Deploying SCA/OSB code
  • Deploying/Updating other resources like JMS queues, JDBC datasources etc.
  • Pausing/Resuming consumption/production on JMS queues
  • Moving messages between JMS servers
  • Generating Thread dumps and sending email alerts.
The main thing about working with WLST is understanding of how to navigate the configuration/runtime management beans(MBeans) and how to change the MBean attribute values.


You can either directly connect to the WLST command prompt and execute the necessary commands after connecting to the runtime environment. An example shown below for retiring a SCA

  cd mw_home/Oracle_SOA1/common/bin
  ./wlst.sh

  Initializing WebLogic Scripting Tool (WLST) ...
 
  Welcome to WebLogic Server Administration Scripting Shell
 
  Type help() for help on available commands
 
  wls:/offline> connect ("username","password","t3://admin_hostname:port")
  
  Connecting to t3://admin_hostname:port with userid username ...
  Successfully connected to Admin Server 'AdminServer' that 
  belongs to domain 'SOA_DOMAIN'.
 
  Warning: An insecure protocol was used to connect to the
  server. To ensure on-the-wire security, the SSL port or
  Admin port should be used instead.

  wls:/SOA_DOMAIN/serverConfig> sca_retireComposite("listen address",
  "username","password","sca name","sca version",partition="partition_name")

The other way to execute is by writing WLST scripts (.py extension) which are similar in structure to Python language and include a lot of Python as well as Jython (Java implementation of python) libraries. Next you write some shell script (.sh) which invokes these .py files and can schedule the same on the crontab at specific intervals.

The shell script (.sh) basically sets the environment (CLASSPATH and PATH) by calling setWLSEnv.sh and then running the WLST script by calling it as below.

   java weblogic.WLST xxxx.py