Wednesday, November 2, 2011

JAVA API to verify JMS Consumer

Sometime it happens that JMS Consumer (BPEL/ESB Process) stops consuming message from the JMS Queue. This queue could be either on the SOA Side or on participating application side. To narrow down to the root cause of the issue, below JAVA API will be highly useful. The JAVA API will consume the data from the queue if queue is working properly so in that case you need to look into your consumer process to trace out the root cause of the issue. In case the JAVA API is throwing any error then it means there is an issue at the queue end which needs to be sorted out.

To set up the enviroment to execute this JAVA API please go through the previous post "Test your JMS Queue" and follow step no. 1 (Environment setup).

2. Create a JAVA file with name TestJMSConsumer.java and copy the below code in it

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.*;

public class TestJMSConsumer
{

  public static void main(String[] args)
  {

    //*******************************************************************************************
    //* Change settings below according to JMS provider requirements
    //*******************************************************************************************

    // Set Context Factory
    final String myContextFactoryName = "com.evermind.server.rmi.RMIInitialContextFactory";

    // Set the target queue connection factory
    final String myQueueConnectionFactoryName = "java:comp/resource/COMMS_SUBMITORDER_PRODUCER/XAQueueConnectionFactories/AIA_Queue";

    // Set the target queuename
    final String myQueueName = "java:comp/resource/COMMS_SUBMITORDER_PRODUCER/Queues/JMSUSER.AIA_CRTFO_IN_JMSQ";

    // Set UrlProvider
    final String myUrlProviderName = "opmn:ormi://soaserver:6003:oc4j_soa/default";

    // Set user+password credentials
    final String myUser     = "oc4jadmin";
    final String myPassword = "password";

    //*******************************************************************************************

    String classPath = System.getProperty("java.class.path",".");

    Context                jndiContext = null;
    QueueConnectionFactory myQueueConnectionFactory = null;
    QueueConnection        myQueueConnection = null;
    QueueSession           myQueueSession = null;
    Queue                  myQueue = null;
    QueueReceiver          myQueueReceiver = null;


    /*
     * Set the environment for a connection to the JMS server
     */
    Hashtable myEnv = new Hashtable();
              myEnv.put(Context.INITIAL_CONTEXT_FACTORY, myContextFactoryName);
              myEnv.put(Context.SECURITY_PRINCIPAL,      myUser);
              myEnv.put(Context.SECURITY_CREDENTIALS,    myPassword);
              myEnv.put(Context.PROVIDER_URL,            myUrlProviderName);

    System.out.println("Using :-");
    System.out.println("Context Factory=" + myContextFactoryName);
    System.out.println("Queue Connection Factory=" + myQueueConnectionFactoryName);
    System.out.println("Url Provider=" + myUrlProviderName);
    System.out.println("");
    System.out.println("Current CLASSPATH=" + classPath);
    System.out.println("");

    /*
     * Set the Context Object.
     * Lookup the Queue Connection Factory.
     * Lookup the Queue
     */
    try
    {
       jndiContext = new InitialContext(myEnv);
       System.out.println("Lookup Queue Connection Factory : " + myQueueConnectionFactoryName);

       myQueueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup(myQueueConnectionFactoryName);
       System.out.println("OK");
       System.out.println("Lookup Queue " + myQueueName);

       myQueue = (Queue)jndiContext.lookup(myQueueName);
       System.out.println("OK");
    }
    catch (NamingException e)
    {
       System.out.println("JNDI lookup failed: " + e.toString());
       System.exit(1);
    };

    /*
     * Create connection factory, session, receiver and receive message
     */
    try
    {
       myQueueConnection = myQueueConnectionFactory.createQueueConnection();
       myQueueSession    = myQueueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
       myQueueReceiver  = myQueueSession.createReceiver(myQueue);

       // Start the queue connection
       myQueueConnection.start();

       System.out.println("Receiving Message...");

       TextMessage message = (TextMessage) myQueueReceiver.receive();
       System.out.println("Received Message: " + message.getText());

       // Close the queue connection
       myQueueConnection.close();

  }
    catch (JMSException e)
    {
       System.out.println("Exception occurred: " + e.toString());
    }
    finally
    {
       if (myQueueConnection != null)
       try
       {
         myQueueConnection.close();
       }
       catch (JMSException e)
       {
        System.out.println("Close error: " + e.toString());
       };
    };
  }; // end main
}// end TestJMSConsumer class


3. Modify the parameters mentioned below:

• ORACLE_HOME

• myQueueConnectionFactoryName

• myQueueName

• myUrlProviderName

• myPassword



4. Steps to execute the code:

[oracle@soaserver JMSClient]$ source setpath.sh

[oracle@soaserver JMSClient]$ javac TestJMSConsumer.java

[oracle@soaserver JMSClient]$ java TestJMSConsumer



Sunday, October 16, 2011

Test your JMS Queue

Test your JMS Queue:


Script location: /home/oracle/scripts/JMS/JMSClient

1. Environment setup:

a. Create a script (setpath.sh) to set the environment:

export ORACLE_HOME=/u01/app/aia/soa

export CLASSPATH=.:$ORACLE_HOME/lib/xml.jar:$ORACLE_HOME/lib/xmlparserv2.jar:$ORACLE_HOME/bpel/system/services/lib/bpm-services.jar:$ORACLE_HOME/bpel/lib/bpm-infra.jar:$ORACLE_HOME/bpel/lib/connector15.jar:$ORACLE_HOME/bpel/lib/oracle_http_client.jar:$ORACLE_HOME/j2ee/home/oc4jclient.jar:$ORACLE_HOME/bpel/lib/orawsdl.jar:$ORACLE_HOME/bpel/lib/orabpel.jar:$ORACLE_HOME/bpel/lib/orabpel-common.jar:$ORACLE_HOME/bpel/lib/orabpel-thirdparty.jar:$ORACLE_HOME/integration/esb/lib/commons-logging.jar:$ORACLE_HOME/integration/esb/lib/commons-codec-1.3.jar:$ORACLE_HOME/j2ee/home/admin_client.jar:$ORACLE_HOME/adminclient.jar:$ORACLE_HOME/argus.jar:$ORACLE_HOME/j2ee/home/lib/jmx_remote_api.jar:$ORACLE_HOME/j2ee/home/lib/jmxcluster.jar:$ORACLE_HOME/j2ee/home/lib/jmxri.jar:$ORACLE_HOME/j2ee/home/oc4jclient.jar:$ORACLE_HOME/opmn/lib/ons.jar:$ORACLE_HOME/opmn/lib/opmnconfig.jar:$ORACLE_HOME/opmn/lib/optic.jar:$ORACLE_HOME/opmn/lib/repositorycheck.jar:$ORACLE_HOME/j2ee/home/lib/jms.jar:$ORACLE_HOME/j2ee/home/lib/bcel.jar:$ORACLE_HOME/j2ee/home/lib/connector.jar

export PATH=$ORACLE_HOME/jdk/bin:$PATH



b. Copy oc4j-internal.jar in the folder JMSClient

[oracle@soaserver JMSClient]$ cp $ORACLE_HOME/j2ee/home/lib/oc4j-internal.jar .

c. Execute below commands

[oracle@soaserver JMSClient]$ source setpath.sh

[oracle@soaserver JMSClient]$ jar vxf oc4j-internal.jar com/evermind/util/JCAProperties.class



2. Create a JAVA file with name TestJMSClient.java and copy the below code in it

import java.util.Hashtable;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.naming.NamingException;

import javax.jms.*;



public class TestJMSClient

{



public static void main(String[] args)

{



//*******************************************************************************************

//* Change settings below according to JMS provider requirements

//*******************************************************************************************



// Set Context Factory

final String myContextFactoryName = "com.evermind.server.rmi.RMIInitialContextFactory";



// Set the target queue connection factory

final String myQueueConnectionFactoryName = "java:comp/resource/SiebelJmsRP/QueueConnectionFactories/QCF";



// Set the target queuename

final String myQueueName = "java:comp/resource/SiebelJmsRP/Queues/AIA_SALESORDERJMSQUEUE";



// Set UrlProvider

final String myUrlProviderName = "opmn:ormi://soaserver:6003:OC4J_SOA/default";



// Set user+password credentials

final String myUser = "oc4jadmin";

final String myPassword = "password";



//*******************************************************************************************



String classPath = System.getProperty("java.class.path",".");



Context jndiContext = null;

QueueConnectionFactory myQueueConnectionFactory = null;

QueueConnection myQueueConnection = null;

QueueSession myQueueSession = null;

Queue myQueue = null;

QueueSender myQueueSender = null;

BytesMessage myBytesMessage = null;



/*

* Set the environment for a connection to the JMS server

*/

Hashtable myEnv = new Hashtable();

myEnv.put(Context.INITIAL_CONTEXT_FACTORY, myContextFactoryName);

myEnv.put(Context.SECURITY_PRINCIPAL, myUser);

myEnv.put(Context.SECURITY_CREDENTIALS, myPassword);

myEnv.put(Context.PROVIDER_URL, myUrlProviderName);



System.out.println("Using :-");

System.out.println("Context Factory=" + myContextFactoryName);

System.out.println("Queue Connection Factory=" + myQueueConnectionFactoryName);

System.out.println("Url Provider=" + myUrlProviderName);

System.out.println("");

System.out.println("Current CLASSPATH=" + classPath);

System.out.println("");



/*

* Set the Context Object.

* Lookup the Queue Connection Factory.

* Lookup the Queue

*/

try

{

jndiContext = new InitialContext(myEnv);

System.out.println("Lookup Queue Connection Factory : " + myQueueConnectionFactoryName);



myQueueConnectionFactory = (QueueConnectionFactory)jndiContext.lookup(myQueueConnectionFactoryName);

System.out.println("OK");

System.out.println("Lookup Queue " + myQueueName);



myQueue = (Queue)jndiContext.lookup(myQueueName);

System.out.println("OK");

}

catch (NamingException e)

{

System.out.println("JNDI lookup failed: " + e.toString());

System.exit(1);

};



/*

* Create connection factory, session, sender and send message

*/

try

{

myQueueConnection = myQueueConnectionFactory.createQueueConnection();

myQueueSession = myQueueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

myQueueSender = myQueueSession.createSender(myQueue);

myBytesMessage = myQueueSession.createBytesMessage();



System.out.println("Sending message...");



String stringMessage = " ";

byte[] byteData = stringMessage.getBytes();

myBytesMessage.writeBytes(byteData);

myQueueSender.send(myBytesMessage);

System.out.println("OK"+stringMessage);

System.out.println("Sent message: " + " - " + myBytesMessage.getJMSMessageID());

}

catch (JMSException e)

{

System.out.println("Exception occurred: " + e.toString());

}

finally

{

if (myQueueConnection != null)

try

{

myQueueConnection.close();

}

catch (JMSException e)

{

System.out.println("Close error: " + e.toString());

};

};

};

}



3. Modify the parameters mentioned below:

• ORACLE_HOME

• myQueueConnectionFactoryName

• myQueueName

• myUrlProviderName

• myPassword



4. Steps to execute the code:

[oracle@soaserver JMSClient]$ source setpath.sh

[oracle@soaserver JMSClient]$ javac TestJMSClient.java

Note: TestJMSClient.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

[oracle@soaserver JMSClient]$ java TestJMSClient

Monday, June 27, 2011

How to find out Oracle AIA Patches applied on the server

1. Make sure Oracle Standalone Interim Patch Installer version is equal or greater than 11.1.0.0.0
[oracle@soaserver ~]$ opatch version
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.

2. Set ORACLE_HOME variable to point to your AIA_HOME
[oracle@soaserver ~]$export ORACLE_HOME=/oracle/aia
(Where /oracle/aia is the location of AIA directory on my soaserver)

3. Set SOA_HOME varaible to point to your SOA Home
[oracle@soaserver ~]$export SOA_HOME=/oracle/orasoa

(Where /oracle/orasoa is the location of SOA directory on my soaserver)

4.Set AIA_HOME variable to point to your AIA_HOME
[oracle@soaserver ~]$export AIA_HOME=/oracle/aia

5. Use opatch lsinventory to find out the AIA Patches
[oracle@soaserver ~]$opatch lsinventory -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre

Sunday, June 19, 2011

JAVA API to Turn a BPEL Process ON/OFF

import java.util.Map;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.Context;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
import org.apache.xml.resolver.helpers.PublicId;

import com.oracle.bpel.client.IBPELProcessConstants;
import com.oracle.bpel.client.IBPELProcessHandle;
import com.oracle.bpel.client.BPELProcessId;
import com.oracle.bpel.client.IService;


public class ProcessManager {

private Locator locator;

public ProcessManager() {
/*
connect to a BPEL server
*/
String jndiFactory = "com.evermind.server.rmi.RMIInitialContextFactory";
String jndiUsername = "oc4jadmin";
String jndiPassword = "soaserver1";
String jndiProviderUrl = "opmn:ormi://soaserver:6003:oc4j_soa/orabpel";
Hashtable jndi = new Hashtable();
jndi.put(Context.PROVIDER_URL, jndiProviderUrl);
jndi.put(Context.INITIAL_CONTEXT_FACTORY, jndiFactory);
jndi.put(Context.SECURITY_PRINCIPAL, jndiUsername);
jndi.put(Context.SECURITY_CREDENTIALS, jndiPassword);
try {
locator = new Locator("default", jndi);
}
catch(Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
try{
ProcessManager pm = new ProcessManager();
pm.TurnOffProcess();
}catch(Exception e)
{
e.printStackTrace();
}
}
public void TurnOnProcess() throws ServerException{
IBPELProcessHandle pmhandler = locator.lookupProcess("ProcessSalesOrderSiebelJMSConsumer");
com.oracle.bpel.client.BPELProcessMetaData BPMD = pmhandler.getMetaData();
BPMD.setState(IBPELProcessConstants.STATE_ON);
pmhandler.updateMetaData(BPMD);
System.out.println("ProcessSalesOrderSiebelJMSConsumer BPEL Process is turned ON");
}

public void TurnOffProcess() throws ServerException {
IBPELProcessHandle pmhandler = locator.lookupProcess("ProcessSalesOrderSiebelJMSConsumer");
com.oracle.bpel.client.BPELProcessMetaData BPMD = pmhandler.getMetaData();
BPMD.setState(IBPELProcessConstants.STATE_OFF);
pmhandler.updateMetaData(BPMD);
System.out.println("ProcessSalesOrderSiebelJMSConsumer BPEL Process is turned OFF");
}
}

Saturday, June 11, 2011

9318256 - PLACEHOLDER BUG OF EHROLLUP FOR 2.5 (2.0 & 2.0.1 SPECIFIC)

1.1 Patch Pre-installation instructions

1. Patch 9318256 is Merge patch for patch no. 9361469 and patch no. 8934996.

2. Backup environments. (Application Server and DB)

3. If it’s a cluster environment then this patch needs to be applied on the all the nodes separately.

Only the node on which this patch is currently being applied should be UP. Rest of the nodes should be down.

4. set AIA_HOME environment variable.
export AIA_HOME=/oracle/aia

5. Open deploy.properties in edit mode
vi /oracle/aia/config/deploy.properties

6. Add the following two lines in the deploy.properties
deployer.uri=deployer:oc4j:opmn://${http.hostname}:${opmn.port}/${iasinstancename}/${oc4jinstancename}
dburl=jdbc:oracle:thin:@${db.hostname}:${db.port}:${SID}

7. Save the file.

1.2 Patch Installation Instructions

1. Please make sure you have the standalone OPATCH that's available from metalink via patch 5912518.
[oracle@TEST1AIA01 orasoa]$ opatch version
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.

2. Please make sure that Opatch Directory is in your PATH.

3. To apply the patch, unzip the PSE zip file:
unzip p9318256_201_GENERIC.zip

4. Set your current directory to where the patch is located:
[oracle@TEST1AIA01 9318256]$ pwd
/stage/191010-SR/9318256

5. Set the following two environment variable ORACLE_HOME(should point AIA_HOME),SOA_HOME(should point SOA Home)
[oracle@TEST1AIA01 9318256]$ export ORACLE_HOME=/oracle/aia
[oracle@TEST1AIA01 9318256]$ export SOA_HOME=/oracle/orasoa

6. on Linux:
# : opatch apply -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre
[oracle@test1aia01 9318256]$ opatch apply -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre
Invoking Standalone OPatch 11.1.0.0.0
Oracle Standalone Interim Patch Installer version 11.1.0.0.0
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /media/hda2/oracle/aia
Oracle Home Inventory : /media/hda2/oracle/aia/sainventory
OPatch version : 11.1.0.0.0
Product information : /media/hda2/oracle/aia/product.xml
Log file location : /media/hda2/oracle/aia/cfgtoollogs/opatch/opatch2011-01-06_19-54-47PM.log
ApplySession applying interim patch '9318256' to OH '/media/hda2/oracle/aia'
Interim Patch 9318256 has Conflict with patch(es) [ 9361469 ] in OH /media/hda2/oracle/aia
Conflict patches: 9361469
Patch(es) 9361469 conflict with the patch currently being installed (9318256).
If you continue, patch(es) 9361469 will be rolled back and the new patch (9318256) will be installed.
If a merge of the new patch (9318256) and the conflicting patch(es) ( 9361469) is required, contact Oracle Support Services and request a Merged patch.
Do you want to proceed? [y
n]
User Responded with: Y
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '9361469' for restore. This might take a while...
ApplySession rolling back interim patch '9318256' from OH '/media/hda2/oracle/aia'
Patching component oracle.aia, 2.0.1.0.0...
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/PublishMessageSession.class"
RollbackSession removing interim patch '9361469' from inventory
OPatch back to application of the patch '9318256' after auto-rollback.
Backing up files affected by the patch '9318256' for rollback. This might take a while...
Patching component oracle.aia, 2.0.1.0.0...
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/util/AIADBUtil.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/util/XmlNamespaceContext.class"
.
.
.
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/i18n/EHResourceBundle.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/logging/AIALogger.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/resubmit/util/AIAEHResubmissionUtil.class"
Copying file to "/media/hda2/oracle/aia/seeddata/DatabaseObjects/UpgradeEHTablesTo25.sql"
ApplySession adding interim patch '9318256' to inventory
Verifying the update...
Inventory check OK: Patch ID 9318256 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 9318256 are present in Oracle Home.
--------------------------------------------------------------------------------
The following warnings have occurred during OPatch execution:
1) OUI-67012:Interim Patch 9318256 has Conflict with patch(es) [ 9361469 ] in OH /media/hda2/oracle/aia
--------------------------------------------------------------------------------
OPatch Session completed with warnings.
OPatch completed with warnings.

1.3 Patch Post-Installation Instructions

1. Browse to $AIA_HOME/config.
[oracle@TEST1AIA01 9318256]cd $AIA_HOME/config

2. Open AIAConfigurationProperties.xml file in edit mode
[oracle@TEST1AIA01 config]$ vi AIAConfigurationProperties.xml

3. Add the below snippet in the properties file
<ModuleConfiguration moduleName="ResourceBundle">

<Property name="Telco/BillingManagement">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/ProductLifeCycle">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/SalesOrder">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/CustomerParty">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
</ModuleConfiguration>

4. Navigate to cd $AIA_HOME/bin and source aiaenv.sh.
[oracle@TEST1AIA01 config]$ cd $AIA_HOME/bin
[oracle@TEST1AIA01 bin]$ source aiaenv.sh

5. Now navigate to cd $AIA_HOME/install/conf/eh/AIAReadJMSNotificationProcess and execute ant(Type ant and enter).
[oracle@TEST1AIA01 bin]$ cd $AIA_HOME/install/conf/eh/AIAReadJMSNotificationProcess
[oracle@TEST1AIA01 AIAReadJMSNotificationProcess]$ ant

.
.

BUILD SUCCESSFUL
Total time: 20 seconds

6. Copy $AIA_HOME/lib/classes to $ORACLE_HOME/bpel/system/classes. Make sure custom files are not moved.
[oracle@TEST1AIA01 AIAReadJMSNotificationProcess]$ cd $ORACLE_HOME/bpel/system/
[oracle@TEST1AIA01 system]$ tar –cf classes.tar classes/
[oracle@TEST1AIA01 system]$ cd classes/
[oracle@TEST1AIA01 classes]$ cp –Rf $AIA_HOME/lib/classes .

7. Restart the oc4j server.

[oracle@TEST1AIA01 classes]$ source /home/oracle/setsoaenv.sh
[oracle@TEST1AIA01 classes]$ opmnctl shutdown
[oracle@TEST1AIA01 classes]$ opmnctl startall

8. If you apply this patch for cluster, please do the following steps

a) Check if the ESBErrorListenerMDB is available on both the Nodes.
If yes, then you have to undeploy the ESBErrorListenerMDB.ear from both the Nodes and then continue with the post patching steps.
Take back up of ESBErrorListenerMDB.ear in location $AIA_HOME/lib/
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Undeploy the ESBErrorListenerMDB.ear
ant --noconfig –f ConfigDatasources.xml UndeployESBErrorListenerMDB
You can see the file ESBErrorListenerMDB.ear in the location
$AIA_HOME/lib/cluster/
This needs to be copied to location $AIA_HOME/lib/
cp $AIA_HOME/lib/cluster/ESBErrorListenerMDB.ear $AIA_HOME/lib/ESBErrorListenerMDB.ear
This has to be done on both the nodes.

b) Re-deploying the ESB Error Handler on APPHOST1
In the deploy.properties file of APPHOST1, set the http.hostname/port to APPHOST1 and save.
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Redeploy this MDB using the enterprise manager or using the following command
ant --noconfig –f ConfigDatasources.xml DeployESBErrorListenerMDB
Now change the value of http.hostname/port in deploy.properties again to LBR details.

c) Re-deploying the ESB Error Handler on APPHOST2
In the deploy.properties file of APPHOST2, set the http.hostname/port to APPHOST2 and save.
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Redeploy this MDB using the enterprise manager or using the following command
ant --noconfig –f ConfigDatasources.xml DeployESBErrorListenerMDB
Now change the value of http.hostname/port in deploy.properties again to LBR details.

9. In case you are getting "java.sql.SQLException: The method 'commit' cant be called when a global transaction is active" error then a change is needed to be done for AIAConnectionPool. You need to add tx-level="local" as shown below.
<managed-data-source connection-pool-name="AIAConnectionPool" jndi-name="jdbc/AIADataSource" name="AIADataSource" tx-level="local"/>
The above error also results in OutOfMemory exception.

10. For the error "oracle.apps.aia.core.config.PropertyNotFoundException: Property Not Found (SystemConfiguration/COMMON.ERRORHANDLER_EXT.IMPL)". For this we need to below line in the AIAConfigurationProperties.xml
<Property name="COMMON.ERRORHANDLER_EXT.IMPL">oracle.apps.aia.core.eh.AIAErrorHandlerExtImpl</Property>
Save and reload.

11. If this patch causes out of memory issue for native memory then increase the value of -XX:MaxPermSize.

12. Optional Step : [Recommended]
This step is applicable only if number of listeners on AIA_ERROR_TOPIC are greater than one and listeners are named with some random numbers.
On Production systems, this step can be done during backup phase.
Take backup of AIA_ERROR_TOPIC queue contents. Then drop and recreate AIA_ERROR_TOPIC.
This step will fix - messages not getting deleted from AIA_ERROR_TOPIC_TABLE table after reading them from the topic bug.
If this step is not applied, the AQ table keeps growing.
Since it is on DB, you have to do it once on DB.
But ensure to follow the below steps here.

i. You have to stop the Queue
ii. Take back up of Queue Table.
iii. Drop the Queue
iv. Run the following script to re-create and start the queue
$AIA_HOME//seeddata/DatabaseObjects/AIAerrorAQ.sql

The Number of listeners can be equivalent to number of Subscribers for that particular Queue.
The number of Subscribers can be determined from a table which will be something like following
AQ$AIA_ERROR_TOPIC_S
Also, please note that the reason for this step is that dummy Subscribers MAY get created and the Queue table keeps on growing.
Hence it is recommended to this step (irrespective of number of subscribers that are currently existing).
Ensure to stop, take back up before you drop the queue and re-create it.

Tuesday, May 24, 2011

Upgrade High Availability Cluster Environment SOA Suite 10.1.3.3 to 10.1.3.5

ORABPEL-12141 - ERRJMS_CONN_FAC_NOT_FOUND


Error Description:

ORABPEL-12141
ERRJMS_CONN_FAC_NOT_FOUND.
Unable to instantiate connection factory. JMS adapter was unable to look up the connection factor weblogic.jms.ConnectionFactory neither through JNDI nor instantiate it as a Java class [Caused by: invalid type code: 31]
Please examine the log file to determine the problem.
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
        java.io.StreamCorruptedException: invalid type code: 31]
Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
        java.io.StreamCorruptedException: invalid type code: 31
        at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:223)
Caused by: java.io.StreamCorruptedException: invalid type code: 31
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1355)


Cause:  This exception may be thrown if the JRE/JDK is v1.6.The weblogic.jar is based on JDK1.5.


Solution: Add -Dsun.lang.ClassLoader.allowArraySyntax=true in opmn.xml under the container in which connectivity to the weblogic server is made.

Thursday, March 17, 2011

Out Of Memory Errors of Oracle Application Server

There are various types of outof memory errors that occurs in the oracle application server.Based on the cause of the error, there are specific ways to fix it.


Root cause of the error and their fix is given below:

OutOfMemoryError: Java Heap Space
Cause: This error is hit when the part of the RAM allocated to JVM for carrying on the OAS task is not sufficient.
Solution: Increase the value of -Xmx. Oracle recommend to have the same value for -Xms and -Xmx.


OutOfMemoryError: PermGen space
Cause: This error occurs when there is not sufficient RAM left for native code i.e. the jar files required by the Application Server. This issue can hit after upgradation/patch on OAS also as more libraries are added which require more RAM.
Solution: Increase -XX:MaxPermSize=256m. On OAS, 256M is sufficient. You can also use -XX:PermSize along with -XX:MaxPermSize in case you want less than 256M RAM allocated to permanent generation during server startup.


OutOfMemoryError: unable to create new native thread
Cause: This error is thrown by the OS when there isn't enough RAM to create a new thread. It is beacuse of high value of -Xmx and -Xss.
Solution: For OAS, -Xss128K is sufficient. In case you are facing any issue you can incrase it to -Xss256K. If decreasing the value of -Xss is not helping then decrease the value of -Xmx.


java.lang.OutOfMemoryError: requested 1224368 bytes for Chunk::new. Out of swap space?
Cause: The cause of this error is same as above. The native objects are not getting enough RAM to use.
Solution: Decrease the value of -Xmx.

Friday, March 11, 2011

Could not instantiate ManagedConnectionFactory oracle.tip.adapter.jms.JmsManagedConnectionFactory

<AdapterFramework::Inbound> JNDI lookup of 'eis/Jms/DBConnect' failed due to: eis/Jms/DBConnect not found
<AdapterFramework::Inbound> Since unable to locate the JCA Resource Adapter deployed at 'eis/Jms/DBConnect', will then attempt to instantiate ManagedConnectionFactory oracle.tip.adapter.jms.JmsManagedConnectionFactory directly.
<AQ Adapter::Inbound> MessageReader_ctor: Initialized MessageReader for queue AQ_QUEUE, consumer = null)
<AdapterFramework::Inbound> Error while performing endpoint Activation: ORABPEL-12529
ManagedConnectionFactory problem.
Could not instantiate ManagedConnectionFactory oracle.tip.adapter.jms.JmsManagedConnectionFactory due to:

          Missing class: oracle.tip.adapter.jms.JmsManagedConnectionFactory

        Dependent class: oracle.tip.adapter.fw.wsdl.WSDLUtils
                 Loader: oracle.bpel.common:10.1.3
            Code-Source: /oracle/orasoa/bpel/lib/orabpel.jar
          Configuration: <code-source> in /oracle/orasoa/j2ee/oc4j_soa/config/server.xml

This load was initiated at esb-rt.root:0.0.0 using the Class.forName() method.

The missing class is not available from any code-source or loader in the system.
Please make sure the corresponding JCA Resource Adapter has been deployed.
 [Caused by:

          Missing class: oracle.tip.adapter.jms.JmsManagedConnectionFactory

        Dependent class: oracle.tip.adapter.fw.wsdl.WSDLUtils
                 Loader: oracle.bpel.common:10.1.3
            Code-Source: /oracle/orasoa/bpel/lib/orabpel.jar
          Configuration: <code-source> in /oracle/orasoa/j2ee/oc4j_soa/config/server.xml

This load was initiated at esb-rt.root:0.0.0 using the Class.forName() method.

The missing class is not available from any code-source or loader in the system.]
<AdapterFramework::Inbound> Adapter Framework instance: OraESB - endpointActivation for portType=Consume_Message_ptt, operation=Consume_Message
<AdapterFramework::Inbound> JNDI lookup of 'eis/Jms/DBConnect' failed due to: eis/Jms/DBConnect not found
<AdapterFramework::Inbound> Since unable to locate the JCA Resource Adapter deployed at 'eis/Jms/DBConnect', will then attempt to instantiate ManagedConnectionFactory oracle.tip.adapter.jms.JmsManagedConnectionFactory directly.
<AdapterFramework::Inbound> Error while performing endpoint Activation: ORABPEL-12529


Solution:

This error is a result of missing JMS adapter.
Verify from the EM console if "JmsAdapter" can be seen in the Cluster Topolgy -> <bpel container> -> Applications -> Standalone Resource Adapter. If it is missing then JMS Adapter is not properly deployed.
Now search in $ORACLE_HOME/j2ee/<bpel container>/config/oc4j-connectors.xml if there is an entry for JmsAdapter.
It will be something as shown below:
<connector name="JmsAdapter"
path="JmsAdapter.rar"> </connector>
In case there is no entry then go to the EM console and deploy the adapter by following the below steps:
Login to AS control as an admin user (oc4jadmin)
Click on your <bpel_container>
Click on Applications Tab
In the drop down box choose Standalone Resource Adapters
Click on the deploy button
Choose the required adapter rar file from $ORACLE_HOME/bpel/system/services/lib directory
In the next screen provide the "Resource Adapter Name" as "JmsAdapter".
Accept default values in screen 3 and click on the deploy button. After successful deployment, verify JmsAdapter under Standalone Resource Adapters.
In case of failure follow steps which are required when "JmsAdapter.rar" is found oc4j-connectors.xml.

In case there is an entry in oc4j-connectors.xml then the adapter was partially deployed and could not be completed due to some issue. Follow below steps in this case:
Navigate to $ORACLE_HOME/j2ee/<bpel_container>/connectors. Here "JmsAdapter" folder will be absent. Create a folder manually here with name "JmsAdapter".
Now inside this folder copy "JmsAdapter.rar" available at $ORACLE_HOME/bpel/system/services/lib.
Inside "JmsAdapter" folder create a subfolder with the same name i.e. "JmsAdapter". Now extract content of "JmsAdapter.rar" in the newly created "JmsAdapter" subfolder.
Now update the oc4j-ra.xml file and add the connection factory "eis/Jms/DBConnect". Remember to add all your custom connection factories.
Restart your SOA Server now and verify if JmsAdapter is now visible under the Standalone Resource Adapter list.

Tuesday, March 8, 2011

A System of name <SystemName> already exists.

I was getting below errors in my environment for two of the ESB's.

error code: 1071: 5
summary: A System of name <SystemName> already exists.

error code: 1047:5
Summary:  Parent of service "ServiceName" system "SystemName" doesn't exist

As a resolution for error 1 if I delete the system and then try to register the ESB then I hit error 2 and viceversa.
Initially my Oracle Application Server SOA Suite was 10.1.3.3.18 then I migrated it to 10.1.3.5 to resolve this issue. But the issue was intact even after upgradation of the server. I tried a lot of ways to resolve this issue and finally hit the jackpot with two of the below solutions
1> In your ESB project folder, remove all the files other than .esb, .jpr and .esbsvc. Now try registering your ESB. It will get register now. In my case both the problematic ESB's got registered successfully.
2>Create the same ESB "AS IS" again from the scratch and try registering it. It will get register now.

In case you have any other way to resolve this issue then do share it with me.

Friday, March 4, 2011

Oracle Service Registry 10g Registry Control and Business Service Registry Control is unaccessible on Oracle SOA Suite 10.1.3.5.

This is a bug which is fixed after applying oracle patch no. 9216686. For more detail on this bug refer oracle metalink document id 988084.1.