I had to deploy some existing code developed on SOA Suite on OC4J to SOA Suite on Weblogic, It was a good struggle for me, so here it goes -
The code basically is a bpel calling a java web service using wsif. And the java service uses the caching software coherence to read/write to an in memory cache.
1. First of all the java web service in Jdev didn't get deployed to weblogic - It gave me - java.lang.IllegalStateException: could not find schema type named {http}//weblogic/types/}getHelloResponse" (edited the actual type).
After some googling, it seems there r interoperability issues - so I had to use weblogic ant tasks to create/deploy the web service. Though the ant tasks like wsdlctask etc. were available my ant script didn’t run as it didn’t get xmlbean libraries, which I too couldn’t find in weblogic/lib. So my next attempt was to try develop this in workshop, which I am still trying as workshop didn't like my localhost weblogic server SOA domain, created as part of the SOA Suite on Weblogic installation scripts.
2. Since my java web service attempts were not getting anywhere, I decided to package the Java class (which would be called by WSIF anyway) in the bpel itself. That went pretty well, my wsif binding started working after a few issues with the namespace in my schema, bam code in bpel (which I removed later as it was throwing JCE Error asking to put new jars in jre/lib/ext at deployment). I couldn't find a jaxb ant task to replace the schemac, so I had to go with schemac to generate the java binding classes form the wsdl/schemas. Here too I faced compilation issues with the classes generated, so I had to edit the schema to remove the (maxOccurs="100000") entries. So finally when my bpel was ready with everything else, I had to test the coherence part.
3. The coherence part was the real hurdle to cross, by packaging the coherence.jar in my bpel output jar, I couldn't start the CacheFactory - It was complaining - Caused by: (Operation failed!; nested exception is: (Wrapped: Failed to load the factory) java.lang.reflect.InvocationTargetException - Wrapped: Failed to load configuration resource: coherence-cache-config.xml) java.io.IOException: Configuration is missing: "coherence-cache-config.xml", loader=null. So I tried putting the coherence.jar in the weblogic server classpath, and then it was working fine. I was able to create the CacheFactory and just then when I thought its done, the put/get to cache started throwing - (Wrapped) java.io.IOException: readObject failed: java.lang.ClassNotFoundException: com.schemas.Customer.CustomerQueryResultSet
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method).
Finally with the help of Coherence support, I learnt that I need to pass the classloader to CacheFactory.getCache() as the Classloaders get different when we go out of bpel domain to the coherence code and vice-versa. After passing the classloader, the whole thing worked fine.
sample code below -
NamedCache cache;
Thread thread = Thread.currentThread();
ClassLoader loaderPrev = thread.getContextClassLoader();
try
{
thread.setContextClassLoader(com.tangosol.net.NamedCache.class.getClassLoader());
cache = CacheFactory.getCache(sName);
}
finally
{
Thread.currentThread().setContextClassLoader(loaderPrev);
}
1 comment:
what I was looking for, thanks
Post a Comment