Hi, I'm having a problem running two j2ee applications on Websphere 5.1.2 application server. Both of the applications use the Coroutine4java.jar and the corojdk.dll. The problem is that which ever one loads second gets these errors :
Caused by: java.lang.UnsatisfiedLinkError: Native Library C:\WINDOWS\system32\corojdk11.dll already loaded in another classloader at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2111) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2025) at java.lang.Runtime.loadLibrary0(Runtime.java:824) at java.lang.System.loadLibrary(System.java:908) at com.neva.Coroutine.<clinit>(Coroutine.java:213) at com.neva.COMClassObject.CoInitialize(COMClassObject.java:153) at com.xyenterprise.PCMUtils.PCMAPIMgr.<init>(PCMAPIMgr.java:129)
Are you using the vanilla WebSphere Application Server, or is it running WebSphere Portal 5.1.2 as well?
You said you've got all the jar files together? Where are they? WebSphere\lib? Packaged in an ear? In the root of the war file.
Your JAR files...does the code in there make any class back into the J2EE app? For example, a database driver doesn't make any calls back into a J2EE app, so it can go on WebSphere lib. Not so with other JARs.
The "Lets Get Loaded" link on my website discusses WebSphere 5 and WebSphere 6.1 classloaders. If you think it's a classloader issue, or you need to understand classloader issues a little bit better, this might help.
The problem here is which ever the application first starts, loads the dll file and second application sees this. The easiest fix (if possible) is to run the the two applications in different JVMs. In websphere you can do this by creating a different Application Servers though Websphere Admin Console (browser based). Each Application Server runs in a different JVM and won't cause this issue.
But if you need to run both apps in the same server you may need to investigate whether you can share a dll loaded by another class loader. Try catching the UnsatisfiedLinkError and NOT throwing it in both apps so that the second application will try to work without loading the dll. (note that UnsatisfiedLinkError is an Error not an Exception, So catch UnsatisfiedLinkError or Throwable instead of catching Exception).
Joined: Jan 23, 2002
Thanks for the quick responses. I decided to try deploying both applications in an EAR file rather than as two separate WAR files and that seems to have solved the problem. Chris