It's not a secret anymore!
The moose likes Websphere and the fly likes conflicting jar files and .dll Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "conflicting jar files and .dll" Watch "conflicting jar files and .dll" New topic

conflicting jar files and .dll

Chris Skinner

Joined: Jan 23, 2002
Posts: 23
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(
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at com.neva.Coroutine.<clinit>(
at com.neva.COMClassObject.CoInitialize(
at com.xyenterprise.PCMUtils.PCMAPIMgr.<init>(

Or this :

[9/8/06 17:27:31:054 EDT] 18962a5f DispatchActio E org.apache.struts.actions.DispatchAction TRAS0014I: The following exception was logged java.lang.reflect.InvocationTargetException

java.lang.NoClassDefFoundError: com/neva/Coroutine
at com.neva.COMClassObject.CoInitialize(
at com.xyenterprise.PCMUtils.PCMAPIMgr.<init>(

Which ever application loads first runs fine. There seems to be some kind of conflict in how the class loaded is using the dll file and or the jar file.

I have the jars all defined in a shared library and the .dll file is located in the Windows\system32 directory.

Does anybody have a suggestion on how to fix this?


Christopher Skinner<br />SCJP2 1.4<br />SCWCD (in training)
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Don't you love classloader errors?

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.

Happy WebSphere!

Chandima Janakantha

Joined: Aug 31, 2006
Posts: 6
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).
Chris Skinner

Joined: Jan 23, 2002
Posts: 23
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.
jQuery in Action, 3rd edition
subject: conflicting jar files and .dll
jQuery in Action, 3rd edition