Search This Blog

Saturday, September 24, 2016

Create WLST Project in Eclipse

Create WLST Project in Eclipse
File -> New -> Project and Select Faceted Project



Select Java -> 1.6 or 1.7



select Oracle WLST , Oracle Weblogic Utility Module Extensions , Utility Module


In the Runtime tab select Oracle Weblogic Server and click on Finish



and click on Finish 

File->New -> Select Another 


This creates test1.py with some sample code. Please change the password and the serverurl and run the project.







Tags: Publish
September 25, 2016 at 11:04AM
Open in Evernote

Thursday, September 22, 2016

How to Automate Email Server setting's for Human WorkkFlow in SOA 11g and and 12c

How to Automate Email Server setting's for Human WorkkFlow in SOA 11g and and 12c
How to Automate Email Server setting's for Human WorkFlow in SOA 11g 


First run the program

c:\jdk1.7.0_79\jre\bin\java.exe -classpath D:\fmw1117\Middleware\Oracle_SOA1\soa\modules\oracle.soa.workflow_11.1.1\bpm-services.jar;D:\fmw1117\Middleware\wlserver_10.3\server\lib\wljmxclient.jar oracle.bpel.services.notification.util.ConfigureNotification

and then run with the getConfig option , this creates a blank notification.properties with all the properties if you have n't configured email previously

c:\jdk1.7.0_79\jre\bin\java.exe -classpath D:\fmw1117\Middleware\Oracle_SOA1\soa\modules\oracle.soa.workflow_11.1.1\bpm-services.jar;D:\fmw1117\Middleware\wlserver_10.3\server\lib\wljmxclient.jar oracle.bpel.services.notification.util.ConfigureNotification localhost 7001 weblogic Welcome1 WLS notification.properties getConfig

This writes the file notification.properties in the following format ,

+++

c:\jdk1.7.0_79\jre\bin\java.exe -classpath  D:\bpm12cqs\soa\soa\modules\oracle.soa.workflow_11.1.1\bpm-services.jar;D:\bpm12cqs\wlserver\server\lib\wljmxclient.jar oracle.bpel.services.notification.util.ConfigureNotification  iscsoavm21.idc.oracle.com 7001 weblogic Welcome1 WLS notification.properties getConfig
Hostname :[iscsoavm21.idc.oracle.com] Port :[7001] AdminUser :[weblogic] AppServer :[WLS] propertyfile :[notification.properties] flag :[getConfig]
Retrieving usermessagingdriver-email-driverconfig ....
OutgoingMailServer=
OutgoingMailServerPort=25
OutgoingMailServerSecurity=None
OutgoingEmailId=
OutgoingUsername=
OutgoingPassword=
MailAccessProtocol=IMAP
IncomingMailServer=
IncomingMailServerPort=
IncomingMailServerSSL=false
IncomingEMailId=
IncomingUsername=
IncomingPassword=
ImapAuthPlainDisable=false
RetryLimit=-1
MailDelFreq=600
AutoDelete=false
Debug=false
CheckMailFreq=30
ReceiveFolder=INBOX
ProcessingChunkSize=100
Retrieving worklfow-notification-config ....
HWFMailerNotificationMode=NONE
ASNSDriverEmailReplyAddress=no.reply@yourdomain.com
ASNSDriverEmailFromAddress=accountId@yourdomain.com
ASNSDriverEmailRespondAddress=respondToaccountId@yourdomain.com
Storing the config to the properties file....
Done.

+++

Now open the notification.properties and edit the values as shown below ,

# User Messaging Email Driver config
OutgoingMailServer=localhost
OutgoingMailServerPort=25
OutgoingMailServerSecurity=None
OutgoingEmailId=bpelsender@localhost
OutgoingUsername=bpelsender@localhost
OutgoingPassword=Welcome1
MailAccessProtocol=IMAP
IncomingMailServer=localhost
IncomingMailServerPort=143
IncomingMailServerSSL=false
IncomingEMailId=bpelreceiver@localhost
IncomingUsername=bpelreceiver@localhost
IncomingPassword=Welcome1
ImapAuthPlainDisable=false
RetryLimit=-1
MailDelFreq=600
AutoDelete=false
Debug=false
CheckMailFreq=30
ReceiveFolder=INBOX
ProcessingChunkSize=100
# HWF config
HWFMailerNotificationMode=EMAIL
ASNSDriverEmailReplyAddress=no.reply@yourdomain.com
ASNSDriverEmailFromAddress=bpelsender@localhost
ASNSDriverEmailRespondAddress=bpelreceiver@localhost

Now run the command

c:\jdk1.7.0_79\jre\bin\java.exe -classpath D:\fmw1117\Middleware\Oracle_SOA1\soa\modules\oracle.soa.workflow_11.1.1\bpm-services.jar;D:\fmw1117\Middleware\wlserver_10.3\server\lib\wljmxclient.jar oracle.bpel.services.notification.util.ConfigureNotification localhost 7001 weblogic Welcome1 wls notification.properties setConfig

This will set the required properties for the Email Server Configuration.

To cross check the values you have set run with the getConfig options agian

c:\jdk1.7.0_79\jre\bin\java.exe -classpath  D:\bpm12cqs\soa\soa\modules\oracle.soa.workflow_11.1.1\bpm-services.jar;D:\bpm12cqs\wlserver\server\lib\wljmxclient.jar oracle.bpel.services.notification.util.ConfigureNotification  localhost 14001 weblogic Welcome1 WLS notification.properties getConfig

Please note that this is not available with SOA 12c.



Tags: Publish
September 15, 2016 at 03:25PM
Open in Evernote

Stop DERBY Server in a SOA Quick start Install

Stop DERBY Server in a SOA Quick start Install
Open the file $DOMAIN_HOME/bin/setDomainEnv.sh

and set DERBY_FLAG="false" by default it is set to true.

# Set DERBY_FLAG, if derby is available.

if [ -f ${WL_HOME}/common/derby/lib/derby.jar ] ; then
        DERBY_FLAG="false"
        export DERBY_FLAG
fi




Tags: Publish
September 22, 2016 at 02:54PM
Open in Evernote

Monday, September 19, 2016

Create EMAIL Server Profile in 12c

Create EMAIL Server Profile in 12c
import javax.management.openmbean.CompositeDataSupport;
if __name__ == '__main__':
    from wlstModule import *#@UnusedWildImport
print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:14001'
profileName='testemail'
MailAccessProtocol = 'IMAP'
OutgoingMailServer = 'localhost'
OutgoingMailServerPort = '25'
OutgoingMailServerSecurity = 'None'
OutgoingDefaultFromAddr = 'bpelsender@localhost'
OutgoingUsername = 'bpelsender@localhost'
OutgoingPassword = 'Welcome1'
IncomingMailServer = 'localhost'
IncomingMailServerPort = '143'
IncomingMailIDs = 'bpelreceiver@localhost'
IncomingUserIDs = 'bpelreceiver@localhost'
IncomingUserPasswords = 'Welcome1'
ASNSDriverEmailFromAddress='bpelsender@localhost'
ASNSDriverEmailRespondAddress='bpelreceiver@localhost'
ASNSDriverEmailReplyAddress='no.reply@yourdomain.com'
HWFMailerNotificationMode='EMAIL'
connect(username,password,url)
servers = cmo.getServers()
domainRuntime()
for server in servers:
    serverName = server.getName()
    print 'server: ' + server.getName()
    EmailProfileConfigobj = ObjectName('oracle.ucs.messaging:type=UmsDomainConfig,name=UmsDomainConfiguration')
    print 'Common Properties for soa_server1'
   
    mbs.invoke(EmailProfileConfigobj,'removeDriverConfig',[profileName,'email'],['java.lang.String','java.lang.String'])
   
    mbs.invoke(EmailProfileConfigobj,'createDriverConfig',[profileName,'email'],['java.lang.String','java.lang.String'])
    print mbs.invoke(EmailProfileConfigobj,'getDriverConfig',[profileName,'email'],['java.lang.String','java.lang.String'])
   
    EmailDriverConfigobj = ObjectName('oracle.ucs.messaging:name='+profileName+',type=UmsDomainConfig.DriverConfig,driverType=email,UmsDomainConfig=UmsDomainConfiguration')
    mbs.invoke(EmailDriverConfigobj,'setProperty',['MailAccessProtocol',MailAccessProtocol],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingMailServer',OutgoingMailServer],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingMailServerPort',OutgoingMailServerPort],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingMailServerSecurity',OutgoingMailServerSecurity],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingDefaultFromAddr',OutgoingDefaultFromAddr],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingUsername',OutgoingUsername],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['OutgoingPassword',OutgoingPassword],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['IncomingMailServer',IncomingMailServer],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['IncomingMailIDs',IncomingMailIDs],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['IncomingUserIDs',IncomingUserIDs],['java.lang.String','java.lang.String'])
    mbs.invoke(EmailDriverConfigobj,'setProperty',['IncomingUserPasswords',IncomingUserPasswords],['java.lang.String','java.lang.String'])
    props1 = mbs.getAttribute(EmailDriverConfigobj, 'Properties')
   
    for props2 in props1:
            print str(props2.get('name')) +' = ' + str(props2.get('value'))
   
    WorkflowNotificationObj = ObjectName('oracle.as.soainfra.config:Location='+serverName +',name=human-workflow,type=HWFMailerConfig,Application=soa-infra')
    mbs.setAttribute(WorkflowNotificationObj, Attribute('ASNSDriverEmailFromAddress', ASNSDriverEmailFromAddress))
    mbs.setAttribute(WorkflowNotificationObj, Attribute('ASNSDriverEmailRespondAddress', ASNSDriverEmailRespondAddress))
    mbs.setAttribute(WorkflowNotificationObj, Attribute('ASNSDriverEmailReplyAddress', ASNSDriverEmailReplyAddress ))
    mbs.setAttribute(WorkflowNotificationObj, Attribute('HWFMailerNotificationMode', HWFMailerNotificationMode))
   
    print 'HWFMailerNotificationMode' +' = '+ mbs.getAttribute(WorkflowNotificationObj, 'ASNSDriverEmailReplyAddress')
    print 'ASNSDriverEmailFromAddress' +' = '+ mbs.getAttribute(WorkflowNotificationObj, 'ASNSDriverEmailFromAddress')
    print 'ASNSDriverEmailRespondAddress' +' = '+ mbs.getAttribute(WorkflowNotificationObj, 'ASNSDriverEmailRespondAddress')
    print 'HWFMailerNotificationMode' +' = '+ mbs.getAttribute(WorkflowNotificationObj, 'HWFMailerNotificationMode')
   


Tags: Publish
September 19, 2016 at 03:45PM
Open in Evernote

Monday, March 28, 2016

How to find out which jar file is loading the class I am looking for ??

In SOA add the following java code to BPEL Java embeding activity 

++++
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        try {


System.out.println(Class.forName("oracle.tip.adapter.ftp.SFTPClient").getProtectionDomain().getCodeSource().getLocation());

        }
        catch(Exception e1)
        {
         e1.printStackTrace();
        }

System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");
+++

Result :

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


You can also add the flag 

export JAVA_OPTIONS="-verbose:class". This writes all the class loading
information to the standard out file.

This displays messages like

[Loaded oracle.tip.adapter.ftp.SFTPAgent from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar]
[Loaded oracle.tip.adapter.ftp.SFTPClient from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar]
[Loaded oracle.tip.adapter.file.outbound.FileLister from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0soa/fmw/SOA/soa/connectors/FileAdapter.rar]


Use different user directories for different Jdeveloper versions

In my system I have 4 jdev versions installed , jdev 11.1.1.7 , jdev 11.1.1.9 , jdev 12.1.3 and jdev 12.1.3

by default when i create a new application or project it is creating under the directory C:\JDeveloper\mywork
this is causing too much confusions for me in opening up the projects.

First create user environment variable's

JDEV1117_USER_HOME=d:\myjdevwork\jdev1117
JDEV1119_USER_HOME=d:\myjdevwork\jdev1119
JDEV1213_USER_HOME=d:\myjdevwork\jdev1213
JDEV1221_USER_HOME=d:\myjdevwork\jdev1221

Open the file D:\jdev1117\jdeveloper\jdev\bin\jdev.boot

and comment the variable ide.user.dir.var and add the following 

#ide.user.dir.var = JDEV_USER_HOME,JDEV_USER_DIR
ide.user.dir.var = JDEV1117_USER_HOME

Do the same for jdev 12.1.3 
D:\soa12cqs\jdeveloper\jdev\bin\jdev.boot

#ide.user.dir.var = JDEV_USER_HOME,JDEV_USER_DIR

ide.user.dir.var = JDEV1213_USER_HOME

Monday, September 21, 2015

How to get the username from BPEL code

I have an requirement where Composite-A (SAML1Call) call Calls Composite-B (SAML1)

I have created a new project , SAML1 with
oracle/wss11_saml_token_with_message_protection_service_policy
This is called from SAML1Call SOA composite

SAML1Call uses oracle/wss_username_token_service_policy for the inbound
and oracle/wss11_saml_token_with_message_protection_client_policy for calling
the SAML1 composite
 

We would like to get the UserName from BPEL code 


Please check the enhancment request
Bug 21247695 - Need extract currently logged in security user name in BPEL
easily


How to get the security header parameters in a BPEL process (Doc ID
2021281.1)

You need to copy the file jps-api.jar to your bpel project SCA-INF\lib
directory

for example ,

copy
D:\fmw1117\Middleware\oracle_common\modules\oracle.jps_11.1.1\jps-api.jar
C:\JDeveloper\mywork\test1\SAML1\SCA-INF\lib

define a bpel variable say CurrentLoggedInUser with XML type as string and
have the following java embeding activity

++
 javax.security.auth.Subject currentSubject =
oracle.security.jps.util.SubjectUtil.getCurrentSubject();
String   userName =
oracle.security.jps.util.SubjectUtil.getUserName(currentSubject);
System.out.println(" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");
System.out.println(" In the SAML1 Composite "+userName);
System.out.println(" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");
setVariableData("CurrentLoggedInUser",userName);
++

Sunday, July 06, 2014

SOA 12c Install error Insufficient free space

 

While trying to install getting an error

 

java -jar fmw_12.1.3.0.0_soa_quickstart.jar
Launcher log file is /tmp/OraInstall2014-07-07_11-50-41AM/launcher2014-07-07_11-50-41AM.log.
Insufficient free space in /tmp/orcl965540478413729726.tmp to extract the installer.  Actual 153 MB.  Required 3053 MB.

As I do not have sufficent space in /tmp directory used the following workaround.

Create a directory /fmw11g/tmp

export _JAVA_OPTIONS="-Djava.io.tmpdir=/fmw11g/tmp"

Now when you start the installer you see the o/p as

java -jar fmw_12.1.3.0.0_soa_quickstart.jar
Picked up _JAVA_OPTIONS: -Djava.io.tmpdir=/fmw11g/tmp
Launcher log file is /fmw11g/tmp/OraInstall2014-07-07_11-56-55AM/launcher2014-07-07_11-56-55AM.log.

Monday, January 13, 2014

Opatch fails with the error java.lang.UnsatisfiedLinkError: Can't load library ../oui/lib/linux/liboraInstaller.so

 

OPatch giving an error on 64 bit linux with 64 bit JDK
java.lang.UnsatisfiedLinkError: Can't load library: /fmw11g/fmw1116/Middleware/oracle_common/oui/lib/linux/liboraInstaller.so
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1706)
        at java.lang.Runtime.load0(Runtime.java:770)
        at java.lang.System.load(System.java:1004)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.loadNativeLib(OiipuUnixOps.java:402)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.<clinit>(OiipuUnixOps.java:126)
        at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.ssgetUidux(OiipgEnvironment.java:528)
        at oracle.sysman.oii.oiix.OiixEnvironmentOps.ssgetUidux(OiixEnvironmentOps.java:159)
        at oracle.opatch.OUIReplacer.isRootAccess(OUIReplacer.java:741)
        at oracle.opatch.OPatch.main(OPatch.java:513)
Exception in thread "Main Thread" java.lang.UnsatisfiedLinkError: no oraInstaller in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1029)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.loadNativeLib(OiipuUnixOps.java:420)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.<clinit>(OiipuUnixOps.java:126)
        at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.ssgetUidux(OiipgEnvironment.java:528)
        at oracle.sysman.oii.oiix.OiixEnvironmentOps.ssgetUidux(OiixEnvironmentOps.java:159)
        at oracle.opatch.OUIReplacer.isRootAccess(OUIReplacer.java:741)
        at oracle.opatch.OPatch.main(OPatch.java:513)
Modify the file
/fmw11g/fmw1116/Middleware/wlserver_10.3/common/bin/commEnv.sh
and Change the
SUN_ARCH_DATA_MODEL="64"
JAVA_USE_64BIT=true
JAVA_HOME variable to /home/oracle/jdk1.6.0_45_64  and
JAVA_VENDOR variable to Sun.
for example ,
# Setup SUN_ARCH_DATA_MODEL
SUN_ARCH_DATA_MODEL="64"
#JAVA_USE_64BIT, true if JVM uses 64 bit operations
JAVA_USE_64BIT=true
# Reset JAVA_HOME, JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
# and JAVA_VENDOR are pre-defined.
if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
  # Set up JAVA HOME
  JAVA_HOME="/home/oracle/jdk1.6.0_45_64"
  # Set up JAVA VENDOR, possible values are
  #Oracle, HP, IBM, Sun ...
  JAVA_VENDOR=Sun
  # PRODUCTION_MODE, default to the development mode
  PRODUCTION_MODE=""
fi

https://blogs.oracle.com/fmwinstallproactive/entry/which_jdk_is_my_fmw

Tuesday, November 19, 2013

How to print the XML data for a variable in BPEL

 

You can use the following java embedded  code 

try { 
  System.out.println("+++++++ Printing XML Variables ++++++++++ (Start) "+getInstanceId());  
    oracle.xml.parser.v2.XMLElement input = (oracle.xml.parser.v2.XMLElement) getVariableData("transactionDataArray");  
  System.out.println(" ++++ qname "+input.getQualifiedName() );  
javax.xml.transform.TransformerFactory tfactory = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer xform = tfactory.newTransformer();
javax.xml.transform.dom.DOMSource src = new  javax.xml.transform.dom.DOMSource(input);
java.io.StringWriter writer = new java.io.StringWriter();
javax.xml.transform.Result  result = new javax.xml.transform.stream.StreamResult(writer);
xform.transform(src, result);
System.out.println(writer.toString());
  System.out.println("+++++++ Printing XML Variables ++++++++++ (End) "+getInstanceId());
} catch (Exception e) {  
  System.out.println("exception "+e.getMessage());  
}

This will print the XML string for an variable.

Wednesday, October 23, 2013

Changing the Java Memory Settings for the WebLogic Server Based on Server Name

 


In Unix/Linux

Add these lines to $DOMAIN_HOME/bin/startWeblogic.sh file ,
 
+=+= Start +=+=
if [ "$SERVER_NAME" = "AdminServer"  ]
then
export MEM_ARGS="-Xms512m -Xmx1560m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=64m"
fi

if [ "$SERVER_NAME" = "bam_server1"  ]
then
export MEM_ARGS="-Xms512m -Xmx756m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=64m"
fi

echo "================================ Memory Arguments for " $SERVER_NAME " " $MEM_ARGS

+=+= End  +=+=

Add the above libes after the line ,

. ${DOMAIN_HOME}/bin/setDomainEnv.sh $*

 

In Windows

+=+= Start +=+=
if "%SERVER_NAME%"=="AdminServer" (
set MEM_ARGS=
set MEM_ARGS=-Xms512m -Xmx1586m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=64m
       
    )
   
if "%SERVER_NAME%"=="bam_server1" (
set MEM_ARGS=
set MEM_ARGS=-Xms212m -Xmx556m -XX:PermSize=212m -XX:MaxPermSize=312m -XX:ReservedCodeCacheSize=64m
       
    )
   
echo  ===================== Memory Arguments for  %SERVER_NAME%  %MEM_ARGS%   
+=+= End  +=+=


Add the above libes after the line

call "%DOMAIN_HOME%\bin\setDomainEnv.cmd" %*

Friday, October 18, 2013

Create SOA related Queues

 

-- Drop and create IP_IN_QUEUE related queue tables , queues etc
begin
dbms_aqadm.stop_queue (queue_name => 'IP_IN_QUEUE');
dbms_aqadm.drop_queue (queue_name => 'IP_IN_QUEUE');
dbms_aqadm.stop_queue (queue_name => 'IP_OUT_QUEUE');
dbms_aqadm.drop_queue (queue_name => 'IP_OUT_QUEUE');
dbms_aqadm.drop_queue_table (queue_table => 'IP_QTAB');
end;
 
BEGIN
   dbms_aqadm.create_queue_table (queue_table => 'IP_QTAB', queue_payload_type =>  'IP_MESSAGE_TYPE', multiple_consumers => TRUE);
   dbms_aqadm.create_queue (queue_name =>  'IP_IN_QUEUE', queue_table =>  'IP_QTAB');
   dbms_aqadm.create_queue (queue_name => 'IP_OUT_QUEUE', queue_table => 'IP_QTAB');
   dbms_aqadm.start_queue(queue_name => 'IP_IN_QUEUE', dequeue => TRUE, enqueue => TRUE);
   dbms_aqadm.start_queue(queue_name =>  'IP_OUT_QUEUE', dequeue => TRUE, enqueue => TRUE);
END;

-- Drop and create  edn_event_queue related related queue tables , queues etc and subscribers

begin
  DBMS_AQADM.stop_queue(queue_name=>'edn_event_queue');
  DBMS_AQADM.drop_queue(queue_name=>'edn_event_queue');
  DBMS_AQADM.drop_queue_table(queue_table=>'edn_event_queue_table');
end;

begin
  DBMS_AQADM.create_queue_table(
    queue_table         => 'edn_event_queue_table',
    queue_payload_type  => 'EDN_EVENT_DATA',
    multiple_consumers  => TRUE);
   
  DBMS_AQADM.create_queue(
    queue_name          => 'edn_event_queue',
    queue_table         => 'edn_event_queue_table');
  DBMS_AQADM.start_queue(queue_name=>'edn_event_queue');
end;

REM  Register Fabric subscriber
declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_java_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_event_queue', subscriber=>sub);
end;

REM  Register SQL subscriber
declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_sql_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_event_queue', subscriber=>sub);
end;

--  Drop and create  edn_oaoo_queue related related queue tables , queues etc and subscribers

begin
  DBMS_AQADM.stop_queue(queue_name=>'edn_oaoo_queue');
  DBMS_AQADM.drop_queue(queue_name=>'edn_oaoo_queue');
  DBMS_AQADM.drop_queue_table(queue_table=>'edn_oaoo_delivery_table');
end;
/

begin
  DBMS_AQADM.create_queue_table(
    queue_table         => 'edn_oaoo_delivery_table',
    queue_payload_type  => 'edn_oaoo_delivery',
    multiple_consumers  => TRUE);
  DBMS_AQADM.create_queue(
    queue_name          => 'edn_oaoo_queue',
    queue_table         => 'edn_oaoo_delivery_table');
  DBMS_AQADM.start_queue(queue_name=>'edn_oaoo_queue');
end;


declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_oaoo_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_oaoo_queue', subscriber=>sub);
end;

Friday, August 16, 2013

Byteman Oracle JDBC Tracing

 

Extract byteman to a directory say , javac -cp lib/byteman.jar HelperSub.java 

First compile the helper class

javac -cp lib/byteman.jar HelperSub.java 

Make a jar file of this helper class

jar cvf HelperSub.jar HelperSub.class

Find the pid of the process 

jps -l
10065 org.apache.derby.drda.NetworkServerControl
14085
19782 weblogic.Server
20846 sun.tools.jps.Jps

Install the byteman agent to running jvm 

bin/bminstall.sh 19782

Load the heloper jar file

bmsubmit.sh -s /home/oracle/byteman-download-2.1.3/HelperSub.jar 

Load the rules

bmsubmit.sh  -l ../OracleJDBCTracing.btm 

run bmsubmit.sh with out any arguments to see whether it got loaded or not

to unload the rules use 

./bmsubmit.sh -u

Rules to trace Oracle JDBC Statements

OracleJDBCTracing.btm
## EXECUTION TIME #############
RULE OracleStatement Code StartTimer
CLASS  oracle.jdbc.driver.OracleStatement
METHOD  doExecuteWithTimeout()
HELPER HelperSub
AT ENTRY
BIND app1 = $0;
m2 = app1.sqlObject.getOriginalSql()
IF true
DO createTimer($0);
ENDRULE
RULE OracleStatement Code Insert AT EXIT StopTimer
CLASS  oracle.jdbc.driver.OracleStatement
METHOD  doExecuteWithTimeout()
HELPER HelperSub
AT EXIT
IF true
DO tracelnplain("Execution Time ("   + Integer.toHexString($0.hashCode()).toUpperCase() + ") : "+ getElapsedTimeFromTimer($0) +" ms");
deleteTimer($0);
ENDRULE
##+  $this.getOriginalSql()
RULE OracleStatement Code Insert
CLASS  oracle.jdbc.driver.OracleStatement
METHOD  doExecuteWithTimeout()
HELPER HelperSub
AT ENTRY
BIND app1 = $0;
m2 = app1.sqlObject.getOriginalSql()
IF true
DO tracelnwithdate(  " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") " +  " SQL : "+ m2  ) ;
ENDRULE
RULE OracleStatement Code Insert AT EXIT
CLASS  oracle.jdbc.driver.OracleStatement
METHOD  doExecuteWithTimeout()
HELPER HelperSub
AT EXIT
IF true
DO tracelnplain("-------------------------------------------------------------------------------- ");
ENDRULE
############# Get the Parameters from OraclePreparedStatement
HELPER HelperSub
RULE OraclePreparedStatement Code Insert setArray
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setArray(int,java.sql.Array)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Array) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setAsciiStream
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setAsciiStream(int,java.io.InputStream)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (AsciiStream) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setAsciiStream 3 params
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setAsciiStream(int,java.io.InputStream,long length)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (AsciiStreamWithLength) P"  + $1 + " ==> " +$2 + " ==> " +$3  )
ENDRULE
RULE OraclePreparedStatement Code Insert setBigDecimal
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setBigDecimal(int,java.math.BigDecimal)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BigDecimal) P"  + $1 + " ==> " +$2  )
ENDRULE
RULE OraclePreparedStatement Code Insert setBoolean
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setBoolean(int,boolean)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (bool) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setByte
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setByte(int,byte)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Byte) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setBytes
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setBytes(int,byte[])
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Bytes) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert      setCharacterStream
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD setCharacterStream(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert      setCharacterStream 3
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD setCharacterStream(int,java.io.Reader,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream-With-length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert      setCharacterStream 3 long
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD setCharacterStream(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream-With-length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setClob
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setClob(int,java.sql.Clob)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Clob) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setClob Reader
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setClob(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Reader) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setClob Reader 3
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setClob(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Reader-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setDate
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setDate(int,java.sql.Date)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Date) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setDate Calendar
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setDate(int,java.sql.Date,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Calendar) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setDouble
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setDouble(int,double)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (double) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setFloat
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setDouble(int,float)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Float) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setInt
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setInt(int,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (int) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setLong
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setLong(int,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (long) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert      setNCharacterStream
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setNCharacterStream(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (NCharacterStream) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setNCharacterStream long
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setNCharacterStream(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (NCharacterStream-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setNClob
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setNClob(int,java.sql.NClob)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (NClo) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setNString
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setNClob(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (NString) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setNull
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setNull(int,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Null) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setObject
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setObject(int,java.lang.Object)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OraclePreparedStatement Code Insert setObject(int,java.lang.Object,int )
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setObject(int,java.lang.Object,int )
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object-SqlType) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setObject(int,java.lang.Object,int,int )
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setObject(int,java.lang.Object,int,int )
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object-SqlType-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3 +" ==> " +$3)
ENDRULE
RULE OraclePreparedStatement Code Insert setRowId
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setRowId(int,java.sql.RowId)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (RowId) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setShort
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setShort(int,short)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Short) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setSQLXML
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setSQLXML(int,java.sql.SQLXML)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (SQLXML) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setString
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setString(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (String) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setTime
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setTime(int,java.sql.Time)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Time) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OraclePreparedStatement Code Insert setTime Calendar
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setTime(int,java.sql.Time,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Time-Calendar) P"  + $1 + " ==> " +$2  + " ==> " +$3 )
ENDRULE
RULE OraclePreparedStatement Code Insert setTimestamp
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setTimestamp(int,java.sql.Timestamp)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Timestamp) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OraclePreparedStatement Code Insert setTimestamp Calendar
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setTimestamp(int,java.sql.Timestamp,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Timestamp-Calendar) P"  + $1 + " ==> " +$2  + " ==> " +$3 )
ENDRULE
RULE OraclePreparedStatement Code Insert setURL
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setURL(int,java.net.URL)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (URL) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OraclePreparedStatement Code Insert setStringForClob
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setStringForClob(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (StringForClob) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OraclePreparedStatement Code Insert setBinaryFloat
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setBinaryFloat(int,oracle.sql.BINARY_FLOAT)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BinaryFloat) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OraclePreparedStatement Code Insert setBinaryDouble
CLASS  oracle.jdbc.driver.OraclePreparedStatement
METHOD  setBinaryDouble(int,oracle.sql.BINARY_DOUBLE)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BinaryDouble) P"  + $1 + " ==> " +$2   )
ENDRULE
############# Get the Parameters from OracleCallableStatement ###########
RULE OracleCallableStatement Code Insert setArray
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setArray(int,java.sql.Array)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Array) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setAsciiStream
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setAsciiStream(int,java.io.InputStream)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (AsciiStream) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setAsciiStream 3 params
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setAsciiStream(int,java.io.InputStream,long length)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (AsciiStreamWithLength) P"  + $1 + " ==> " +$2 + " ==> " +$3  )
ENDRULE
RULE OracleCallableStatement Code Insert setBigDecimal
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setBigDecimal(int,java.math.BigDecimal)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BigDecimal) P"  + $1 + " ==> " +$2  )
ENDRULE
RULE OracleCallableStatement Code Insert setBoolean
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setBoolean(int,boolean)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (bool) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setByte
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setByte(int,byte)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Byte) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setBytes
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setBytes(int,byte[])
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Bytes) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert      setCharacterStream
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD setCharacterStream(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert      setCharacterStream 3
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD setCharacterStream(int,java.io.Reader,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream-With-length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert      setCharacterStream 3 long
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD setCharacterStream(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (CharacterStream-With-length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setClob
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setClob(int,java.sql.Clob)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Clob) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setClob Reader
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setClob(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Reader) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setClob Reader 3
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setClob(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Reader-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setDate
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setDate(int,java.sql.Date)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Date) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setDate Calendar
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setDate(int,java.sql.Date,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Calendar) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setDouble
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setDouble(int,double)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (double) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setFloat
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setDouble(int,float)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Float) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setInt
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setInt(int,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (int) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setLong
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setLong(int,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (long) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert      setNCharacterStream
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setNCharacterStream(int,java.io.Reader)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (NCharacterStream) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setNCharacterStream long
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setNCharacterStream(int,java.io.Reader,long)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (NCharacterStream-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setNClob
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setNClob(int,java.sql.NClob)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (NClo) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setNString
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setNClob(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (NString) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setNull
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setNull(int,int)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Null) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setObject
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setObject(int,java.lang.Object)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object) P"  + $1 + " ==> " +$2)
ENDRULE
RULE OracleCallableStatement Code Insert setObject(int,java.lang.Object,int )
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setObject(int,java.lang.Object,int )
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object-SqlType) P"  + $1 + " ==> " +$2 + " ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setObject(int,java.lang.Object,int,int )
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setObject(int,java.lang.Object,int,int )
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain(" (" + Integer.toHexString(app1.hashCode()).toUpperCase() +") (Object-SqlType-With-Length) P"  + $1 + " ==> " +$2 + " ==> " +$3 +" ==> " +$3)
ENDRULE
RULE OracleCallableStatement Code Insert setRowId
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setRowId(int,java.sql.RowId)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (RowId) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setShort
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setShort(int,short)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Short) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setSQLXML
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setSQLXML(int,java.sql.SQLXML)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (SQLXML) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setString
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setString(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (String) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setTime
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setTime(int,java.sql.Time)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Time) P"  + $1 + " ==> " +$2 )
ENDRULE
RULE OracleCallableStatement Code Insert setTime Calendar
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setTime(int,java.sql.Time,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Time-Calendar) P"  + $1 + " ==> " +$2  + " ==> " +$3 )
ENDRULE
RULE OracleCallableStatement Code Insert setTimestamp
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setTimestamp(int,java.sql.Timestamp)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Timestamp) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OracleCallableStatement Code Insert setTimestamp Calendar
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setTimestamp(int,java.sql.Timestamp,java.util.Calendar)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (Timestamp-Calendar) P"  + $1 + " ==> " +$2  + " ==> " +$3 )
ENDRULE
RULE OracleCallableStatement Code Insert setURL
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setURL(int,java.net.URL)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (URL) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OracleCallableStatement Code Insert setStringForClob
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setStringForClob(int,java.lang.String)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (StringForClob) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OracleCallableStatement Code Insert setBinaryFloat
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setBinaryFloat(int,oracle.sql.BINARY_FLOAT)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BinaryFloat) P"  + $1 + " ==> " +$2   )
ENDRULE
RULE OracleCallableStatement Code Insert setBinaryDouble
CLASS  oracle.jdbc.driver.OracleCallableStatement
METHOD  setBinaryDouble(int,oracle.sql.BINARY_DOUBLE)
AT ENTRY
BIND app1 = $0;
IF true
DO tracelnplain( " (" + Integer.toHexString(app1.hashCode()).toUpperCase() +")  (BinaryDouble) P"  + $1 + " ==> " +$2   )
ENDRULE

HelperSub.java 

==========

import java.io.FileWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jboss.byteman.rule.Rule;
import org.jboss.byteman.rule.helper.Helper;
public class HelperSub extends Helper
{
  public static PrintWriter  fw = null ;
  public HelperSub(Rule paramRule)
  {
    super(paramRule);
  }
  public static void activated()
    {
        System.out.println("=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ in the activated");
      SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("dd-MMM-yy HH:mm:ss.SSS");
      try {
        fw = new PrintWriter("jdbclogs.txt");
      fw.println(" JDBC Logs  on " +localSimpleDateFormat.format(new Date()) +"\n");
      }
      catch (Exception e1) {
        e1.printStackTrace();
      }
    }
    public static void deactivated()
    {
        System.out.println("=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ in the  deactivated");
      try {
       fw.close();
      }
      catch (Exception e1) {
        e1.printStackTrace();
      }
    }
  public boolean tracelnwithdate(String paramString)
  {
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("dd-MMM-yy HH:mm:ss.SSS");
  // System.out.println(localSimpleDateFormat.format(new Date()) + paramString);
  try {
    fw.println(localSimpleDateFormat.format(new Date()) + paramString );
    fw.flush();
  }
  catch (Exception e1) {
    e1.printStackTrace();
  }
    return true;
  }
  public boolean tracelnplain(String paramString)
  {
    try {
      fw.println( paramString );
      fw.flush();
    }
    catch (Exception e1) {
      e1.printStackTrace();
    }
    return true;
  }
}

Monday, August 12, 2013

Coherence Logging in SOA

 

C:\temp\tangosol_coherence_override_1.xml

<coherence>
<cluster-config>
<unicast-listener>
<address system-property="tangosol.coherence.localhost">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.localport">8088</port>
<port-auto-adjust system-property="tangosol.coherence.localport.adjust">true</port-auto-adjust>
<well-known-addresses>
<socket-address id="1">
<address system-property="tangosol.coherence.wka1">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka1.port">8088</port>
</socket-address>
<socket-address id="2">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8089</port>
</socket-address>
<socket-address id="3">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8090</port>
</socket-address>
<socket-address id="4">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8091</port>
</socket-address>
</well-known-addresses>
</unicast-listener>
</cluster-config>
</coherence>

C:\temp\tangosol_coherence_override_2.xml

<coherence>
<cluster-config>
<unicast-listener>
<address system-property="tangosol.coherence.localhost">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.localport">8089</port>
<port-auto-adjust system-property="tangosol.coherence.localport.adjust">true</port-auto-adjust>
<well-known-addresses>
<socket-address id="1">
<address system-property="tangosol.coherence.wka1">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka1.port">8088</port>
</socket-address>
<socket-address id="2">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8089</port>
</socket-address>
<socket-address id="3">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8090</port>
</socket-address>
<socket-address id="4">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8091</port>
</socket-address>
</well-known-addresses>
</unicast-listener>
</cluster-config>
</coherence>

C:\temp\tangosol_coherence_override_3.xml

<coherence>
<cluster-config>
<unicast-listener>
<address system-property="tangosol.coherence.localhost">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.localport">8090</port>
<port-auto-adjust system-property="tangosol.coherence.localport.adjust">true</port-auto-adjust>
<well-known-addresses>
<socket-address id="1">
<address system-property="tangosol.coherence.wka1">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka1.port">8088</port>
</socket-address>
<socket-address id="2">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8089</port>
</socket-address>
<socket-address id="3">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8090</port>
</socket-address>
<socket-address id="4">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8091</port>
</socket-address>
</well-known-addresses>
</unicast-listener>
</cluster-config>
</coherence>

C:\temp\tangosol_coherence_override_4.xml

<coherence>
<cluster-config>
<unicast-listener>
<address system-property="tangosol.coherence.localhost">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.localport">8091</port>
<port-auto-adjust system-property="tangosol.coherence.localport.adjust">true</port-auto-adjust>
<well-known-addresses>
<socket-address id="1">
<address system-property="tangosol.coherence.wka1">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka1.port">8088</port>
</socket-address>
<socket-address id="2">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8089</port>
</socket-address>
<socket-address id="3">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8090</port>
</socket-address>
<socket-address id="4">
<address system-property="tangosol.coherence.wka2">xx.xx.xx.xx</address>
<port system-property="tangosol.coherence.wka2.port">8091</port>
</socket-address>
</well-known-addresses>
</unicast-listener>
</cluster-config>
</coherence>

Start the Coherence Cache on all the four servers using ,

java -cp coherence.jar -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.session.localstorage=true -Dtangosol.coherence.override=c:\temp\tangosol_coherence_override_1.xml com.tangosol.net.DefaultCacheServer
 
java -cp coherence.jar -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.session.localstorage=true -Dtangosol.coherence.override=c:\temp\tangosol_coherence_override_2.xml com.tangosol.net.DefaultCacheServer

java -cp coherence.jar -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.session.localstorage=true -Dtangosol.coherence.override=c:\temp\tangosol_coherence_override_3.xml com.tangosol.net.DefaultCacheServer
 
java -cp coherence.jar -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.session.localstorage=true -Dtangosol.coherence.override=c:\temp\tangosol_coherence_override_4.xml com.tangosol.net.DefaultCacheServer

For Coherence logging ,

Remove the entries , (especially ,  -Dtangosol.coherence.log=jdk)

-Dtangosol.coherence.clusteraddress=xx.x.x.x -Dtangosol.coherence.clusterport=9778 -Dtangosol.coherence.log=jdk
And set the following options , -Dtangosol.coherence.log.level=9 -Dtangosol.coherence.log=/tmp/coherence.log

export JAVA_OPTIONS="-Dtangosol.coherence.log.level=9 -Dtangosol.coherence.log=/tmp/coherence.log"

and start the SOA Server , you will find entries like this ,


WellKnownAddressList(Size=2,
  WKA{Address=xx.xx.x.x, Port=8088}
  WKA{Address=xx.x.x.x.x, Port=8088}
  )

For the ODL logging set the Coherence=TRACE:32 and also log level , oracle.integration.platform = TRACE:32
you will find entries like ,
[2013-08-12T15:35:00.316+05:30] [soa_server2] [NOTIFICATION] [] [Coherence] [tid: Logger@9750876 3.7.1.1] [userId: <anonymous>] [ecid: 0000K1lyeYmESOJpMkS4ye1I2BBN000002,0] [APP: soa-infra] 2013-08-12 15:34:58.482/125.893 Oracle Coherence 3.7.1.1 <Info> (thread=[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational configuration from "jar:file:/fmw11g/fmw1116/Middleware/oracle_common/modules/oracle.coherence/coherence.jar!/tangosol-coherence.xml"