aspose file tools*
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
Author

conflicting jar files and .dll

Chris Skinner
Greenhorn

Joined: Jan 23, 2002
Posts: 23
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 :

Either

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)

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(COMClassObject.java:153)
at com.xyenterprise.PCMUtils.PCMAPIMgr.<init>(PCMAPIMgr.java:129)


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?

Thanks
Chris


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
    
    1

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.

http://www.technicalfacilitation.com/get.php?link=classloading

Happy WebSphere!

-Cameron
Chandima Janakantha
Greenhorn

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
Greenhorn

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.
Chris
 
Consider Paul's rocket mass heater.
 
subject: conflicting jar files and .dll