Wednesday, April 28, 2010

Oracle SOA 11g PS2 (patchset #2) is out!

This week new/updated releases are out:

See also:


http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html

Thursday, April 22, 2010

Create SOA 11g deployment only user

Creating a user that is able to deploy applications, Java and composites. Is done as follows

Logon to WLS Console

Create user

  • Click on 'Security Reams'
  • Click on 'myrealm'
  • Click on 'Users & Groups'
  • Click on 'New'
  • Enter Name:SOADeployUser
  • Enter Description: SOA Deployment user
  • Enter Password: ****
  • Enter Confirm: ****
  • Click on 'OK'
Add roles to user
  • Click on 'Security Reams'
  • Click on 'myrealm'
  • Click on 'Users & Groups'
  • Click on 'SOADeployUser'
  • Click on 'Groups'
  • Assign the following groups to 'SOADeployUser'
  • - Deployers
  • - Operators
  • - Monitors
  • Click on 'Save'

Saturday, April 10, 2010

Monitoring Java Virtual Machines

Apart of the default consoles that are delivered with the Oracle product; such as Weblogic Console, BPEL console, ESB Console, Enterprise Manager. We can also look 'under the hood' of the application server.

With the latest release of WebLogic, you proberly use Oracle JRockit as JVM. This JVM has its own console, JRockit Mission Control. If you are not using JRockit, because you are using another OS such HP or IBM, or you just stick to the Oracle/SUN JDK, then the following solution will help. A nice article is published by Olaf Heimburger describing both tools based on the 11g release.

Monitoring the behavior of the JVM can be done via the tool 'VisualVM'. The tool can be used directly on Java VM that are running on your local machine. By default it can connect to JVM's of version 1.6. If you are using a JVM of version 1.5 you should at the following Java properties during the startup.

The tool is able to connect to local JVM's as well remote JVM's. Connecting to a remote JVM, a daemon process must be running on the server to collect the data from the JVM and expose this for client applications.

Server Configuration


WLS 9.2 only

The Java parameters can be set in the arguments settings for each managed server.

Add the following Java option into the WLS 9.2 managed servers:

-Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false


After applying the Java settings, restart the managed server.

Create in the JAVA_HOME directory a policy file, that grants all permissions to the Java Statistic daemon process.

JAVA_HOME=/u01/appl/j1bplpe/product/wls/jdk150_12
export $JAVA_HOME

cd $JAVA_HOME/bin
vi jstatd.policy:
grant codebase "file:${java.home}/../lib/tools.jar" {
  permission java.security.AllPermission;
};

Now we can start the daemon process to collect the java runtime statitics.

Generic

The Jstat daemon process can now be started. In the next example it is started 'online'. I would recommend this, this process should not be running during normal production. Otherwise start the programm with 'nohup' and '&'.

cd $JAVA_HOME/bin
./jstatd -J-Djava.security.policy=jstatd.policy -p 1099

The daemon process is started, it connect to the JMX port 3333 and can be accessed with 'VisualVM' over port 1099 without having credentials or SSL.

Unix start script
cat start_jstatd.sh
#!/bin/bash

start_jstatd.sh
JAVA_HOME=/usr/lib/jvm/sun-java-1.6
export JAVA_HOME
nohup $JAVA_HOME/bin/jstatd -J-Djava.security.policy=./jstatd.policy -p 1099  &
echo $! > jstatd.pid
echo Java Stats Deamon started: `cat jstatd.pid`

stop_jstatd.sh
#!/bin/bash

JAVA_HOME=/usr/lib/jvm/sun-java-1.6
export JAVA_HOME

if [ -f "jstatd.pid" ];
then
  pid=`cat jstatd.pid`
  echo "killing jstatd with pid $pid"
  kill -9 $pid
else
  kill -9 `ps -ef | grep "jstatd" | grep -v grep | awk '{ print $2; }'`
fi

Client Configuration

At the client side, download the code latest version visualVM, this can be obtained from:

http://visualvm.dev.java.net

Unzip the ZIP file into a directory. In this directory you can start the the client tool to visualize the JVM. If Java 1.6 is installed on your workstation, the settings are already correct and we can start the application.

Linux:
        ./visualvm

Windows:
        visualvm.exe

The screen look like this.


Create a new Remote connection to the server you want. In this case we connect to the node #1 of my cluster via port 1099. This is the port number on which the jstatd daemon is listening.

Select the appropiate JVM, weblogic.Server., to view memory and thread information.


Garbage collection:



More information and documentation on this tool can be obtained via the website.

Thursday, April 08, 2010

SOA 11g: Migration FAQ / Best practice

Migration projects from SOA 10g to SOA 11g is not a walk-in-the-park. You should read the migration documentation for the SOA 11g migration carefully. During your migration you would run into behaviours that you did not expect.

Use fully qualified names
During configuraton of the SOA domain, make sure you use the fully qualified name as specified in your DNS server. Some servers are using the short-name that is binded to the localhost (127.0.0.x) IP adres.

BPEL Compiler stricter
WIth SOA 11g patch set #2, the SCA runtime engine is more stricter. During testing of your SCA, that was created with patch set #1, you could run into runtime 'Selection errors'. One case is that you should check your Assign and Switch cases. You could have programmed to select the first node of an XML message:

/outputCollection/Order/Orderline/price

During runtime this selection failes, multi-node result. You should chnage your code into

/outputCollection/Order/Orderline[1]/price

Use abstract services
A SOA 10g project can be migrated via JDeveloper. But it migrates 1:1. If the BPEL process is calling another BPEL process (10g), after migration the new 11g composite is still calling the BPEL 10g process. You must change this manually.
Alternatively you could use abstract WSDL. This will decouple the calling BPEL process. Therefore you must also make some changes in your BPEL or ESB services, before you migrate.

HTTP 503 error during deployment
Follow the instructions at http://soa-bpel-esb.blogspot.com/2009/08/oracletiptoolsidefabricdeploycommonsoar.html to solve this issue.

Error: TopLink deployment descriptor generation failed
During deployment you get this Toplink error. Please verify that reported problems are corrected and that the deployment descriptor path and name are valid.
The issue is in the JDeveloper .JPR file. An oracle.toplink.addin.TopLinkProjectSettings section is this file, remove the section and the deployment should work.

Composite WSDLs are not loaded during startup of JDeveloper
In some cases JDeveloper can not load the external WSDL that is used in your composite. This occurs when an composite.xml file is 'open' when you close JDeveloper the previous time. The workaround is, off course, to close all 'compiste.xml' tabs before shutting down JDeveloper.

BPEL Migration fails with special characters
If your 10g SOA project contains special characters like é or  ï, the project fails after migration. Remove these characters before migrating your projects.

RuntimeFault.wsdlcan not be found
The http://localhost:80/orabpel/xmllib/RuntimeFault.wsdl can not be found after migration. The location of these files are moved to the MDS. Change this location manually in your code to oramds:/soa/shared/bpel/RuntimeFault.wsdl

java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: null 
An error occurs when you are using the 'count' function with getVariableData. Use the function 'oracountNodes' instead of this one.

see also Metalink Note 1059573.1 APPLYING COUNT XPATH FUNCTION TO bpws:getVariableData RESULTS IN SELECTIONFAILURE FAULT

Selectionfailure on empty element
During a test activity such as string(bpws:getVariableData('creditcardLimit')) != '' will fail. This can be solved by using countNodes functionality: ora:countNodes('transactienummer') > 0

BPEL Preferences
Changing the BPEL preferences is now done via Enterprise Manager with the MBean browser. See the article.

http://eelzinga.wordpress.com/2009/10/28/oracle-soa-suite-11g-setting-and-getting-preferences/

java.lang.IllegalArgumentException
An error is generated:

"java.lang.IllegalArgumentException: Error occurred while attempting to retrieve message part ... from a normalized message payload with elements ..."

During migration of the ESB services that are not using a transformation for mapping the request and reply messages, the migration tool is NOT adding a Reply mapping. This only occurs when the request message and the reply message using different part names.

This can be solved by creating the Reply mapping manully via the assign 

Unable to register service.
After restart of the server you could get:

Unable to register service. oracle.fabric.common.FabricException: Error in getting XML input stream: : Response: '503: Service Unavailable' for url:
 

This occurs that the composite is pointing to a WSDL of another service. This pointer should be a abstract WSDL.

Base64 encoding/decoding does not compile
An error occurs "Error(17,39): Failed to compile bpel generated classes. failure to compile the generated BPEL classes for BPEL process ... The class path setting is incorrect. Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly..." This can be solved by adding importing the oracle.soa.common.util packaged instead of the com.collaxa.common.util
 

FTP adapter header variable

The FTP Adpater is using the bpelx:headerVariable as directory or filename setting. This variable can be set on the Invoke or Recevice activity via a property.

If I missed something or you have anything to add, please send me a mail or put it in the comments.


Sunday, April 04, 2010

AIA 2.4/2.5: Foundation Pack Quick Cluster Install

Installing AIA in a clustered environment is not a 'walk in the park'. Many documents exists from Oracle that describes various approaches to install AIA on a cluster. This article is written to have a simple straight forward installation and configuration.

Pre-requisites:

The AIA cluster installation is executed in 5 steps:
  • Step 1: Ensure that the SOA cluster is setup correctly
  • Step 2: AIA Software only install
  • Step 3: AIA Deployment and configuration preparation
  • Step 4: AIA Deployment and configuration execution
  • Step 5: AIA post configuration

Step 1: Ensure that the SOA cluster is setup correctly

The following are basic verification steps to ensure that your SOA cluster is setup correctly.
  • Navigating to the BPEL, ESB consoles successfully using the external Load Balancer URL as well as each of the internal virtual host.
  • Ensuring that the EM console shows all participating nodes in active state. There must be only one Active Design time. 
  • Ensure that ESB Design-time is completely up and running by accessing the following URL:
  • http://node1.vijfhuizen.com:7777/esb/dtStatus.jsp
  • http://node2.vijfhuizen.com:7777/esb/dtStatus.jsp 
  • These pages should return a true. Test this via both nodes. 
  • Deploying a sample BPEL process and a sample ESB process. And verify via the consoles on each node that the deployments exists. 
  • Change the state of the BPEL process on one node, e.x. Set state to retired. Verify on the other console that the state has been changed. 
  • Undeploy the BPEL process from this node. Verify on the other console that the BPEL process does not exists anymore.
Step 2: AIA Software only install
Install on both nodes the AIA Software only! Just run the AIA installer ant install the software only! It is recommened to install the software in a different  directory as the Oracle SOA 10g software, for example:
  • ORACLE_HOME: /app/oracle/products/10g/soa
  • AIA_HOME: /app/oracle/products/10g/aia
Step 3: AIA Deployment and configuration preparation

Add for each node the following java option, make sure all servers are down (opmnctl shutdown). Add the java option in the 'oc4j_soa' container.

vi $ORACLE_HOME/opmn/conf/opmn.xml
...
-Daia.home=/fs01/app/oracle/esbacc01/aia
...

Make sure indexing is enabled on th both Apache HTTP servers, apply this setting twice.

vi $ORACLE_HOME/Apache/Apache/conf/httpd.conf
...
<Directory />
Options FollowSymLinks MultiViews Indexes
...
<Directory "/app/app/oracle/product/10g//soa/Apache/Apache/htdocs">
Options FollowSymLinks MultiViews Indexes
...

Check the AIA configuration. With the AIA software only install, not all settings are correct:
vi $AIA_HOME/bin/aiaenv.sh
...
AIA_HOME=aia.home
ORACLE_HOME=oracle.home
AIA_INSTANCE=aiaapp.deploy.home
PLATFORM=platform
into
AIA_HOME=/app/oracle/product/oracle/10g/aia
ORACLE_HOME=/app/oracle/product/oracle/10g/soa
JAVA_HOME=$ORACLE_HOME/jdk
AIA_INSTANCE=/app/oracle/product/oracle/10g/soa/j2ee/oc4j_soa/applications
PLATFORM=ias_10g

Execute a chmod 775 on the ANT_HOME/bin/* oon beide nodes, to make the files executable.

chmod 755 $AIA_HOME/bin/*

Execute the following script on both nodes to enable the new settings.

source aiaenv.sh

Add heartbeat parameters to teh ESB config directory at the end of the file on both nodes:

vi $ORACLE_HOME/integration/esb/config/esb_config.ini
...
PingInterval=30
PingCount=30

Restart both nodes, first node1 then node2.

$ORACLE_HOME/opmn/bin/opmnctl shutdown
$ORACLE_HOME/opmn/bin/opmnctl startup

Now we need to prepare the deployment properties of AIA. This is done on both nodes.

cp $AIA_HOME/config/deploy.properties $AIA_HOME/config/deploy.properties.org
cp $AIA_HOME/Infrastructure/install/templates/deploy.properties.tmpl $AIA_HOME/config/deploy.properties

Open this deploy.properties file, on each node, to check parameters. Make sure the hostnames are correct for each node (j2ee.hostname, iasinstancename):

vi $AIA_HOME/config/deploy.properties
FPVersion=2.5.0.0.0
aia.home=/fs01/app/oracle/esbacc01/aia
oracle.home=/fs01/app/oracle/esbacc01/soa
http.hostname=node1.vijfhuizen.com
j2ee.hostname=node1.vijfhuizen.com
http.port=80
admin.user=oc4jadmin
iasinstancename=AS.vijfhuizen.com
oc4jinstancename=oc4j_soa
opmn.port=6003
rmi.port=12401
db.hostname=node1.vijfhuizen.com
db.port=1521
dbuser=sys
SID=esbacr011
#admin.password.encrypted=
admin.password=welcome1
#dbpwd.encrypted=
dbpwd=esbacr01

Check on both nodes the paramterea of BPEL. Note, that we set the option cluster to false! And the hostnames are different:

vi $ORACLE_HOME/bpel/utilities/ant-orabpel.properties
...
platform = ias_10g
hostname = node1.vijfhuizen.nl
http.hostname = ${hostname}
http.port = 80
cluster = false
oc4jinstancename = oc4j_soa
j2ee.hostname = node1.vijfhuizen.nl
asinstancename =

Before we can start with the the AIA configuration, we need to make a jms error topic. Otherwise the ant script for creating the FPErrorHandlingInstall will fail.
  • Login to EM
  • Click on soa_group link
  • Click on Administration
  • Click on JMS Destinations
  • Click on Create New
  • Destination Type: Topic
  • Desination Name: ESB_ERROR
  • In memory: checked
  • JNDI Location: jms/topic/ESB_ERROR
  • Click on OK

Step 4: AIA Deployment and configuration execution
Now we are able to start in configuration of AIA into Oracle SOA Suite 10g. The approach is as follows. FIrst we do some manual install scripts on node #2 (while node #1 is down!). Then we do a full install on node #1, while node#2 is down. After this we can bring up #2.

Stop node #1


$ORACLE_HOME/opmn/bin/opmnctl shutdown

Check if node #2 is up and running (oc4j_soa, HTTP, esbdt)

$ORACLE_HOME/opmn/bin/opmnctl status

Start the first scripts:

cd $AIA_HOME/Infrastructure/install/scripts/
ant --noconfig -buildfile FPCommonConfig.xml replaceFPInstallProperties

Buildfile: FPCommonConfig.xml

...log information...

BUILD SUCCESSFUL

ant --noconfig -buildfile FPConfiguration.xml CommonConfigurations

Buildfile: FPConfiguration.xml

...log information...
BUILD SUCCESSFUL
The first step is done of AIA. Just for checking, you should be able to view the AIA compontens:

http://loadbalancer.vijfhuizen.com:7777/AIAComponents/

The out-of-the-box URI is incorrect when is is executing a deployment. Change the URI as well the password!

vi $AIA_HOME/Infrastructure/install/scripts/FPInstall.properties
...
#deployer.uri=deployer:oc4j:opmn://node1.vijfhuizen.nl:6003/oc4j_soa
deployer.uri=deployer:cluster:opmn://node1.vijfhuizen.nl:6003/soa_group
oc4j.admin.user = oc4jadmin
oc4j.admin.password = welcome1
...

Execute the next AIA scripts.
 
ant --noconfig -buildfile FPCommonConfig.xml CreateCommonDatasources
Buildfile: FPCommonConfig.xml
 
CreateCommonDatasources:
 
...log information... 
 
BUILD SUCCESSFUL
 
ant --noconfig -buildfile FPCAVSInstall.xml createSchedulerDataSource

Buildfile: FPCAVSInstall.xml
createSchedulerDataSource:
 
...log information... 
 
BUILD SUCCESSFUL
ant --noconfig -buildfile FPErrorHandlingInstall.xml DeployESBErrorListenerMDB

Buildfile: FPErrorHandlingInstall.xml

DeployESBErrorListenerMDB:

...log information...
BUILD SUCCESSFUL

ant --noconfig -buildfile FPCAVSInstall.xml DeployAIAUI

Buildfile: FPCAVSInstall.xml

...log information... 

BUILD SUCCESSFUL

Check that the AIA data-sources are created in the oc4j_soa container of node #2.

vi $ORACLE_HOME/j2ee/oc4j_soa/config/data-sources.xml
...
<managed-data-source connection-pool-name="JMSConnectionPool" 
jndi-name="jdbc/AIA_JMS_DS" name="AIA_JMS_DS" tx-level="local"/>
<managed-data-source connection-pool-name="AIAXAConnectionPool" 
jndi-name="jdbc/xref" name="XREFDataSource"/>
<managed-data-source connection-pool-name="AIAConnectionPool" 
jndi-name="scheduler/OracleManagedDS" name="SchedulerOracleManagedDS"/>
<connection-pool name="Example Connection Pool">
...

Shutdown node #2!

$ORACLE_HOME/opmn/bin/opmnctl shutdown

Startup node #1!

$ORACLE_HOME/opmn/bin/opmnctl startall

Now we can execute a full install of AIA on the first node. This step can take a while. Verify that the deployment properties is correct in $AIA_HOME/config. A follow the log file that is created. It it fails you can re-run this step.

Note: I had an issue on a project when we used a Oracle RAC database. DUe to sime unknown reasons, we had to restart the database, because the script could not make user. It was 'hanging'. It tries to create two user schema's:
create user aia identified by aia;
grant connect,resource to aia;
grant CREATE VIEW to aia;
grant aq_administrator_role to aia;
grant execute on dbms_aqadm to aia;
grant execute on dbms_aq to aia;
grant execute on dbms_aqin to aia;
grant execute on dbms_aqjms to aia;

create user jmsuser identified by jmsuser;
GRANT connect,resource,AQ_ADMINISTRATOR_ROLE TO jmsuser IDENTIFIED BY jmsuser;
GRANT execute ON sys.dbms_aqadm TO jmsuser;
GRANT execute ON sys.dbms_aq TO jmsuser;
GRANT execute ON sys.dbms_aqin TO jmsuser;
GRANT execute ON sys.dbms_aqjms TO jmsuser;


cd $AIA_HOME/Infrastructure/install/scripts
ant --noconfig -buildfile FPInstall.xml

Buildfile: FPInstall.xml

...log information...
BUILD SUCCESSFUL

Check that the AIA data-sources are created in the oc4j_soa container of node #1.

vi $ORACLE_HOME/j2ee/oc4j_soa/config/data-sources.xml
...
<managed-data-source connection-pool-name="JMSConnectionPool" 
jndi-name="jdbc/AIA_JMS_DS" name="AIA_JMS_DS" tx-level="local"/>
<managed-data-source connection-pool-name="AIAXAConnectionPool" 
jndi-name="jdbc/xref" name="XREFDataSource"/>
<managed-data-source connection-pool-name="AIAConnectionPool" 
jndi-name="scheduler/OracleManagedDS" name="SchedulerOracleManagedDS"/>
<connection-pool name="Example Connection Pool">
...

Startup node #2.

$ORACLE_HOME/opmn/bin/opmnctl startall


Step 5: AIA post configuration
Now we have almost finished the AIA cluster setup, we need to make a few post configuration steps.

Go to node #2, and install the taskform application.
cd $AIA_HOME/Infrastructure/ErrorHandling/AIAErrorTaskAdministrationProcess
ant --noconfig deployTaskForm

Buildfile: build.xml

deployTaskForm:

... log info...

BUILD SUCCESSFULL

On node #1 and #2, add durable subscriber for the JMS topic

cd $AIA_HOME/Infrastructure/ErrorHandling/AIAReadJMSNotificationProcess/bpel
vi consumeFaultMsg.wsdl
...
<jca:operation ActivationSpec="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec"
 DestinationName="java:comp/resource/AIA_ERROR_JMS/Topics/AIA.AIA_ERROR_TOPIC"
 DurableSubscriber="AIAReadJMSNotificationAgent"
 UseMessageListener="false"
 MessageSelector="JMSCorrelationID LIKE '%AIA_EH_DEFAULT%'"
 PayloadType="TextMessage" OpaqueSchema="false">
</jca:operation>

Add cluster-id to the Error notification agent. This makes that only one JMS service will dequeue a message, and not both nodes.

cd $AIA_HOME/Infrastructure/ErrorHandling/AIAReadJMSNotificationProcess/bpel
vi bpel.xml
...
<activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="consumeFaultMsg">
<property name="portType">Consume_Message_ptt</property>
<property name="clusterGroupId">AIAClusterERRORJMS</property>
</activationAgent>
...

Verify that the ESB systems points to the correct cluster-id and load balancer. Check the flowwing ESB systems
  • DefaultSystem
  • AIASystem
  • BPELSystem

Each system should have the following values:
  • Cluster Name: esb
  • Virtual Host: loadbalancer.vijfhuizen.com
  • Port: 80
  • Topic Location: ESBTopics/Topics/ESB_JAVA_DEFERRED
  • Connection Factory Location: OracleOJMS/XATCF
The Oracle SOA Suite 10g is now clustered and configured for AIA Foundation Pack.

I would thank Michel Schildmeijer for giving feedback and recommendations for this article.

Done
QED

Thursday, April 01, 2010

SOA 11g: Timeout settings

After configuration of your SOA 11g environment, the  (non-)clustered domain must be changed to increase the default time-out settings.

We do this directly in the config files; make sure your admin server and managed servers are down.

At Weblogic level:

Set the global transaction JTA to 3600 seconds, be default it is 40 sec:
$DOMAIN_HOME/soa_domain/config/config.xml
...
<timeout-seconds>3600</timeout-seconds>
...
At SOA 11g - BPEL level: Set the sync wait time of synchrounouse processed to 120 seconds (45 by default). In the first 11g release this can be done via the file, since patch set #1 this can be done via EM going to the BPEL Manager properties.
$DOMAIN_HOME/soa_domain/config/soa-infra/configuration/bpel-config.xml
...
<syncMaxWaitTime>120</syncMaxWaitTime>
...
The following EJB needs to be extended on their time out. This can be done in via Enterprise Manager.

Note, that the first time it will ask you to create a Plan.xml file.
Make sure that this Plan.xml is stored in his own directory, for example: $WLS_DOMAIN/soa_domain/plan/ejb

  • Log into Oracle WebLogic Administration Console.
  • Click Deployments.
  • Expand soa-infra -> EJBs.
  • You can check in the config tab for the timeout setting in the BPEL* EJBs:
    BPELEngineBean
    BPELDeliveryBean
    BPELActivityManagerBean
    BPELServerManagerBean
    BPELProcessManagerBean
    BPELInstanceManagerBean
    BPELFinderBean
  • Click Save.
  • Update the soa-infra application
  • Restart Oracle WebLogic Server.