Showing posts with label Oracle SOA Suite. Show all posts
Showing posts with label Oracle SOA Suite. Show all posts

Wednesday, October 13, 2010

Looking Up SOAServiceInvokerBean from a Different JVM

I am writing this up before I will forget and hit this again...
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is: 
 java.lang.ClassNotFoundException: oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean]
 at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74)
....
Caused by: java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is: 
 java.lang.ClassNotFoundException: oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean
 at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:244)
 at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
...
Caused by: java.lang.ClassNotFoundException: oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean
 at weblogic.application.internal.AppClassLoaderManagerImpl.loadApplicationClass(AppClassLoaderManagerImpl.java:135)
 at weblogic.common.internal.ProxyClassResolver.resolveProxyClass(ProxyClassResolver.java:68)

I normally do not encounter this error when I look up the SOAServiceInvokerBean inside a simple java client, but when I tried to look this up inside one of my backing bean then I start hitting it again.

The following is an excerpt from the Developer's Guide for Oracle SOA Suite
36.4 Designing an SDO-Based Enterprise JavaBeans Client to Invoke Oracle SOA Suite To invoke an SDO - Enterprise JavaBeans service from Enterprise JavaBeans, you must use the client library. Follow these guidelines to design an Enterprise JavaBeans client.
  • Look up the SOAServiceInvokerBean from the JNDI tree.
  • Get an instance of SOAServiceFactory and ask the factory to return a proxy for the Enterprise JavaBeans service interface.
  • You can include a client side Enterprise JavaBeans invocation library (fabric-ejbClient.jar or the fabric-runtime.jar file located in the Oracle JDeveloper home directory or Oracle WebLogic Server) in the Enterprise JavaBeans client application. For example, the fabric-runtime.jar file can be located in the JDev_Home\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1 directory.
If the Enterprise JavaBeans application is running in a different JVM than Oracle SOA Suite, the Enterprise JavaBeans application must reference the ejbClient library.

It says that to invoke the SOAServiceInvokerBean from a different JVM then you need to have the "fabric-ejbClient.jar" in your classpath, but "fabric-ejbClient.jar" is nowhere to be found. Searching on the same directory suggested above, we can find a "fabric-client.jar", and yes you are right that it can serve the purpose.

In summary, to look up and invoke the SOAServiceInvokerBean from a different JVM, you must reference the "fabric-client.jar" located in JDev_Home\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1 directory.

Cheers!

Friday, October 8, 2010

Using GMail as Mail Server for Oracle SOA Suite 11g Notifications

Lucas Jellema has a good post about configuring SOA Suite 11g for sending email notifications with Google Mail, but unluckily, as he also noted, it was not working anymore. Nevertheless, that post demonstrated that Gmail could work as SMTP server for Oracle SOA and inspired me to dig more. In this post, I will share my configuration and the steps that I have made to have a working GMail SMTP server. The following are my suggested steps:
  1. Configure Workflow Notification Properties
  2. Configure Email Driver Properties
  3. Import the GMail's SSL certificate into Java keystore
  4. Remove "-Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks" in setDomainEnv.cmd

Configure Workflow Notification Properties

Right-click soa-infra > SOA Administration > Workflow Notification Properties
Set Workflow Notification to "All" or "Email".
Replace the "admin@javasoadev.com" and "action@javasoadev.com" with your own gmail address. You could replace both with just a single account. Don't be alarmed with my email address configuration that doesn't end with "gmail.com" because I have subscribe to Google Apps where I could have a customized email address.

Configure Email Driver Properties

Please see my configuration below which is presented as is for your reference.
Note that I am not using cleartext password but an encrypted indirect password as follows:

Import the GMail's SSL certificate into Java keystore

Follow the instructions on the following site up to the step of importing of the certificate to the keystore. Needless to say, import the certificate to the same JAVA_HOME that runs your weblogic server instance. http://confluence.atlassian.com/display/JIRA042/Using+Gmail+as+a+JIRA+Mail+Server

Remove "-Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks" in setDomainEnv.cmd

It seems that this command argument is affecting the way Weblogic locates trust as described in the following document: How WebLogic Server Locates Trust. With that argument, weblogic is not looking trust into JDK cacerts keystores.

Quick Testing...

Goto SOA Infrastructure>Service Engine>Human Workflow

Click "Notification Management" tab then click "Send Test Notification"... Enter something like the following values. Ensure that you gave a valid "Send To" email address.
Voila! Email is received accordingly...
Cheers and Thanks to Lucas!

Thursday, September 30, 2010

SDO: Implementing a HashMap like Service Data Objects

Introduction

I envisioned to create a Generic ADF Human Task Form to support all of our human task (workflow) activities, and in the solution that I thought of, I need an SDO HashMap.

For those who are not familiar, the ADF Human Task Form are remotely deployed bounded task flows (BTFs) that are being accessed by the Oracle BPM woklist app in showing the details of a listed task. The remotely deployed BTFs can support multiple human task as long as they have have identical payload elements. I will describe some more details in subsequent posts.

Problem Description

I need some sort of HashMap like SDO because I need to pass a parameterMap from a human task payload into the dynamic region inside my envisioned Generic ADF Human Task Form, but there is no such HashMap equivalent in SDO or in XML Schema. This post provides an implemented schema and classes to support a HashMap like SDO in Oracle SOA Suite 11g BPEL processes.

Artifacts

To create the SDO HashMap we need to have the following artifacts:
  1. MyMapSDO.xsd - Contains the definition of "MyMapSDO" and "MyEntrySDO" complex types to hold the list of entries and the key-value pairs respectively.
  2. MyEntrySDO.java - Java representation of the MyEntrySDO complex type.
  3. MyMapSDO.java - Java representation of the MyMapSDO complex type.
  4. MyEntrySDOImpl.java - implementation
  5. MyMapSDOImpl.java
  6. SimpleWrapperUtils.java - this class handles wrapping of simple types like string, integer, long , etc. to dataobjects as described in my previous post.
  • Below is the concrete "MyMapSDO.xsd" schema that contains both complex types:
    <?xml version="1.0" encoding="windows-1252" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns="http://soadev.blogspot.com/map"
                targetNamespace="http://soadev.blogspot.com/map"
                xmlns:sdoJava="commonj.sdo/java" sdoJava:package="soadev.sdo.sdohashmap.model">
       <xsd:import namespace="commonj.sdo/java"/>
       <xsd:complexType name="MyMapSDO">
          <xsd:sequence>
             <xsd:element name="entry" type="MyEntrySDO" minOccurs="0"
                          maxOccurs="unbounded"/>
          </xsd:sequence>
       </xsd:complexType>
       <xsd:complexType name="MyEntrySDO">
          <xsd:sequence>
             <xsd:element name="key" type="xsd:string" minOccurs="0"/>
             <xsd:element name="value" type="xsd:anyType" minOccurs="0"/>
          </xsd:sequence>
       </xsd:complexType>
       <xsd:element name="myMapSDO" type="MyMapSDO"/>
    </xsd:schema>
    
  • MyEntrySDO.java
    package soadev.sdo.sdohashmap.model;
    
    public interface MyEntrySDO {
        String getKey();
        void setKey(String key);
        Object getValue();
        void setValue(Object value);
    }
    
    
  • MyMapSDO.java
    
    package soadev.sdo.sdohashmap.model;
    
    import java.util.List;
    
    public interface MyMapSDO {
        List getEntry();
        void setEntry(List value);
    }
    
  • MyEntrySDOImpl.java
    
    package soadev.sdo.sdohashmap.model;
    
    import org.eclipse.persistence.sdo.SDODataObject;
    
    public class MyEntrySDOImpl extends SDODataObject implements MyEntrySDO {
        public String getKey() {
            return getString("key");
        }
    
        public void setKey(String key) {
            set("key", key);
        }
    
        public Object getValue() {
            return get("value");
        }
    
        public void setValue(Object value) {
            set("value", value);
        }
    }
    
  • MyMapSDOImpl.java
    
    package soadev.sdo.sdohashmap.model;
    
    import commonj.sdo.DataObject;
    
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.List;
    
    import java.util.Map;
    
    import org.eclipse.persistence.sdo.SDODataObject;
    import static soadev.sdo.utils.SimpleTypeWrapperUtils.unwrap;
    
    public class MyMapSDOImpl extends SDODataObject implements MyMapSDO {
        public List getEntry() {
            return getList("entry");
        }
    
        public void setEntry(List value) {
            set("entry", value);
        }
        //EL reachable
        public Map<String, Object> getMap(){
            Map<String, Object> map = new HashMap<String, Object>();
            for(Object obj: getEntry()){
                MyEntrySDO entry = (MyEntrySDO)obj;
                map.put(entry.getKey(), unwrap((DataObject)entry.getValue()));
            }
            return map;
        }
    }
    

Testing ...

Below is a sample runner class to illustrate the use case:
package soadev.sdo.sdohashmap.main;

import commonj.sdo.helper.DataFactory;

import commonj.sdo.helper.XMLHelper;

import java.math.BigDecimal;

import java.util.HashMap;
import java.util.List;

import java.util.Map;

import oracle.jbo.common.sdo.SDOHelper;

import soadev.sdo.sdohashmap.model.MyEntrySDO;
import soadev.sdo.sdohashmap.model.MyMapSDO;
import soadev.sdo.sdohashmap.model.MyMapSDOImpl;
import soadev.sdo.sdohashmap.sampleentity.JobSDO;
import static soadev.sdo.utils.SimpleTypeWrapperUtils.*;

public class Runner {

    public static void main(String[] args) {
        try {
            SDOHelper.INSTANCE.defineSchema("soadev/sdo/sdohashmap/sampleentity/",
                                            "JobSDO.xsd");
            SDOHelper.INSTANCE.defineSchema("soadev/sdo/sdohashmap/model/",
                                            "MyMapSDO.xsd");
            MyMapSDO myMapSDO =
                (MyMapSDO)DataFactory.INSTANCE.create(MyMapSDO.class);
            MyEntrySDO entry =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry.setKey("param1");
            entry.setValue(wrap("SampleValue"));
            MyEntrySDO entry2 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry2.setKey("param2");
            entry2.setValue(wrap(1));
            MyEntrySDO entry3 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry.setKey("param1");
            JobSDO job = (JobSDO)DataFactory.INSTANCE.create(JobSDO.class);
            job.setJobId("SOADev");
            job.setJobTitle("SOA Developer");
            job.setMaxSalary(20000L);
            job.setMinSalary(10000L);
            entry3.setKey("param3-job");
            entry3.setValue(job);
            MyEntrySDO entry4 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry4.setKey("param4");
            entry4.setValue(wrap(100L));
            MyEntrySDO entry5 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry5.setKey("param5");
            entry5.setValue(wrap(true));
            MyEntrySDO entry6 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry6.setKey("param6");
            entry6.setValue(wrap(200.50));
            MyEntrySDO entry7 =
                (MyEntrySDO)DataFactory.INSTANCE.create(MyEntrySDO.class);
            entry7.setKey("param7");
            entry7.setValue(wrap(new BigDecimal("550.90")));
            List entries = myMapSDO.getEntry();
            entries.add(entry);
            entries.add(entry2);
            entries.add(entry3);
            entries.add(entry4);
            entries.add(entry5);
            entries.add(entry6);
            entries.add(entry7);
            
            //print XML representation
            String xmlFragment = XMLHelper.INSTANCE.save((MyMapSDOImpl)myMapSDO, null, "myMapSDO");
            System.out.println(xmlFragment);
            
            //get map Object
            Map<String, Object> parameterMap = ((MyMapSDOImpl)myMapSDO).getMap();
            for(Map.Entry<String, Object> mapEntry: parameterMap.entrySet()){
                System.out.println("key: " + mapEntry.getKey());
                System.out.println("value: " + mapEntry.getValue());
                System.out.println("value class: " + mapEntry.getValue().getClass());
                System.out.println("-----------------------------------------------");
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
Below is the output in the console after running the runner class above:
C:\Oracle\11gR1PS2\jdk160_18\bin\javaw.exe -client -classpath ////--removed very long classpath---////
Djavax.net.ssl.trustStore=C:\Oracle\11gR1PS2\wlserver_10.3\server\lib\DemoTrust.jks soadev.sdo.sdohashmap.main.Runner
[EL Warning]: 2010-09-30 03:22:46.25--SDOUtil: Generated Type [ChangeSummary] conflicts with SDO specification naming rules for [ChangeSummary] and should be renamed.
<?xml version="1.0" encoding="UTF-8"?>
<myMapSDO xsi:type="ns1:MyMapSDO" xmlns:ns1="http://soadev.blogspot.com/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <entry>
      <key>param1</key>
      <value xsi:type="ns0:string" xmlns:ns0="http://www.w3.org/2001/XMLSchema">SampleValue</value>
   </entry>
   <entry>
      <key>param2</key>
      <value xsi:type="ns0:int" xmlns:ns0="http://www.w3.org/2001/XMLSchema">1</value>
   </entry>
   <entry>
      <key>param3-job</key>
      <value xsi:type="ns0:JobSDO" xmlns:ns0="http://soadev.blogspot.com/sampleentity">
         <jobId>SOADev</jobId>
         <jobTitle>SOA Developer</jobTitle>
         <maxSalary>20000</maxSalary>
         <minSalary>10000</minSalary>
      </value>
   </entry>
   <entry>
      <key>param4</key>
      <value xsi:type="ns0:long" xmlns:ns0="http://www.w3.org/2001/XMLSchema">100</value>
   </entry>
   <entry>
      <key>param5</key>
      <value xsi:type="ns0:boolean" xmlns:ns0="http://www.w3.org/2001/XMLSchema">true</value>
   </entry>
   <entry>
      <key>param6</key>
      <value xsi:type="ns0:double" xmlns:ns0="http://www.w3.org/2001/XMLSchema">200.5</value>
   </entry>
   <entry>
      <key>param7</key>
      <value xsi:type="ns0:decimal" xmlns:ns0="http://www.w3.org/2001/XMLSchema">550.90</value>
   </entry>
</myMapSDO>

key: param1
value: SampleValue
value class: class java.lang.String
-----------------------------------------------
key: param2
value: 1
value class: class java.lang.Integer
-----------------------------------------------
key: param4
value: 100
value class: class java.lang.Long
-----------------------------------------------
key: param5
value: true
value class: class java.lang.Boolean
-----------------------------------------------
key: param6
value: 200.5
value class: class java.lang.Double
-----------------------------------------------
key: param7
value: 550.90
value class: class java.math.BigDecimal
-----------------------------------------------
key: param3-job
value: soadev.sdo.sdohashmap.sampleentity.JobSDOImpl@1c208b0
value class: class soadev.sdo.sdohashmap.sampleentity.JobSDOImpl
-----------------------------------------------
Process exited with exit code 0.

Prototype

You can download the sample application from here.

What's Next?

In subsequent post, I will show how this SDO HashMap be used through Java Embedding inside a BPEL process. I will also show how to initialize an SDO entity with an XML fragment. And... I will also describe a problem that I later realize in the process of this goal of having a Generic ADF Human Task Form - there is always workaround though :-) .

Monday, June 21, 2010

Configuring a New Oracle SOA Domain on Oracle Enterprise Linux

Introduction

With the current trend of having 64 bit as the new desktop standard, then you would most likely come into a situation where you have a hard time deciding what OS to buy that can support your software development tasks, while not being left behind. That OS selection decision is made simpler by the advent of Virtualization wherein you can have multiple OS on a single hardware machine.
In this series, I will share with you how I was able to set-up and run Oracle SOA Suite on my Windows 7 Professional 64 bit OS through Oracle VM VirtualBox.

This is Part V of the following series:
  1. Setting-up Oracle Enterprise Linux on Oracle VM VirtualBox 3.2.4
  2. Installing Java 1.6 on Oracle Enterprise Linux
  3. Installing Weblogic 10.3.3 on Oracle Enterprise Linux
  4. Installing Oracle SOA Suite 11.1.1.3 on Oracle Enterprise Linux
  5. Configuring a New Oracle SOA Domain on Oracle Enterprise Linux

Prerequisites

  1. Installed Oracle VM VirtualBox.
  2. Installed Oracle Enterprise Linux (OEL) on VirtualBox as described in the Part I of this series.
  3. Installed Java 1.6.0_20 on OEL as described in Part II of this series.
  4. Installed WebLogic 10.3.3 as described in Part III of this series.
  5. Installed Oracle SOA Suite 11.1.1.3 as described in the Part IV of this series.
  6. You should have a valid database somewhere which is properly configured with the Repository Creation Utility (RCU).

Configuration Steps

Navigate to "MIDDLEWARE_HOME/Oracle_SOA1/common/bin" directory.
Right-click inside the directory and select "Open in Terminal".
Enter "./config.sh".
Select "Create a new WebLogic domain" and Next.
Check the appropriate products as shown in the screenshot.
Accept default domain name and directories.
Next.
Enter your password for weblogic.
Ensure that the Java 1.6 64 bit that we installed in the Part II of this series is available and selected in the list.
Next.
Select all the schema and provide the appropriate values for the following:
  • Service Name
  • Hostname
  • Password
  • Port

Next.
Next.
Next.
Create.
Done.

Running and Testing the Servers

Navigate to "MIDDLEWARE_HOME/user_projects/domains/base_domain/bin".
Right-click then select "Open in Terminal".
To start the Admin Server, enter "./startWebLogic.sh". (Note: Case-sensitive)
To start the SOA Server, Click File>Open Tab to open a new terminal tab on the same directory.
Enter "./startManagedWebLogic.sh soa_server1".
Enter username: "weblogic" and the password you entered in the steps above.
The SOA Server is already running when you see in the log "SOA Platform is running and accepting request".
If you are connected to a network then you can test logging-in to enterprise manager from a remote pc or from your host OS. But before so, we need to know the ip of our Oracle Enterprise Linux virtual machine.
To know the ip, in a terminal window, enter "/sbin ifconfig".
Get the ip information for use in the step below.
Open a new browser and enter "http://the_ip_above:7001/em"
Successfully log-in to enterprise manager from remote pc.

Sunday, June 20, 2010

Installing Oracle SOA Suite 11.1.1.3 on Oracle Enterprise Linux

Introduction

With the current trend of having 64 bit as the new desktop standard, then you would most likely come into a situation where you have a hard time deciding what OS to buy that can support your software development tasks, while not being left behind. That OS selection decision is made simpler by the advent of Virtualization wherein you can have multiple OS on a single hardware machine.
In this series, I will share with you how I was able to set-up and run Oracle SOA Suite on my Windows 7 Professional 64 bit OS through Oracle VM VirtualBox.
This is Part IV of the following series:
  1. Setting-up Oracle Enterprise Linux on Oracle VM VirtualBox 3.2.4
  2. Installing Java 1.6 on Oracle Enterprise Linux
  3. Installing Weblogic 10.3.3 on Oracle Enterprise Linux
  4. Installing Oracle SOA Suite 11.1.1.3 on Oracle Enterprise Linux
  5. Configuring a New Oracle SOA Domain on Oracle Enterprise Linux

Prerequisites

  1. Installed Oracle VM VirtualBox.
  2. Installed Oracle Enterprise Linux (OEL) on VirtualBox as described in the Part I of this series.
  3. Installed Java 1.6.0_20 on OEL as described in Part II of this series.
  4. Installed WebLogic 10.3.3 as described in Part III of this series.

Enabling a regular user to enter "sudo" command

Login as a regular user(in my case "pino").
Open a new Terminal window.
Enter "su" to login as root.
Enter password for root.
Modify the sudoers file.
Enter "nano /etc/sudoers".
(Warning! Be careful in editing the sudoers file.)
(The sudoers file should be edited using the visudo command but since I am not so familiar with it, I used nano.)
Just after the line "root ALL=(ALL) ALL" add like "pino ALL=(ALL) ALL"
Save changes on exit.

Installation Steps for Oracle SOA 11g PS1

Put the unzip version of the Oracle SOA 11.1.1.2 installer in the installer folder we created in the Part III of this series (in my case "/home/pino/installers").
Browse the Disk1 folder of the installer.
Right click inside the Disk1 directory and select "Open in Terminal".
Enter "./runInstaller -jreLoc $JAVA_HOME"
Accept default directory
A prompt appears. Leave the prompt at ease then open a new Terminal window from the menu- Applications>Accessories>Terminal.
Enter "sudo sh /home/pino/oraInventory/createCentralInventory.sh".
You should be able to read "The execution of the script is complete".
Go back to the prompt window and press "Ok"
Next.
Next.
Next.
Install.
Next.
Finish. We are done installing the Oracle SOA Patchset 1 but we need yet to upgrade to Patchset 2.

Installation Steps for Oracle SOA 11g PS2

Put the unzip version of Oracle SOA 11.1.1.3 Patchset installer into the installer directory we created in Part III of this series.
Browse the Desk1 folder of the installer.
Right click and then select "Open in Terminal".
Enter "sh runInstaller -jreLoc $JAVA_HOME"
Next.
Ensure that selected Middleware Home is the same as the one we specified when we installed the Oracle SOA Patchset 1.
Next.
Install.
Next.
Finish. We are done upgrading to Patchset 2.