Search This Blog

Monday, June 04, 2012

How to Check whether the Schema is Valid or not in a Java Program

 

import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
public class Test {
  public static void main(String[] args) throws Exception{
      SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema =    sf.newSchema(new
File("D:\\temp\\xx1\\InstalledBase.xsd"));
  }
}

Thursday, April 19, 2012

SOA Email James Configuration

 

http://niallcblogs.blogspot.in/2009/10/email-activation-with-oracle-soa-suite.html

http://niallcblogs.blogspot.in/2009/10/email-notifications-with-oracle-soa.html

Download from http://james.apache.org/

Unzip to a directory of your choice

Start James

by running the run.bat or run.sh

on linux you have to start the run.sh as root user , stop the sendmailservice before running

service sendmail stop

telnet localhost 4555 (use the password as root/root)
adduser bpelsender welcome1
adduser bpelreceiver welcome1
adduser jcooper welcome1 

Configure Email client for jcooper, bpelsender etc.
·Configure your email client e.g. thunderbird
File->New->Mail Account 

Give the email account name and email  as jcooper@localhost

Thursday, March 22, 2012

Execute commands remotely from unix shell

 

The ssh command on linux does not support passing the passwords at the command line ,

You need to use the sshpass command. It is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode. You can install it as follows:

rpm –ivh ftp://ftp.muug.mb.ca/mirror/fedora/epel/5/i386/sshpass-1.05-1.el5.i386.rpm

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " du  --exclude=/shared  --exclude=/shared2 -Sm / | sort -nr | head -10"

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " uptime "

Tuesday, March 13, 2012

Steps to Apply the JDeveloper stand alone patches

 

First download the standalone opatch using the patch number  5912518.
Assuming my JDev Home is : d:\fmw1115\Middleware\jdeveloper
copy d:\p5912518_111000_GENERIC.zip cd d:\fmw1115\Middleware\jdeveloper
cd d:\fmw1115\Middleware\jdeveloper
unzip -d . p5912518_111000_GENERIC.zip
set  ORACLE_HOME=d:\fmw1115\Middleware\jdeveloper
set PATH=d:\fmw1115\Middleware\jdeveloper\OPatch;%PATH%
cd C:\temp\13607268
First try ,
opatch version -jdk d:\fmw1115\Middleware\jdk160_24
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.
Now Apply the patch using ,
opatch apply -jdk d:\fmw1115\Middleware\jdk160_24
If you are applying the patch for the first time then you will see ,
> OPatch finds no 'product.xml' in Oracle Home and will attempt to create 'product.xml' file.
>
> Attempting to retrieve patch inventory's "product" and its "version" information...
>
> Please enter your choice to enable OPatch to create 'product.xml' file or quit creation...
>
>
> Choice Product Version
> ------ ------- -------
> 1 SA_JDEV 11.1.1.5.0
>
> 2. If you wish, quit 'product.xml' creation
>
> Please enter [1-2]:
> 1
> User Responded with: 1
>
> OPatch will put the information of selected product 'SA_JDEV' and selected version '11.1.1.3.0'
> in product.xml during inventory updation.
> "
Now run the command to verify whether the patch applied or not ,
C:\temp\13607268>opatch lsinventory -jdk d:\fmw1115\Middleware\jdk160_24
To remove the patch  run the command ,
cd C:\temp\13607268
opatch rollback -id 13607268 -jdk d:\fmw1115\Middleware\jdk160_24

How to apply patches to a BPM and/or SOA environment in 11.1.1.3 (Doc ID 1288864.1)

Friday, March 09, 2012

How to measure the time it takes to load a web page

 

Many times you need to find out the how long a web page takes to load when troubleshooting performance related
problems.

Here are the steps that you can use with the WebLogic Server 11g.

Home >Summary of Servers >AdminServer
Click on Loggin TAB -> HTTP and go to the Advanced Options

Select the Format as "Extended"
and add the field " time-taken" to the Extended Logging Format Fields.
For example after adding it will be
"date time cs-method cs-uri sc-status time-taken"

After this you need to restart the Server ,

This is the WLST script to do the same ,

connect('weblogic', 'Welcome1', 't3://localhost:7001')
startEdit()

cd('/Servers/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer')
cmo.setLogFileFormat('extended')
cmo.setELFFields('date time cs-method cs-uri sc-status time-taken')

activate()
disconnect()
exit()

After this you need to restart the Server ,

Check the access_log file entries ,

2012-03-09      14:19:16        GET     /em/faces/targetauth/emasLogin?target=Farm_soa_domain&type=oracle_ias_farm&FromContextInitFilter=true&_afrLoop=18992901037066&_afrWindowMode=0&_afrWindowId=null    200     0.066
2012-03-09      14:19:20        GET     /em/LoginStatusServlet?loginReqTime4emas=rlt_1331282958512_0.31560349677888955  2000.0040

The last column indicates the time.

You can measure the timings from browser also ,

for this use the FireFox version > 4.0 , here you can use the Tools-> Web Console or Tools -> Web Developer -> Web Console option.

Or you can use the fiddler tool to measure the time it takes to load web page ,
download the fiddler from ,
http://fiddler2.com/fiddler2/

Fiddle tool can be used with IE or firefox.

Wednesday, March 07, 2012

Unable to start the WebLogic Server weblogic.security.SecurityInitializationException: Authentication for user weblogic denied

 

Getting the following exception when trying to start the WebLogic Server

<Mar 7, 2012 3:57:29 PM IST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:965)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1050)
        at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
Caused By: javax.security.auth.login.FailedLoginException: [Security:090303]Authentication Failed: User weblogic weblogic.security.providers.authentication.LDAPAtnDelegateException: [Security:090295]caught unexpected exception
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:251)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        Truncated. see log file for complete stacktrace


Follow the following steps:
1: remove the boot.properties file completely from the managed server directory.
2: remove the ManagedServerDir/data/ldap directory completely.
3: Always keep backup of files before removing it.
4: Now try to start the server from the command prompt and provide the username/password used to login to the Admin Console.

Monday, March 05, 2012

WLST SOA MBeans Examples

 

// Get the deployed Composites

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()
soaBean = ObjectName('oracle.soa.config:Location=AdminServer,name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
print soaBean
composites = mbs.getAttribute(soaBean, 'DeployedComposites')
for composite in composites: 
print 'composite: ',composite 
disconnect()
exit()


// Change the Composite auditLevel to Development

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:Location=AdminServer,partition=default,j2eeType=SCAComposite,revision=1.0,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,Application=soa-infra,wsconfigtype=WebServicesConfig,name="File1"')
print helloworldComposite
params = ['auditLevel','Development']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setProperty', params, sign)
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()


// Print the Composite Properties

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Change the ExcludeFiles property of the File Adapter

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print '-----------Before Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
params = ['ExcludeFiles','*.akshay*']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setStringProperty', params, sign)
print '-----------After Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Display the MDS listPartitions

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()

mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')

print 'invoke listRepositories without parameters on mds bean'
repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
for repository in repositories:
mdsObject = ObjectName(repository)
Name = mbs.getAttribute(mdsObject, 'Name')
print 'mds repository object: ', Name
params = [Name]
sign = ['java.lang.String']
partitions = mbs.invoke(mdsBean, "listPartitions", params, sign)
for partition in partitions:
   print 'partition: ', partition
disconnect()
exit()

Thursday, February 23, 2012

BPEL Process to display the IP Address of a hostname

 

Create a BPEL process with the following java embded code ,
<bpelx:exec import="java.net.*"/>
    <bpelx:exec name="Java_Embedding_1" language="java" version="1.3">
      <![CDATA[String ipaddr = (String)getVariableData("stringvar");   
System.out.println(ipaddr); 
try { 
        InetAddress addr1 = InetAddress.getByName(ipaddr); 
          byte[] ipAddr = addr1.getAddress(); 
          // Convert to dot representation 
          String ipAddrStr = ""; 
          for (int i=0; i<ipAddr.length; i++) { 
              if (i > 0) { 
                  ipAddrStr += "."; 
              } 
              ipAddrStr += ipAddr[i]&0xFF; 
          } 
      System.out.println(" Lookup Host Name " +addr1 +" --> " +ipAddrStr); 
      ipaddr = ipAddrStr;

catch(Exception e1) { 
e1.printStackTrace(); 
}
setVariableData("stringvar",ipaddr);]]>
    </bpelx:exec>
Please refer to the Java Doc for the API call's that you can use in BPEL java
http://docs.oracle.com/cd/B31017_01/integrate.1013/b28986/com/collaxa/cube/engine/ext/BaseBPELXExecLet.html
http://technology.amis.nl/blog/2387/embedding-java-in-bpel-process
http://niallcblogs.blogspot.in/2008/01/bpel-embedded-java.html

Thursday, February 02, 2012

EJB Out Bound Example in SOA

 

1. Create a Simple EJB HelloWorld Application and deploy this to the WebLogic Server

Refer to the file below for the example ,

Hello EJB Example

2. Create a new composite and create a mediator component ,

3. In the External Reference drop the ejb Service and specify the EJB JNDI Binding Name  say

OS9SOAApplication-HelloEJB-HelloEJB#test.os9.model.HelloEJB

EJB-Jar file :

and Java Interface : test.os9.model.HelloEJB

4. Wire the EJB Outbound Service to the mediator and perform the XML transformations and run the example ,

Refer to the file in the link given below ,

Calling EJB from Mediator/BPEL

Simple inbound ejb example ,

 

1. Create a java file with the following contents

package test.os9;
//import javax.ejb.Remote;
//@Remote
public interface Hello {
public String sayHello(String input);
}

Compile this file , create a class file and create a jar file and copy the jar file to SCA-INF\lib directory

2. Create an EJB Binding in the Services lane, based on this Java interface. Specify the JNDI Name for this EJB. For example: ejb/EjbBind and select the above interface file and the jar

3. Create a Mediator with no interface definition and Wire this mediator to this EJB Service

4. Create a BPEL process and wire this to the Medaitor

5. Create the mappings for the mediator

6. Create an EJB Client with the following code ,

package test.os9;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class EjbClient {
  public EjbClient() {
    super();
  }
  public static void main(String[] args) {
    EjbClient ejbClient = new EjbClient();
    try {
     final Context context = getInitialContext();
     Hello hello = (Hello)context.lookup("ejb/EjbBind");
     System.out.println(hello.sayHello("hello ravi"));
     } catch (Exception ex) {
     ex.printStackTrace();
     }
  }
  private static Context getInitialContext() throws NamingException {
  Hashtable env = new Hashtable();
  // WebLogic Server 10.x connection details
  env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
  env.put(Context.PROVIDER_URL, "t3://xxx.xxx.oracle.com:7001");
    env.put(Context.SECURITY_PRINCIPAL,"weblogic");
    env.put(Context.SECURITY_CREDENTIALS,"xxxxx");
  return new InitialContext( env );
  }
}

Add the following libraries to compile the class files 

   "EJB 3.0" and "WebLogic 10.3 Remote-Client"

Here is the example ,

Download Example

Tuesday, January 24, 2012

How to increase JVM Memory Size for JDeveloper 11g

Open the file D:\fmw1115\Middleware\jdeveloper\ide\bin\ide.conf

and change the lines

AddVMOption -Xmx1024M
AddVMOption -Xms128M

Also open the file D:\fmw1115\Middleware\jdeveloper\jdev\bin\jdev.conf

and change the line

AddVMOption -XX:MaxPermSize=256M

Thursday, December 01, 2011

How to Add a Hard Disk Space to Oracle VM

 

1. Create a 30GB file ,

dd if=/dev/zero of=fmw11g.img  bs=1024k count=30000

2. Add the file /OVM/linuxvm/fmw11g.img
to the vm.cfg file , for example ,

disk = ['file:/OVM/linuxvm/System.img,xvda,w','file:/OVM/linuxvm/fmw11g.img,xvdb,w',]

3. Now start the VM by using the command ,
xm create vm.cfg

4. In the fdisk -l command , you should be able to see this file ,

For example ,

fdisk -l

Disk /dev/xvda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14        1264    10048657+  83  Linux
/dev/xvda3            1265        1566     2425815   82  Linux swap / Solaris

Disk /dev/xvdb: 31.4 GB, 31457280000 bytes
255 heads, 63 sectors/track, 3824 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

5. using fdisk /dev/xvdb command create a partion and format that partition
using the command ,

mkfs.ext3 /dev/xvdb1

6. After this mount this file system by adding this entry to the /etc/fstab file ,
/dev/xvdb1             /fmw11g                   ext3    defaults        1 2

run the command , mount -a

Friday, November 25, 2011

Find out whether a Schema is Valid or Not

 

Some times in SOA you need to find out whether the schema you have designed/developed is valid and conforms to XML schema standards etc.

For this you can use the JDK 1.6 tool xjc.exe to check ,

%JDK_HOME%\bin\xjc.exe <your-schema-file> and check whether you are getting errors or not.
When I ran the xjc command with the original schmea , I got the errors
parsing a schema...
[ERROR] sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'party,IdentificationType'.
  line 45 of file:/D:/bugs-download/Bug12965191/restriction_example/restriction/schema-restriction/xsd/party/party.xsd
[ERROR] rcase-Recurse.2: There is not a complete functional mapping between the particles.
  line 7 of file:/D:/bugs-download/Bug12965191/restriction_example/restriction/schema-restriction/xsd/local-party.xsd
[ERROR] derivation-ok-restriction.5.4.2: Error for type 'LocalPartyType7'.  The particle of the type is not a valid restriction of the particle of the base.
  line 7 of file:/D:/bugs-download/Bug12965191/restriction_example/restriction/schema-restriction/xsd/local-party.xsd
Failed to parse a schema.

The above error indicates that schema is not a valid schema.

Wednesday, November 23, 2011

How to set the SOA composite name

 

By default no composite name is set when a SOA componenet gets executed.


XPath for Mediator components:
Use the the following XPath expression in an Assign value dialog when you define a routing rule.

med:setCompositeInstanceTitle(title string)

and use the following target tracking.compositeInstanceTitle.
Note: this property will not appear in the property selection dialog, but can be used though.


Java for BPEL components
Add an Embedded Java activity inside your process flow and add the following function to it:

setCompositeInstanceTitle(title string);
for example ,

In the java embeding add the following code ,

System.out.println("Hello, World 11 "+ new java.util.Date());
setCompositeInstanceTitle("Hello, World 11 "+ new java.util.Date());

Reference

http://docs.oracle.com/cd/E15523_01/integration.1111/e10226/soacompapp_mang.htm

 

For 10g use

System.out.println("Hello, World 11 "+ new java.util.Date());
setTitle("Hello, World 11 "+ new java.util.Date());

Tuesday, October 11, 2011

HTTP Proxy Server Settings for the SOA/Weblogic Server

This summary is not available. Please click here to view the post.

Tuesday, October 04, 2011

BPEL Example of Inserting to Array

 

I have the following XSD Element ,

Basically this structure stores the name and address (multiple values) , state , country and pincode etc ,
My requirement is to add the data to this element from a BPEL process ,

<complexType>
     <sequence>
  <element name="fullname" type="string"/>       
          <element name="addrline" type="string" maxOccurs="unbounded"/>
                <element name="state" type="string"/>
        <element name="country" type="string"/>
        <element name="zip" type="string"/>
            </sequence>
  </complexType>

Create a simple BPEL process , and for the output select the above XSD element , in the BPEL

 


























Near Dairy Circle




Next to Christ University




Bannerghata Road







How to start the VM in Single user mode in Oracle VM 2.2/3.0/XEN

 

Add the following line to the end of the file vm.cfg file ,

extra = 'single'

to the xen domU config file

After this start the VM using the command ,

xm create vm.cfg

This will start the VM in single user mode.

How to Run the Oracle VM 2.2 Images on Oracle VM 3.0 With out the Oracle VM Manager

 

I am having problems with the Oracle VM manager 3.0 as it needs 6GB machine to run in my home. Here is the procedure I followed to run the Oracle VM 2.2 images on Oracle VM 3.0.

 

1. You need to set the Bridged Networking on Oracle VM 3.0

open the file

vi /etc/xen/xend-config.sxp

Uncomment the following line , (Line no 163)

(network-script network-bridge)

And also ensure that you have the following line uncommented (line 178)

(vif-script vif-bridge)

After this restart the Oracle VM Server

Run the command ,

brctl show  (This displays the following , )

bridge name     bridge id               STP enabled     interfaces
bond0           8000.0021918b3e8a       no              pbond0

In the linux guest vm I have the following line ,

vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0']
vif = ['type=netfront']

In the Windows Guest OS I have the following line ,

vif = ['bridge=bond0,mac=00:16:3E:26:BE:CE,type=ioemu']

Start the VM’s manually using the command

xm create vm.cfg

Sunday, July 31, 2011

Wants to Send SMS Reminder at a future data and only one

 

I want to fire a job at 9:59 AM on July-14-2011 , 7/14/2011 (MM/DD/YYYY)

echo /home/ias/Oracle/Middleware/jdk160_18/bin/java -cp /home/ias/JavaUtils Sms160By2 9198808XXXXX "\"Test 5"\" | at 9:59 AM 7/14/2011