Snow flakes in Sydney – The great escape or do they have a purpose?

Just saw one massive FOAM Snowflakes by Bridge and Pitt St … and wondered if something had come loose off of a decoration somewhere nearby. That one wandered about for a bit, dodge a car or two and then decided to hang out on a tree branch by the bridge/pitt intersection.

It was not until folks at the office erupted in mass curiosity and broke the monotonous hum that I realized that there were more “Snow flakes” along the way. Some pointed at the foam flakes along the road, other along the narrow alleyway between our building and the building behind ours. “Christmas” someone yelled, “Aren’t the flakes cute” said some lady….

…I was wondering if they had a purpose or had these just broken free and escaped this years decoration on some city building? In any case, they made a couple of moments on a dreary Friday afternoon festive!

~~ MERRY CHRISTMAS ~~

OPA or OBR?

So here you are trying to catch your breath with the jump from Oracle 10g to 11g and understand the brand new application that is SOA Suite 11g …and BAM! Someone goes “OPA/Haley” is better than OBR.

Before you begin to question that statement and wonder how we all moving with the Oracle Fusion Middleware flow are to now stop and look over our shoulders at another Oracle product (a fringe product?) – and gain experience in it to provide our customers with the right tool (and no nonsense product stack) …hear this … (phew!) … OPA/OPM a.k.a Haley is a really cool Natural Langugage Processing based rules engine. Oracle Business Rules (OBR) is a “RETE Algorithm” (A.I) based engine.

OPA/OPM – if for Oracle Policy Automation/Model and is meant for High Level Rules. And is good for use cases where the user has the rules in a word file and needs that file parsed on the fly and …. thats it! I don’t know enough about it and will need to dig deeper.

OBR is Oracle Business Rules – comes with Oracle SOA Suite, is familiar to a SOA or ADF application developer. Is not for the business user but can be. 11g version is much richer than 10g, lets you do “IF …then” type rules and tabular decision tables.

Which one would I use? Depends on the use case and my comfort zone. In-fact in some ADF development cases, where SOA suite license might be expensive – I’d prefer building the rules into a simple table. Fast and easy!

Your thoughts?

ORABPEL-10555 Identity Service Configuration error

 

Got this error when trying to assign a user a task in Oracle SOA Suite 11g’s “Human Task” component. When you open up the task and goto the “Assignment” section, open up the “Identity Lookup” wizard and connect to your local application server connection- it should populate the security “Realm” (For example: jazn for the default Realm) …and it should let you select from the list of Users configured in Weblogic.

 

Pic1: Configure new users in weblogic’s default realm

 

However, if it does not show you the above and instead gives you an “Sever exception is: Connection refused from server” when you click on the icon titled “Lookup” (little magnifying glass over a page icon) …then you might be getting the following exceptions (see below) in your logs (I managed to catch the stack trace in another screen trying to do the same sort of work – i.e. connect to the appserver and get users from it).

Pic2: Error when connecting to application server for users from JDeveloper

I looked around forums and could not find a clear explanation. Did I need to configure something to get my JDeveloper instance to talk to my standalone SOA Admin Server to get the users in it? Was there some development required (See “Creating a Custom Identity Service Plugin” for creating custom plugins for BPM Suite. Note: You will need the BPM Jars in 11g under “$ORACLE_HOME/soa/modules/oracle.soa.workflow_11.1.1/bpm-services.jar”)….

…turns out that inorder to get to the users the Task developer component needed to talk to the Managed SOA Weblogic Server instance and not the Admin Server instance. All this while my SOA server instance was down and I did not think much of it – why would I need SOA server for getting at Weblogic Security Configuration? Admin Server should be enough? Right? Does not quite work that way.
Exceptions:

ORABPEL-10555
Identity Service Configuration error.
Identity Service Configuration has error.
Please refer to the identity service configuration guidlines and correct the Identity Service configurations. Contact oracle support if error is not fixable.
        at oracle.bpel.services.identity.client.AbstractIdentityConfigServiceClient.getConfiguredApplications(AbstractIdentityConfigServiceClient.java:152)
	at oracle.tip.tools.ide.common.services.connections.ConnectionsUtil.searchApplications(ConnectionsUtil.java:236)

Solution: You need to have your standalone SOA Server and Admin server running to be able to use custom users defined in Weblogic in your SOA application

Oracle SOA 11g Install – RCU Issues

Introduction:

During the installation of Oracle SOA Suite 11g, we saw errors related to a DRIVER_INFO error.   Searching on the web revealed that this could be a RCU issue … however attempts to uninstall and reinstall the RCU Schemas caused nothing but more pain (errors related to missing Metadata repository, having to manually configure the data sources in Weblogic etc – I will recreate the scenario and blog about the errors and how to fix them soon).

Anyway, we still have problems with the DRIVER_INFO table … and are getting the following error (see below).  If you look at the sql scripts in the RCU there is nothing for the DRIVER_INFO table.

So what is this table for and how do we install this? Could this be related to installing the Email/Messaging features? I am not sure yet but as soon as I find out more I will update this post.

Here’s my config -> OS: Windows 32-bit XP with 4GB RAM, quad core

Here are the errors:

"Error Code: 942
Call: SELECT DRIVER_NAME, MIME_TYPES, PROTOCOLS, CARRIERS, SENDER_ADDRESSES, COST, DELIVERY_TYPES, SPEED, STATUS_TYPES, CHECKSUM, SUPPORTS_CANCEL, ENCODINGS, SUPPORTS_REPLACE, SUPPORTS_TRACKING, SUPPORTS_STATUS_POLLING, DEFAULT_SENDER, CAPABILITY, LOCK_VERSION FROM DRIVER_INFO WHERE (DRIVER_NAME = ?)
        bind => [Farm_soa_domain/soa_domain/soa_server1/usermessagingdriver-email:oracle_sdpmessagingdriver_email#Email-Driver]
Query: ReadObjectQuery(oracle.sdpinternal.messaging.config.DriverInfo)
        at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
        at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:613)
        at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:467)
        at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:447)"

 

Weblogic – where do I put my JDBC Driver lib?

Introduction:

We will walk through a quick example of how to resolve “weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class:” errors and learn where to install the JDBC driver libraries to fix runtime issues.

Background:

I was playing with ADF samples and had a database connection to a MySQL instance. This was achieved by adding the MySQL-Connector library during design time.

Now, when I had the sample application ready and ran a test on the local Weblogic server – I got the following errors:

<Oct 9, 2010 4:14:45 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException:
 at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:290)
 at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
 at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
 at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:149)
 Truncated. see log file for complete stacktrace

Caused By: weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class: com.mysql.jdbc.Driver
 at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:301)
 at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:75)
 at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:131)
 at weblogic.jdbc.common.internal.ConnectionPool.initPooledResourceFactory(ConnectionPool.java:686)
 at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:230)
 Truncated. see log file for complete stacktrace

It was clear that I was missing the MySQL-Connector libraries and had to stick it into some lib folder. But the question was which lib folder?

The Solution:

The best way to find out about your application server is to …. *hint* “logs”…. yes! Read the startup logs. I agree it is sometimes hard to read when stuff is flying by so fast, so it is good practice to “grab”/”copy” from the Weblogic console and paste it into Notepad++ or your favorite text-editor.

Now, you should be looking for a few things … where is the JVM which launched the app (i.e. bootstrap libraries) and in Weblogic server’s case …where is the domain home.

I will skip the story about how I put the jar in “c:\Oracle\Middleware\wlserver_10.3\server\lib”, “c:\Oracle\Middleware\wlserver_10.3\common\lib”, “c:\Oracle\Middleware\jdeveloper\lib” … and it did not work!

What worked!

What worked was when I put it (the mysql lib jar) in the domain home as indicated in the server-startup (so you are looking at a line that is something like)

Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
Starting WLS with line:
C:\Oracle\MIDDLE~1\JDK160~1\bin\java -client ...-Ddomain.home=C:\Users\<username>\AppData\Roaming\JDEVEL~1\SYSTEM~1.60\DEFAUL~1

Notice the domain home. This is where we ought to stick the connector jar into.

 

 

Another way to look at it – nodemanager props

I also looked at the server start-up logs and the nodemanager properties to get a better idea of the server setup. As you can see the details are in the properties file here, just need to pick the right home – the logical “Domain”‘s home.

"c:\Oracle\Middleware\wlserver_10.3\common\nodemanager>more nodemanager.domains"
#Domains and directories created by Configuration Wizard
#Fri Oct 08 20:18:00 EST 2010
base_domain=C\:\\Oracle\\Middleware\\user_projects\\domains\\base_domain
DefaultDomain=C\:\\Users\\<username>\\AppData\\Roaming\\JDeveloper\\system11.1.1.3.37.56.60\\DefaultDomain

I tried putting the jar in the base domain and stopped/started the server but that did not work. It only worked when I put the jar in the default domain.


Creating Root Application Module Instance – Oracle ADF

Introduction:

When developing ADF Business Components, we might need a handle to an Application Module (AM) instance. I have used the AM instance in the past to

a) invoke the methods on the Application Module for testing – think quick and dirty Java main for validating configuration is okay or for debugging through the method you implemented in the AM

b) invoke the methods on the Application Module from a Web Services project. We used a separate project to host the invoker classes that has the Webservice methods on them, the methods would create an instance of the AM and release them once done.

Now, to get an instance of the AM we need to invoke the “createRootApplicationModule” method on the “oracle.jbo.client.Configuration” class statically. There are a couple of overloaded methods in the class, I will illustrate using the simplest which takes in two parameters.

Example Details:

Before we start you should have done the following:

1) Created a new Fusion Web Application in JDeveloper

2) Created an Application Module in your Model project

Notice when you create the application module how the file-system looks …  look for a “common” folder where your ApplicationModule class is … do you see a “bc4j.xcfg” there? Open this up in your favorite text-editor and study it a little … what configurations do you see defined under “AppModuleConfig” ? what are the some of the application names under “ApplicationName” ?

Done?

My project looks something like this

…and my BC4J file looks something like this

Next we will see how to create an instance of the Application Module and invoke a method there.

Steps:

  1. Create a method in your AM
  2. Expose it to the AM Client by editing the AM propertiese
  3. Create a test client – a simple Java main which has the Configuration.createRootApplicationModule(String, String) method in it
  4. Invoke the method in the AM from the Java main client

I have illustrated these steps in detail below, click on the thumbnail to see the details:

1) Create a method in your AM

2) Expose it to the AM Client by editing the AM properties

Right click and open the properties dialog by clicking the “Open ApplicationModule”

Select the Java tab for configuring the methods exposed to the client …click on the “pencil” icon to edit

Once the dialog opens up, shuttle the method or methods you want to expose to the client. Note: If the methods use variables that are not serialize-able then you might not be able to shuttle them.

3) Create a test client – a simple Java main which has the Configuration.createRootApplicationModule(String, String) method in it

4) Invoke the method in the AM from the Java main client

SQL Developer – Date Format

You are on SQL Developer and have a date-time column, you run a query and it only displays the date. You could do a “to_char(mydatefield,’MM/DD/YYYY hh24:mi:ss’) ” but then you will have to do it for ALL date fields and change all your saved queries.

You wish there was something in SQL-Developer that would apply this globally. Well there is, goto Tools->Preferences -> NLS

Now you have to set the Date Format on the right ….so what is it? “DD-MON-RR”  or “DD-MON-RRRR” or  “DD-MON-RR HH24.MI.SSXFF AM” or something more obscure to display your dates with times on them?

It turns out,  you can use anything as long as you specify the right time format “DD-MON-RR HH.MI.SSXFF AM” or “DD-MON-RR HH.MI.SS AM” or “MM/DD/RRRR HH.MI.SS AM” as shown above.

Java Maps – Complex Key Example

…so someone asked me today about Java Maps, Oracle Coherence and using complex keys i.e. non-string keys.   The easy part is in declaring your Collection object and storing the value using the complex key object. The tricky part is when you need to get the value back from the map using the complex key.

You do so, i.e. find the stored object, by simply overriding the “equals” method of your complex key class so that the Map interface can compare the object stored and the key you are looking for using the equals method. As mentioned in the documentation for Java Map, care must be taken when using “mutable” objects as keys  – because if you change the value of the fields that make up the key object while it is in the map then you will not be able to find them using the same key values. [See http://download.oracle.com/javase/1.4.2/docs/api/java/util/Map.html]

Here is a quick and dirty example:

 3  import java.util.HashMap;
  4  import java.util.Map;
  5  
  6  public class MapWithComplexKey {
  7  
  8          public static void main(String[] args) {
  9                  ComplexKey one = new MapWithComplexKey.ComplexKey("one", "A");
 10                  ComplexKey two = new MapWithComplexKey.ComplexKey("two", "B");
 11                  ComplexKey three = new MapWithComplexKey.ComplexKey("three", "C");
 12                  ComplexKey weird = new MapWithComplexKey.ComplexKey(null, "thing");
 13  
 14                  Map<ComplexKey, String> testMap = new HashMap<ComplexKey, String>();
 15                  testMap.put(one, one.getCombo());
 16                  testMap.put(two, two.getCombo());
 17                  testMap.put(three, three.getCombo());
 18                  testMap.put(weird, weird.getCombo());
 19  
 20                  // find by key - "one, A"
 21                  ComplexKey finderForOneA = new MapWithComplexKey.ComplexKey("one", "A");
 22                  String valueOneA = testMap.get(finderForOneA);
 23                  System.out.println(" Found " + valueOneA);
 24  
 25                  // find by key - "null, thing"
 26                  ComplexKey finderForNullThing = new MapWithComplexKey.ComplexKey(null,
 27                                  "thing");
 28                  String valueForNullThing = testMap.get(finderForNullThing);
 29                  System.out.println(" Found " + valueForNullThing);
 30  
 31          }
 32  
 33          static class ComplexKey {
 34                  private String first;
 35                  private String last;
 36  
 37                  public boolean equals(Object o) {
 38                          if (o != null && o instanceof ComplexKey) {
 39                                  ComplexKey castedOh = (ComplexKey) o;
 40  
 41                                  if (this.first == null && castedOh.getFirst() == null
 42                                                  && this.last == null && castedOh.getLast() == null) {
 43                                          return true;
 44                                  }
 45  
 46                                  if (this.first != null && castedOh.getFirst() != null
 47                                                  && this.last != null && castedOh.getLast() != null) {
 48                                          if (this.first.equals(castedOh.getFirst())
 49                                                          && this.last.equals(castedOh.getLast())) {
 50                                                  return true;
 51                                          }
 52                                  }
 53  
 54                                  if (this.first == null && castedOh.getFirst() == null) {
 55                                          if (this.last.equals(castedOh.getLast()))
 56                                                  return true;
 57                                  }
 58  
 59                                  if (this.last == null && castedOh.getLast() == null) {
 60                                          if (this.first.equals(castedOh.getFirst()))
 61                                                  return true;
 62                                  }
 63                          }
 64  
 65                          return false;
 66                  }
 67  
 68                  public int hashCode() {
 69                          int hashCode = 7;
 70  
 71                          hashCode = 31 * hashCode + (null == first ? 0 : first.hashCode());
 72                          hashCode = 31 * hashCode + (null == last ? 0 : last.hashCode());
 73  
 74                          return hashCode;
 75                  }
 76  
 77                  public ComplexKey(String first, String last) {
 78                          this.first = first;
 79                          this.last = last;
 80                  }
 81  
 82                  public String getCombo() {
 83                          return (null == first ? "no" : first) + "-"
 84                                          + (null == last ? "no" : last);
 85                  }
 86  
 87                  public String getLast() {
 88                          return last;
 89                  }
 90  
 91                  public void setLast(String last) {
 92                          this.last = last;
 93                  }
 94  
 95                  public String getFirst() {
 96                          return first;
 97                  }
 98  
 99                  public void setFirst(String first) {
100                          this.first = first;
101                  }
102  
103          }
104  }


Java – Useful high level information and links

Latest Release Notes:

Link: http://www.oracle.com/technetwork/java/javase/releasenotes-136954.html

For a less cryptic, more detailed view of the what’s in the latest build of Java’s Standard Edition (JDK and JRE)

Root: http://download.oracle.com/javase/