Friday, June 19, 2009

Oracle BPEL and Weblogic and Java - JAR Hell

" JAR hell is a term used to describe all the various ways in which the classloading process can end up not working. "

- JAR Hell ( Wikipedia )

Avijeet , Raghu and myself - we are working on a challenging customer engagement and the environment has an Oracle BPEL 10.1.3.4 Server running off an Weblogic 9.2 Server. We recently encountered a scenario where we had to have a Java Client call a BPEL process deployed in this environment.

We used to regular boiler-plate Java BPEL Client code that you can get in the documentation, blogs, etc.

You can find a good example on Charles Piazza's SOA Blog.

However, to our chagrin, we noticed that the code always returned an opaque error :-

Exception in thread "main" java.lang.Exception:
Failed to create "ejb/collaxa/system/FinderBean" bean; exception reported is: "javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException:
error during JRMP connection establishment; nested exception is:
java.io.EOFException]
at weblogic.jrmp.Context.lookup(Context.java:189)
at weblogic.jrmp.Context.lookup(Context.java:195)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.oracle.bpel.client.util.BeanRegistry.lookupFinderBean(BeanRegistry.java:337)
at com.oracle.bpel.client.Locator.getFinder(Locator.java:956)
at com.oracle.bpel.client.Locator.listInstances(Locator.java:585)
at com.oracle.bpel.client.Locator.listInstances(Locator.java:554)

We pciked our brains on this for almost two days - until, suddenly, it hit us !

It was a classic case of JAR hell.

I had included all the JAR libraries of Oracle BPEL 10.1.3.4 and Weblogic 9.2 - for some strange reason, a few libraries in these two sets didn't like each other and this disgust resulted in the opaque "bean" exception.

Avijeet pointed this out & we both painstakingly removed the Weblogic Jar's one-by-one, until we noticed that we only required two sets of JARs to run the Java Class :-
  1. All the Oracle BPEL 10.1.3.4 Libraries.
  2. Only the weblogic.jar from Weblogic 9.2
Cool ! So, now it works and we can celebrate another victory against JAR hell !

Moral of the storey : Be very very careful with the JARs you use !