Tuesday, October 8, 2013

Ant script works in one machine but not working on another machine. Log says use JDK instead of JRE. : error: null

Sometimes we may get error while running ANT scripts . The same ANT script is running in one machine and not on another machine. The error will be just NULL. If we look at the logs sometime the log will say Error says user JDK instead of JRE.

This is due to the java version mismatch between two systems.

Try to set the JAVA_HOME and PATH variable on the command prompt and then execute the ant task.

The java versions must match


Wednesday, September 25, 2013

BINDING.JCA-12141 ERRJMS_CONN_FAC_NOT_FOUND

Sometimes JCA Adapter throw this exception. In such situations my observation is the weblogic-ra.xml file in the corresponding adapter.rar may not have updated with the JNDI we configured from weblogic console.

In such situations  we can try copying the adapter rar file to a new location and unzip the file. Then we can manually add the connection-instance detail in the weblogic-ra.xml and zip it again.

From the weblogic admin console, goto deployments and delete that adapter and re install from the new location where we kept the new adapter rar file

The Adapters will be located under <MiddlewareHome>/Oracle_SOA1/soa/connectors/

Sample connection instance section for JMS Adapter

<connection-instance>
<jndi-name>eis/jms/MyJMSAdapter</jndi-name>
<connection-properties>
<properties>
<property>
<name>ConnectionFactoryLocation</name>
<value>MYJMSConnectionFactory</value>
</property>
<property>
<name>FactoryProperties</name>
<value></value>
</property>
<property>
<name>AcknowledgeMode</name>
<value>AUTO_ACKNOWLEDGE</value>
</property>
<property>
<name>IsTopic</name>
<value>false</value>
</property>
<property>
<name>IsTransacted</name>
<value>false</value>
</property>
<property>
<name>Username</name>
<value></value>
</property>
<property>
<name>Password</name>
<value></value>
</property>
</properties>
</connection-properties>
</connection-instance>




Tuesday, September 24, 2013

Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: ERRJMS_ERR_CR_QUEUE_PROD

Sometimes eventhough we configured the JMSAdapter properly we might encounter the following error

Produce_Message' failed due to: ERRJMS_ERR_CR_QUEUE_PROD

Due to this we cannot post any message to JMS Queue.

This happens due to the invalid target option for the JMSServer.

So if you are using your own JMSServer in the weblogic console , go to the configuration and click on the subdeployment and verify the target is proper. It might be pointing to a jms server which might be pointing to a different target server.

In short the JMSServer Target Server and the corresponding Persistent Store Target Server should be the same.

Alternatively instead of using your own JMSServer, try changing the target for subdeployment to 'SOAJMSSERVER'.

This must solve this issue

Why does sometime the Application Server connection Test Fails in JDeveloper

Normally if the configuration values are proper the Application Server connection test will give the result as "Success" for every item

But often the same connection gives the Test Results as Failed and we will not be in a position to deploy the composite.

In such situations verify the proxy settings in the JDEV and if proxy is checked, just uncheck it and restart the JDEV. This problem will disappear


Monday, September 23, 2013

Caused By: java.sql.SQLException: JDBC LLR, table verify failed for table 'DEV2_SOAINFRA.WL_LLR_ADMINSERVER', row 'JDBC LLR Domain//Server' record had unexpected value

Some times this issue appears during server startup.

In such cases just execute the following query against the SOAINFRA Schema

select * from WL_LLR_ADMINSERVER;

Check the value for RECRORDSTR column

If it is not matching to the current domain , update the value using the below sql script

update DEV2_SOAINFRA.WL_LLR_ADMINSERVER set RECORDSTR = 'health_domain//AdminServer' where  XIDSTR  = 'JDBC LLR Domain//Server';

commit;

Another way is :

Goto  <MiddlewareHome>\user_projects\domains\<your_domain>\config

and remove the following section from the config.xml file

  <jdbc-system-resource>
    <name>wlsbjmsrpDataSource</name>
    <target>AdminServer,osb_server1</target>
    <descriptor-file-name>jdbc/wlsbjmsrpDataSource-jdbc.xml</descriptor-file-name>
  </jdbc-system-resource>

Thursday, August 8, 2013

Out of Memory Error while starting Weblogic Server on Windows 7 64 bit with JVM 64 Bit



To solve out of memory error on Windows 7 64 bit platform, ensure the following

Open  <WL_HOME>\common\bin\commEnv.cmd

set  JAVA_HOME=<64 bit JDK Home>

set  JAVA_VENDOR=Oracle

set JAVA_USE_64BIT=true

Save the commEnv.cmd

Open domain\bin\setSOADomainEnv.cmd

Set the memory options as follows

set JAVA_OPTIONS=%JAVA_OPTIONS%
set DEFAULT_MEM_ARGS=-Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000
set PORT_MEM_ARGS=-Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000

if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=512m -XX:MaxPermSize=1024m
set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=512m -XX:MaxPermSize=1024m


Save setSOADomainEnv.cmd

Restart the server

Thursday, July 11, 2013

JAVA: The filename, directory name, or volume label syntax is incorrect

While doing file copy operation using java, if we come across an error saying

"The filename, directory name, or volume label syntax is incorrect"

then check the source filename which we are trying to copy and ensure there is no white space before or after the filename.

Better to use fileName.trim() before trying to copy

Wednesday, July 10, 2013

B2B : java.lang.UnsatisfiedLinkError: com.edifecs.xengine.xeobjects.XEHelper.createSourceFromBLOBNative

If B2B transaction is failed , check the server logs, and if the below error is found, then it is an issue with loading the native library for XEEngine

java.lang.UnsatisfiedLinkError: com.edifecs.xengine.xeobjects.XEHelper.createSourceFromBLOBNative(Ljava/lang/String;[BLjava/lang/String;)Lcom/edifecs/xengine/xeobjects/XESource;    

To solve this issue, do the following steps

1) set the library path in setSOADomainEnv.cmd as follows
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djava.library.path=<middlewarehome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin

2) copy the wlntio.dll from <middlewarehome>\wlserver_10.3\server\native\win\x64  to <middlewarehome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin

3) copy the wlntio.dll from <middlewarehome>\wlserver_10.3\server\native\win\x64  to <JAVAHOME>\bin

also ensure the following properties are set setSOADomainEnv.cmd
set XENGINE_DIR=" <middlewarehome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine"
set PATH=%PATH%; <middlewarehome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin

Restart both Admin and ManagedServer . Ensure you have run the script setSOADomainEnv.cmd before restarting the server

Tuesday, July 2, 2013

How to get the list of partitions of em using java - SOA 11g



The following java code will  get all the partitions available in em


public static ArrayList getPartitions(String host,String port,String username,String password) throws Exception
{
 System.out.println("Trying list all partitions in "+host);
  ArrayList partitions = new ArrayList();
    boolean found = false;

String contextFactory = "weblogic.jndi.WLInitialContextFactory";

String mbeanRuntime = "weblogic.management.mbeanservers.runtime";
String jmxProtoProviderPackages = "weblogic.management.remote";

String mBeanNamePartition = "oracle.soa.config:Application=soa-infra,j2eeType=FolderLifecycleConfig,name=soa-infra";
MBeanServerConnection mbsc = TestComposite.getMbeanServerConnection(host, port, username, password,mbeanRuntime,jmxProtoProviderPackages);


ObjectName mbeanpartition = new ObjectName(mBeanNamePartition);

Object FolderArray = mbsc.getAttribute(mbeanpartition, "Folders");
System.out.println("FolderArray ="+FolderArray);
Folder[] folderData = (Folder[]) FolderArray;
for (int i = 0; i < folderData.length; i++) {
System.out.println("Folder Data"+folderData[i].getName());
partitions.add(folderData[i].getName());
}


System.out.println("partitions size"+partitions.size());
return partitions;

}

Server is Running in Development Mode and Native Library(terminalio) to read the password se curely from commandline is not found

In case we encounter this type of error, in the setSOADomainEnv.cmd add an additional attribute (-Dweblogic.management.allowPasswordEcho=true) to the the JAVA_OPTIONS as shown below

set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.management.allowPasswordEcho=true


Now , open a new command prompt and run the setSOADomainEnv.cmd.

Then start the server from the command prompt.



In case of unix system,

edit the   setSOADomainEnv.sh  as shown below

export JAVA_OPTIONS="$JAVA_OPTIONS -Dweblogic.management.allowPasswordEcho=true"

Tuesday, June 4, 2013

Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/SchemaTypeLoader while trying to export OSB Project from eclipse workspace

Recently I encountered a problem while trying to export OSB project from eclipse workspace.

Even though I set the class path properly, still it was throwing the following error

Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/SchemaTypeLoader.

After a long search in net, I found the following recommendation and it works!

Add the additional property for the java activity
 <sysproperty key="middleware.home" value="${fmw.home}"/>


The complete structure as follows

First create the classpath variable

 <path id="library.osb">
      <fileset dir="${osb.home}/modules">
        <include name="com.bea.common.configfwk_1.6.0.0.jar"/>
        <include name="com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar"/>
      </fileset>
      <fileset dir="${weblogic.home}/server/lib">
        <include name="weblogic.jar"/>
      </fileset>
      <fileset dir="${osb.home}/lib">
        <include name="alsb.jar"/>
      </fileset>
   </path>



<target name="exportFromWorkspace">
          <java dir="${eclipse.home}" classpathref="library.osb"
           jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
           fork="true" failonerror="true" maxmemory="768m">
         <jvmarg line="-XX:MaxPermSize=256m"/>
        <arg line="-data ${workspace.dir}"/>
        <arg line="-application com.bea.alsb.core.ConfigExport"/>
        <arg line="-configProject ${config.project}"/>
        <arg line="-configJar ${config.jar}"/>
        <arg line="-configSubProjects ${config.subprojects}"/>
        <arg line="-includeDependencies ${config.includeDependencies}"/>
        <sysproperty key="weblogic.home" value="${weblogic.home}"/>
        <sysproperty key="osb.home" value="${osb.home}"/>
        <sysproperty key="osgi.bundlefile.limit" value="500"/>
        <sysproperty key="harvester.home" value="${osb.home}/harvester"/>
        <sysproperty key="osgi.nl" value="en_US"/>
        <sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true"/>
      <sysproperty key="middleware.home" value="${fmw.home}"/>
     </java>
   </target>

Even after that if export fails, try to add the section to delete .metadata folder as shown below

<target name="exportFromWorkspace">
      <delete failonerror="false" includeemptydirs="true"
              dir="${metadata.dir}"/>
      <java dir="${eclipse.home}" classpathref="library.osb"
            jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
            fork="true" failonerror="true" maxmemory="768m">
         <jvmarg line="-XX:MaxPermSize=256m"/>
         <arg line="-data ${workspace.dir}"/>
         <arg line="-application com.bea.alsb.core.ConfigExport"/>
         <arg line="-configProject ${config.project}"/>
         <arg line="-configJar ${config.jar}"/>
         <arg line="-configSubProjects ${config.subprojects}"/>
         <arg line="-includeDependencies ${config.includeDependencies}"/>
         <sysproperty key="weblogic.home" value="${weblogic.home}"/>
         <sysproperty key="osb.home" value="${osb.home}"/>
         <sysproperty key="osgi.bundlefile.limit" value="500"/>
         <sysproperty key="harvester.home" value="${osb.home}/harvester"/>
         <sysproperty key="osgi.nl" value="en_US"/>
         <sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true"/>
        <sysproperty key="middleware.home" value="${fmw.home}"/>
      </java>
   </target>



Thursday, May 9, 2013

Sorting xml based on a tag value

If we want to sort an xml based on a field's value, we can use the following approch

Say for e.g  This is the source xml



<?xml version="1.0" encoding="UTF-8"?>
<OrganizationList>
   <Organization>
      <Name>Bharath</Name>
      <System>automotive</System>
      <main>Y</main>
   </Organization>
   <Organization>
      <Name>ATP</Name>
      <System>supply</System>
      <main>N</main>
   </Organization>
   <Organization>
      <Name>BSNL</Name>
      <System>service</System>
      <main>Y</main>
   </Organization>
</OrganizationList>


If we want to sort the above xml based on the value of main tag we can use the following approach




<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
   <xsl:template match="node()">
      <xsl:copy>
         <xsl:apply-templates />
      </xsl:copy>
   </xsl:template>
   <xsl:template match="OrganizationList">
      <xsl:copy>
         <xsl:apply-templates>
            <xsl:sort order="descending" select="main" />
         </xsl:apply-templates>
      </xsl:copy>
   </xsl:template>
</xsl:stylesheet>


The result will be as shown below



<?xml version="1.0" encoding="UTF-8"?>
<OrganizationList>
   <Organization>
      <Name>Bharath</Name>
      <System>automotive</System>
      <main>Y</main>
   </Organization>
   <Organization>
      <Name>BSNL</Name>
      <System>service</System>
      <main>Y</main>
   </Organization>
   <Organization>
      <Name>ATP</Name>
      <System>supply</System>
      <main>N</main>
   </Organization>
</OrganizationList>





xquery : increment index in for each loop

Unlike java we cannot increment a variable's value in xquery while using for loop.

Say for e.g if we declare the following count variable in xquery and try to use it in the mapping, it will never work as we expect

 let $count := 0
 for $record at $position in $collection/books
                    let $count :=  $count + 1

                    return
                     <ns1:books>
                        <ns1:name>{ $record/name }</ns1:name>
                        <ns1:sequence>{ $count) }</ns1:sequence>
</ns1:books>


Instead we can use the following approach.

While declaring the for loop also declare a position variable.

Use this position variable in the place of count as follows


 for $record at $position in $collection/books
                   return
                     <ns1:books>
                        <ns1:name>{ $record/name }</ns1:name>
                        <ns1:sequence>{ $position) }</ns1:sequence>
   </ns1:books>

Monday, March 25, 2013

How to connect to a remote database using sqlplus

Often we might need to connect to remote database servers using sqlplus.

In such cases we can use the following connection string format

Open command prompt and execute the following line after giving proper values for

1)remotehostname
2)portnumber
3)sid
4)username
5)password


sqlplus username/password@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST= remotehostname)(PORT=portnumber)))(CONNECT_DATA=(SID=sid)))'




Wednesday, March 13, 2013

OSB : Dynamically Change the end point for Business Service

There could be a requirement to change the endpoints dynamically while invoking external service from  OSB.

This can be achieved by injecting the endpoint just before the service invocation.

Configure the endpoints in an .xq file as shown



Assign the content of xq file to a variable



In the message flow add an xpath expression and assign the target endpoint value to a variable



In the service-callout/publish/routing RequestAction block , add a Routing Option and update the URI using the above created variable






Table is mutating, trigger/function may not see it

If you write a trigger to act on the same table, we could end up with the following error.

table TRANSACTION is mutating, trigger/function may not see it

This is due to the trigger is trying to act on the record which is getting inserted.

So if use an AFTER INSERT trigger, it will always fail.

Instead we can use BEFORE INSERT construct as shown below.

Here the source application trying to insert a record with status value either PROCESSED or INPROCESS

But if you have a requirement to get the status as 'NOT PROCESSED' for your application to process that record, we can update the source record before it commits to DB

================ Trigger Start=============================

create or replace
TRIGGER "ORAUSER"."TRANSACTION_INSERT"
BEFORE INSERT
ON ORAUSER.TRANSACTION
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
v_event_seq NUMBER;
s_error VARCHAR2(256);

BEGIN

   IF :new.STATUS ='PROCESSED' OR :new.STATUS ='INPROCESS' THEN
           :new.STATUS :='NOT PROCESSED';
END IF;
 
   EXCEPTION
     WHEN OTHERS THEN
           BEGIN
   
s_error := SUBSTR(TO_CHAR(SQLCODE)||' '||SQLERRM,1,256);  
SELECT event_seq.NEXTVAL
INTO v_event_seq
FROM dual;  
INSERT INTO ERROR_TABLE
        VALUES (v_event_seq,s_error,:new.TRANSACTION_ID,'ERROR','TRANSACTION_INSERT',1,SYSDATE,0,NULL);
             
      END;
END TRANSACTION_INSERT;



=================Trigger End==============================

DB Polling Issue in Cluster

DB Polling is always a challenging requirement. Often we encounter various issues with polling, be it not picking up the record or not updating the status. Some times we can see there are duplicate BPEL instances created for the same record.

The duplicate instances mainly happens in clustered environment where as each node will try to poll the same record.

This can be avoided in two ways

One by choosing the Distributed Polling option while configuring the DB Adapter. Once this is selected it means the record is locked by the reading instance. No other instance can read the record. In that way duplicate instances can be avoided


The second approach is to set a singleton parameter for the JCA in the composite.xml


    <binding.jca config="triggerTransaction_db.jca">
             <property name="singleton">true</property>
    </binding.jca>

In this case too only one node will poll the record and duplicates will be avoided


Tuesday, February 19, 2013

How to send a message to REST service from OSB

If we want to post a message to REST service using OSB, we can do it in the following way.

Step1 : Create an generic business service.

  Select the type as Messaging Service


Choose xml as input and output message type


Select the default options in the next tabs and give the endpoint of the REST service to be invoked
 
Thats all we need to do for the business service.

Step2: Create a proxy service of xml service type


Select the defaults and complete the configuration of the proxy service.

Step 3: Create a message flow as shown below. Invoke the above created business service in the message flow as a service call out.

In the Request Action step do the following .

The first assign statement set the payload to be send to the REST service.

The critical steps are the following.

Using the TransportHeader step, set the headers to consume the rest service as shown below

In the next Insert step, overwrite the HTTP method to whatever we require. i.e: GET,POST,PUT,DELETE.MERGE etc.



Thats about the service configuration. Now test the proxy service by sending the required payload for the REST service.


Friday, February 8, 2013

Failed to resolve outbound connection pool JNDI for Adapter

There are situations the Adapter outbound connection pool configuration might not reflect at run time and often the service invocation fails due to failure to locate the JNDI.

If we verify the Adapter Configuration screen, the outboundconnection pool JNDIs will be visible.
So why does this error happen?

In such situations its worth to check whether the connection pool JNDI configuration is really updated in the weblogic-ra.xml file.

The weblogic-ra.xml file is located inside every Adapter.rar/META-INF

Most probably the entries we seen in the console will not be available in the weblogic-ra.xml.

To resolve this isssue, unzip the Adapter.rar file to a location, add the connection instance details manually to weblogic-ra.xml and repack the Adapter.rar .


Now copy this Adapter.rar to a new location under the domain.




Before installing the new RAR file, delete the existing adapter from admin console

Goto admin console ->deployments->Goto the respective adatper and delete it .






Once it is deleted , install the newly packed Adapter.rar file from the new location.








At the end select the plan.xml from the same folder itself.

Once the adapter is installed, verify the outbound connection pool configuration and ensure that all the JNDIs are visible over there
Note : If any change done to this JNDI configuration, then the adapter has to be updated to reflect the change.

Monday, January 28, 2013

Failed to bind - Apache Tomcat startup error

By default tomcat runs on port 8080. But if any other application is using this port, tomcat wont start properly unless we change the binding port.

To change the port do the following

Goto Tomcat installation/unzipped folder



Goto the conf folder and open the server.xml file


Change the default port to the available port


Save the file

Goto the bin folder and make a copy of startup.bat as startup-always.bat



Edit the startup-always bat file

Instead of call

"%EXECUTABLE%" start %CMD_LINE_ARGS%

change to in the startup-always.bat

call "%EXECUTABLE%" run %CMD_LINE_ARGS%



Now run the new batch file startup-always.bat

It will start Tomcat and now the welcome page will appear as



Tuesday, January 15, 2013

Customizing BPM process using BPM Composer

Business needs to be agile!  Which means business has to respond to the customer needs very quickly. Technology should support business in achieving this agility.

In BPM it is possible to customize the business process by the business analysts. To customize an existing process it is not required to have the deep technical knowledge. Business can change the implementation of a  process using the BPM composer.

The approach is to make the project as a template by the developer and publish to MDS.

The business analyst can create an customized version of the process from this template project using BPM Composer

I am using the same process used in my previous blog for this example.

The first step is to convert the BPM project to template as follows


Create a MDS Database connection from JDev


Create an IDE connection using the above MDS connection


Identify the activities which can be customized by business people from the BPM Composer.

Here lets take ApproveRequest task as the customizable activity. Ensure the permissions given is "Must Implement"


Now the ApproveRequest task will have an identification as it is customizable


Save the changes and publish the project to MDS as shown below


Create a new folder under the location as shown below and click OK


This will publish the project as a template to MDS

Now logon to BPM Composer



Click on the "New Project" icon



Give appropriate name for the process and select the template as "ReservationProject"


Click on next and Finish


The new process will appear in the next screen. Click on the highlighted link to customize it


The activity which has to be implemented will be highlighted as below



On the right hand side menu, choose the Human Task section under Business Catalog.
Drag and drop the ApproveRequest Task to the highlighted activity




The various activity parameters can be changed as per the new business requirement

 Here I have changed the description of the activity and the Action values


Validate the project and Save



Now go to the project menu and select the deployment option



 Give the necessary info for deployment and deploy the customized version of processs

Calling Async BPEL process from BPM

BPM can call Async BPEL processes. To achieve this feature BPM uses the send and receive activities

Here is a sample BPM process which calls an Async BPEL Process

The BPM process does hotel room reservation. It has three roles.
1) The assistant who is making a request for room reservation
2) The manager who approves assistant's request
3) The receptionist who finally confirms the reservation

Please refer my previous blog on how to create a sample BPM processs


Here is the sample BPM process which does the reservation job



Now lets create a Async BPEL Process which takes a string value as input and sends the string "VERIFIED" as output


 Deploy this BPEL process

Now add the send and receive activity to the flow in the manager's swim line as shown below


 We can see the warning signs on the Send and Receive activities now. To remove the warnings we need to configure the parameters for these activities.

Go to the composite.xml of the BPM project and add a webservice resource using the wsdl of the deployed Async BPEL process


 Now click on the Send Activity and configure the service details as follows

Similarly configure the call back operation for the receive activity


Now the warnings on the Send and Receive activity will be disappeared

Now deploy the BPM Project and logon to the BPM workspace.

The deployed process will be visible in the application list


Click on the link , and initiate the process by submitting a booking request


Now open the em console and we can see an instance of the BPEL process got created for the VerificationAsync Process

 After some delay now the Approval Request will appear in the task list. The call to BPEL for verification is completed before the approval task is created.


Now Approve the request and the flow will move to confirm reservation, which will be done by the receptionist