Search This Blog

Wednesday, August 16, 2017

Java Code to Parse SOA Adapter's Plan.xml file

Java Code to Parse SOA Adapter's Plan.xml file
import java.io.File;

import java.util.ArrayList;
import java.util.HashMap;

import java.util.Map;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ParsePlan_XML {

public static void main(String[] args) {
ArrayList<String> jndi_names = new ArrayList<String>();
HashMap<String, String> hm1 = new HashMap<String, String>();

HashMap<String, String> hm = new HashMap<String, String>();



File inputFile = new File(args[0]);

try {

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputFile);
doc.getDocumentElement().normalize();
// System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
NodeList nList = doc.getElementsByTagName("variable");

for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);

if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;

hm.put(eElement.getElementsByTagName("name")
.item(0)
.getTextContent(), eElement.getElementsByTagName("value")
.item(0)
.getTextContent());

}
}
for (Map.Entry m : hm.entrySet()) {
// System.out.println(m.getKey() + " " + m.getValue());
}
} catch (Exception e) {
e.printStackTrace();
}

try {

final String regex_name = "(.*jndi-name=\"eis\\/yum\\/sftpAdapter\"](.*)name=)(.*)]\\/name";

final String regex = ".*jndi-name=(.*)]\\/jndi-name";
//final String string = "/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface=\"javax.resource.cci.ConnectionFactory\"]/connection-instance/[jndi-name=\"eis/yum/sftpAdapter\"]/jndi-name";

// File inputFile = new File("E:\\tars-download\\3-14734264081\\Plan.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputFile);
doc.getDocumentElement().normalize();
// System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
NodeList nList = doc.getElementsByTagName("variable-assignment");

for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
// System.out.println("\nCurrent Element :"
// + nNode.getNodeName());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;

hm1.put(eElement.getElementsByTagName("name")
.item(0)
.getTextContent(), eElement.getElementsByTagName("xpath")
.item(0)
.getTextContent());

final String string = eElement.getElementsByTagName("xpath")
.item(0)
.getTextContent();

for (Map.Entry m : hm1.entrySet()) {
// System.out.println(m.getKey()+" "+m.getValue());

}
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);

while (matcher.find()) {

for (int i = 1; i <= matcher.groupCount(); i++) {
jndi_names.add(matcher.group(i));
// System.out.println("Group " + i + ": " + matcher.group(i));

}
}

}

}

for (int i = 0; i < jndi_names.size(); i++) {

System.out.println();

for (Map.Entry m : hm1.entrySet()) {

String s1 = jndi_names.get(i).replaceAll("/", "\\\\/");
// System.out.println(s1);
String regex_value1 = "(.*jndi-name=" + s1 + "](.*)name=)(.*)]\\/value";
// regex_value= regex_value.replaceAll("/", "\\/");
// System.out.println(regex_value1);
String string = m.getValue().toString();
// System.out.println(string);
final Pattern pattern = Pattern.compile(regex_value1);
final Matcher matcher = pattern.matcher(string);

while (matcher.find()) {
System.out.println(jndi_names.get(i) + " " + matcher.group(3) + " " + hm.get(m.getKey()));
// System.out.println(hm.get(m.getKey()));

}

}
// System.out.println(jndi_names.size());
// System.out.println(jndi_names.get(i));
// System.out.println(string1);

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

}


Tags: Publish
August 16, 2017 at 04:57PM
Open in Evernote

Wednesday, July 19, 2017

Script for getting JVM Import Parameters like threadudmp , java flags , command line arguments etc

Script for getting JVM Important Parameters like threadudmp , java flags , command line arguments etc
jcmd -l | grep weblogic.Server | awk '{print $1}' | while read pid; do
   echo 'Java Properties and Thread Dump for pid ' "$pid" 'Start time' `date`
   echo "$pid" Thread.print
   jcmd "$pid" Thread.print
   echo "$pid" VM.system_properties
   jcmd "$pid" VM.system_properties
   echo "$pid" VM.flags
   jcmd "$pid" VM.flags
   echo "$pid" VM.command_line
   jcmd "$pid" VM.command_line
   echo "$pid" VM.version
   jcmd "$pid" VM.version
   echo "$pid" VM.uptime
   jcmd "$pid" VM.uptime
done




Tags: Publish
July 19, 2017 at 12:08PM
Open in Evernote

Wednesday, April 12, 2017

Read File As attachment from a File Adapter in SOA

Read File As attachment from a File Adapter in SOA








Attach a BPEL process to it with the BPEL code as

 <assign name="Assign1">
      <copy>
        <from expression="ora:getAttachmentContent('Receive1_Read_InputVariable','attach','/ns2:attachmentElement')"/>
        <to variable="Variable1"/>
      </copy>
    </assign>

++

Copy the file test1.xml to the directory /tmp/readattach1.

Open EM and go to the flow trace

for variable1 you should see the data as

<Variable1>
<Variable1  xsi:type="ns:string">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+Cjxwcm9jZXNzIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiCiAgICAgICAgIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL3htbG5zLm9yYWNsZS5jb20vQXBwbGljYXRpb24yL1Byb2plY3QzL0JQRUxQcm9jZXNzMSB4c2QvQlBFTFByb2Nlc3MxLnhzZCIKICAgICAgICAgICAgICAgICAgeG1sbnM9Imh0dHA6Ly94bWxucy5vcmFjbGUuY29tL0FwcGxpY2F0aW9uMi9Qcm9qZWN0My9CUEVMUHJvY2VzczEiPgogICAgICAgICAgICAgICAgICAgIDxpbnB1dD5SQVZJPC9pbnB1dD4KICAgICAgICAgICAgICAgICAgICA8L3Byb2Nlc3M+Cgo=</Variable1>
</Variable1>

This is in base64 encoded format








Tags: Publish
April 12, 2017 at 01:09PM
Open in Evernote

Thursday, April 06, 2017

How to debug OSB server remotely from Jdeveloper

How to debug OSB server remotely from Jdeveloper
For this you need to have a domain created in Development Mode and also if possible create a compact domain.

once this is done identify the DEBUG Port for OSB ,

cd /fmw11g/soa12212/user_projects/domains/osb_domain_cd/bin

find . -name "*" -print | xargs grep -i -l ALSB_DEBUG
./setStartupEnv.sh

find . -name "*" -print | xargs grep -i -l ALSB_DEBUG | xargs cat | grep ALSB_DEBUG

This shows the port as 7453. This is the remote port for the OSB.

Not down the machine name and the above port number.

Open the OSB project in jDeveloper and deploy this project.

Open the pipe line in OSB and set a break point

Right Click on the Project -> Project Properties
Click on Run/Debug 

Create a new Configuration with the name as OSB 




Ensure that remote debugging is set 


Specify the hostname and port


Click on OK and close the dialog boxes.


Click on OSB project 

Now this show's a dialog with debug port and hostname 


Click on OK and invoke the OSB Flow from SOAP UI or from the SB Console.

Now you can do single stepping and watch the variables etc.








Tags: Publish
April 06, 2017 at 12:57PM
Open in Evernote

Monday, April 03, 2017

OSB result Caching support in 11g with external coherence

OSB result Caching support in 11g with external coherence
OSB result Caching support in 11g




Created a simple SOA project with the simple helloworld that displays time+the input parameter you have passed.


for example

concat(xp20:current-dateTime(),bpws:getVariableData('inputVariable','payload','/client:process/client:input'))


Create a OSB project that calls this web service and enable the result cahcing for the business service.
Take this WSDL and import this to OSB and create a business service with this WSDL.

OSB Project 



Create a proxy service based on the business service.

Modify the file

\fmw11g\fmw1117\Middleware\user_projects\domains\soa_domain\config\osb\coherence\osb-coherence-override.xml
======================================================================================================================



<!DOCTYPE coherence SYSTEM "coherence.dtd">
<coherence>
    <cluster-config>
        <!--
            By specifying a well-known-address we disable the mutlicast listener.
            This ensures that the Coherence cluster for OSB will be isolated to this machine only.
        -->
        <unicast-listener>
            <well-known-addresses>
                <socket-address id="1">
                    <address system-property="OSB.coherence.wka1">xxx.xxx.oracle.com</address>
                    <port system-property="OSB.coherence.wka1.port">7890</port>
                </socket-address>
                <socket-address id="2">
                    <address system-property="OSB.coherence.wka2">xxx.xxx.oracle.com</address>
                    <port system-property="OSB.coherence.wka2.port">7898</port>
                </socket-address>
            </well-known-addresses>
            <address system-property="OSB.coherence.localhost">xxx.xxx.oracle.com</address>
            <port system-property="OSB.coherence.localport">7890</port>
        </unicast-listener>
        <multicast-listener>
            <time-to-live system-property="OSB.coherence.ttl">0</time-to-live>
        </multicast-listener>
    </cluster-config>
</coherence>

+++++++++++++

Where
 <socket-address id="1">
                    <address system-property="OSB.coherence.wka1">xxx.xxx.oracle.com</address>
                    <port system-property="OSB.coherence.wka1.port">7890</port>
                </socket-address>

Is for the stand alone Coherence server

<socket-address id="2">
                    <address system-property="OSB.coherence.wka2">xxx.xxx.oracle.com</address>
                    <port system-property="OSB.coherence.wka2.port">7898</port>
                </socket-address>

Is for the OSB Server

No need to change the file
\\soabde11\fmw11g\fmw1117\Middleware\user_projects\domains\soa_domain\config\osb\coherence\osb-coherence-cache-config.xml

Once it is done , open the setDomainEnv.sh file

EXTRA_JAVA_PROPERTIES="${EXTRA_JAVA_PROPERTIES} -Dsoa.archives.dir=${SOA_ORACLE_HOME}/soa -Dsoa.oracle.home=${SOA_ORACLE_HOME} -Dsoa.instance.home=${DOMAIN_HOME} -Dtangosol.coherence.distributed.localstorage=false -DOSB.coherence.localhost=xxx.xxx.oracle.com -DOSB.coherence.localport=7898 -Dtangosol.coherence.wka1=xxx.xxx.oracle.com -Dtangosol.coherence.wka2=xxx.xxx.oracle.com  -Dtangosol.coherence.wka1.port=7898 -Dtangosol.coherence.wka2.port=7890 -Dtangosol.coherence.log=jdk -Djavax.xml.soap.MessageFactory=oracle.j2ee.ws.saaj.soap.MessageFactoryImpl -Dweblogic.transaction.blocking.commit=true -Dweblogic.transaction.blocking.rollback=true -Djavax.net.ssl.trustStore=${WL_HOME}/server/lib/DemoTrust.jks"

The default entries are

#EXTRA_JAVA_PROPERTIES="${EXTRA_JAVA_PROPERTIES} -Dsoa.archives.dir=${SOA_ORACLE_HOME}/soa -Dsoa.oracle.home=${SOA_ORACLE_HOME} -Dsoa.instance.home=${DOMAIN_HOME} -Dtangosol.coherence.clusteraddress=227.7.7.9 -Dtangosol.coherence.clusterport=9778 -Dtangosol.coherence.log=jdk -Djavax.xml.soap.MessageFactory=oracle.j2ee.ws.saaj.soap.MessageFactoryImpl -Dweblogic.transaction.blocking.commit=true -Dweblogic.transaction.blocking.rollback=true -Djavax.net.ssl.trustStore=${WL_HOME}/server/lib/DemoTrust.jks"

basically you need to remove
-Dtangosol.coherence.clusteraddress=227.7.7.9 -Dtangosol.coherence.clusterport=9778
and replace this with
-Dtangosol.coherence.distributed.localstorage=false -DOSB.coherence.localhost=xxx.xxx.oracle.com -DOSB.coherence.localport=7898 -Dtangosol.coherence.wka1=xxx.xxx.oracle.com -Dtangosol.coherence.wka2=xxx.xxx.oracle.com  -Dtangosol.coherence.wka1.port=7898 -Dtangosol.coherence.wka2.port=7890


Create a shell script to start the Coherence server

+++++

#!/bin/sh

# Change below to appropriate location
JAVA_HOME="/home/oracle/jdk1.7.0_67"
WLS_HOME="/fmw11g/fmw1117/Middleware"
COHERENCE_HOME="${WLS_HOME}/coherence_3.7/"
OSB_ORACLE_HOME="${WLS_HOME}/Oracle_OSB1"
OSB_COHERENCE_CONFIG="${WLS_HOME}/user_projects/domains/soa_domain/config/osb/coherence"

NEW_SIZE=2048m
HEAP_SIZE=4096m

NODE_NAME="CacheServer"

# Change below to appropriate ip address and port
LOCAL_HOST="xxx.xxx.oracle.com"
LOCAL_PORT="9094"

JAVA_OPTS="-Xloggc:gc_${NODE_NAME}.log -server -XX:NewSize=${NEW_SIZE} -XX:MaxNewSize=${NEW_SIZE} -Xms${HEAP_SIZE} -Xmx${HEAP_SIZE} -XX:PermSize=128m -XX:MaxPermSize=128m -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails"

JMXPROPERTIES="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dtangosol.coherence.management=all -Dtangosol.coherence.management.remote=true "

COHERENCE_OPTS="-Dtangosol.coherence.distributed.localstorage=true -Dtangosol.coherence.override=${OSB_COHERENCE_CONFIG}/osb-coherence-override.xml -Dtangosol.coherence.cacheconfig=${OSB_COHERENCE_CONFIG}/osb-coherence-cache-config.xml -Dtangosol.coherence.log.level=9 -Dtangosol.coherence.cluster=OSB-cluster -Dtangosol.coherence.localhost=${LOCAL_HOST} -Dtangosol.coherence.localport=${LOCAL_PORT}"

CLASSPATH="$COHERENCE_HOME/lib/coherence.jar:$OSB_ORACLE_HOME/lib/osb-coherence-client.jar"

$JAVA_HOME/bin/java -server -showversion $JAVA_OPTS $COHERENCE_OPTS $JMXPROPERTIES -cp "$CLASSPATH" com.tangosol.net.DefaultCacheServer $1

+++++

First start the coherence server using the script
c1.sh

and after this start the OSB Server.





Tags: Publish
April 03, 2017 at 02:22PM
Open in Evernote

Saturday, December 03, 2016

How to run a linux command from java code

How to run a linux command from java code
Download opensource java ssh client from 

Use the following java docs , to review the API



package client;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.sshtools.net.SocketTransport;
import com.sshtools.ssh.PasswordAuthentication;
import com.sshtools.ssh.SshAuthentication;
import com.sshtools.ssh.SshClient;
import com.sshtools.ssh.SshConnector;

import com.sshtools.ssh.SshSession;


public class Class1 {
    public Class1() {
        super();
    }

    public static void main(String[] args) throws Exception {
        Class1 class1 = new Class1();


        SshConnector con = SshConnector.createInstance();
         SshClient ssh = con.connect(new SocketTransport("localhost", 22),
                        "root");

         PasswordAuthentication pwd = new PasswordAuthentication();
         pwd.setPassword("Welcome1");

         if (ssh.authenticate(pwd) == SshAuthentication.COMPLETE) {
                System.out.println("Authentication succeeded");
                SshSession sesison = ssh.openSessionChannel();
         } else {
                System.out.println("Authentication failed");
         }

        if (ssh.isAuthenticated()) {

                SshSession session = ssh.openSessionChannel();
               session.executeCommand("xm list");
            

               InputStream stdout =  session.getInputStream();

            BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
                       System.out.println("the output of the command is");
                       while (true)
                       {
                           String line = br.readLine();
                           if (line == null)
                               break;
                           System.out.println(line);
                       }


                session.close();
                ssh.disconnect();


        }


    }
}



Tags: Publish
December 03, 2016 at 12:38PM
Open in Evernote

Friday, November 25, 2016

Unable to Play Flash Content on Windows 10

Unable to Play Flash Content on Windows 10
Right click on Flash Content you have


Click to Global Settings -> Advanced TAB



Click on Trusted Location Settings Butoon and and Add your directory where the flash content is there for all the files add say C:\ D:\ E:\ etc



Tags: Publish
November 26, 2016 at 10:17AM
Open in Evernote

Thursday, November 17, 2016

PL/SQL Debugger Port Settings McaFee Firewall Disable

PL/SQL Debugger Port Settings McaFee Firewall Disable
Open Mcafee , Right Click and Click on Quick Settings -> Click on Firewall , this disables the firewall

Connecting to the database xxx-xxx
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( 'xxxxx', '4000' )
ORA-30683: failure establishing connection to debugger
ORA-12535: TNS:operation timed out
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1
Process exited.
Disconnecting from the database xxxx.


If you are using mcafee host intrusion prevention firewall , please follow this procedure to disable the firewall.


Firewall should be in the off status ,








Tags: Publish
November 18, 2016 at 11:07AM
Open in Evernote

Sunday, October 23, 2016

WLST Script to Change SOAMaxThreadsConfig in 12c

WLST Script to Change SOAMaxThreadsConfig in 12c
import javax.management.openmbean.CompositeDataSupport;
if __name__ == '__main__':
    from wlstModule import *#@UnusedWildImport
print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://locahost:7001'
connect(username,password,url)
servers = cmo.getServers()
domainRuntime()
for server in servers:
    serverName = server.getName()
    print 'server: ' + server.getName()
    SoaInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=AdminServer,name=soa-infra,type=SoaInfraConfig,Application=soa-infra')
    print 'Common Properties for soa_server1'
   
    print  mbs.getAttribute(SoaInfraConfigobj, 'GlobalTxRetryInterval')
    props1 = mbs.getAttribute(SoaInfraConfigobj, 'SOAMaxThreadsConfig')
    print props1.get("incomingRequestsPercentage")
    print props1.get("internalBufferPercentage")
    print props1.get("internalProcessingPercentage")
   
    print props1
   
    javaMap = java.util.HashMap()
    javaMap.put("incomingRequestsPercentage", java.lang.Integer(20))
    javaMap.put("internalBufferPercentage", java.lang.Integer(40))
    javaMap.put("internalProcessingPercentage", java.lang.Integer(40))
    print javaMap
   
    mbs.setAttribute(SoaInfraConfigobj, Attribute('GlobalTxRetryInterval', 22))
    print  mbs.getAttribute(SoaInfraConfigobj, 'GlobalTxRetryInterval')
   
    new_rec_config_obj = javax.management.openmbean.CompositeDataSupport(props1.getCompositeType(),javaMap)
    print new_rec_config_obj
   
    mbs.setAttribute(SoaInfraConfigobj, Attribute('SOAMaxThreadsConfig', new_rec_config_obj))
   
   
    props1 = mbs.getAttribute(SoaInfraConfigobj, 'SOAMaxThreadsConfig')
    print props1.get("incomingRequestsPercentage")
    print props1.get("internalBufferPercentage")
    print props1.get("internalProcessingPercentage")
   
   


Tags: Publish
October 24, 2016 at 08:42AM
Open in Evernote

Friday, October 21, 2016

P6 Spy with a stand alone jdbc program

P6 Spy with a stand alone jdbc program
package mdsleak;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Class1 {
    public Class1() {
        super();
    }

    public static void main(String[] argv) {

                    System.out.println("-------- Oracle JDBC Connection Testing ------");

                    try {

                         //  Class.forName("oracle.jdbc.driver.OracleDriver");
                        Class.forName("com.p6spy.engine.spy.P6SpyDriver");

                    } catch (ClassNotFoundException e) {

                            System.out.println("Where is your Oracle JDBC Driver?");
                            e.printStackTrace();
                            return;

                    }

                    System.out.println("Oracle JDBC Driver Registered!");

                    Connection connection = null;

                    try {

                       //     connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott","tiger");
                       connection = DriverManager.getConnection("jdbc:p6spy:oracle:thin:@localhost :1521:orcl", "scott","tiger");

                        Statement stmt3 = connection.createStatement();
                        ResultSet rs3 = stmt3.executeQuery("SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP");
                            while(rs3.next()){
                            System.out.println(rs3.getInt(1));
                            }

                    } catch (SQLException e) {

                            System.out.println("Connection Failed! Check output console");
                            e.printStackTrace();
                            return;

                    }

                    if (connection != null) {
                            System.out.println("You made it, take control your database now!");
                    } else {
                            System.out.println("Failed to make connection!");
                    }
            }

}


Create a directory c:\temp\p6spy

Copy the file p6spy.jar to c:\temp\p6spy

Create a new file c:\temp\p6spy\spy.properties with the following
contents

++++++++++
realdatasourceclass=oracle.jdbc.driver.OracleDriver
autoflush=true
logfile=c:/temp/spy.log
append=false
+++++++++

Run the Java Program with the following arguments

C:\jdk1.7.0_79\bin\java.exe -classpath D:\myjdevwork\jdev1117\mywork\Application2\MDSLeak\classes;c:\temp\p6spy;c:\temp\p6spy\p6spy.jar;D:\sqldeveloper\jdbc\lib\ojdbc7.jar Class1


 you should see a file c:/temp/spy.log with the following

1477027846045|193|statement|connection 0|SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP|

Here 193 is the time it took in ms and 1477027846045 is the The Current Unix Timestamp

Import changes to the JDBC Program 

 //  Class.forName("oracle.jdbc.driver.OracleDriver");
  Class.forName("com.p6spy.engine.spy.P6SpyDriver");

   //     connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott","tiger");
         connection = DriverManager.getConnection("jdbc:p6spy:oracle:thin:@localhost :1521:orcl", "scott","tiger");




Tags: Publish
October 21, 2016 at 12:20PM
Open in Evernote

Enable JDBC Tracing with ODI (p6spy)

Enable JDBC Tracing with ODI (p6spy)
Create a directory c:\temp\p6spy

Copy the file p6spy.jar to c:\temp\p6spy

Create a new file c:\temp\p6spy\spy.properties with the following
contents

++++++++++
realdatasourceclass=oracle.jdbc.driver.OracleDriver
autoflush=true
logfile=c:/temp/spy.log
append=false
+++++++++


Open the file odi.conf file and add the following lines

after the line

AddJavaLibFile ../../../oracle_common/modules/features/com.oracle.db.jdbc7-dms.jar

+++
AddJavaLibFile c:/temp/p6spy/
AddJavaLibFile c:/temp/p6spy/p6spy.jar
+++

Invoke odi and edit the connection setting

For the JDBC driver name specify it as
com.p6spy.engine.spy.P6SpyDriver

and change the JDBC url to

jdbc:p6spy:oracle:thin:@localhost:1521:orcl

Perform some operations and you should see a file c:/temp/spy.log with the following

1477027846045|193|statement|connection 0|SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP|

Here 193 is the time it took in ms and 1477027846045 is the The Current Unix Timestamp


Tags: Publish
October 21, 2016 at 12:19PM
Open in Evernote

Tuesday, October 18, 2016

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

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]




Tags: Publish
March 29, 2016 at 09:08AM
Open in Evernote

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);
++