0

I'm developing a java Web Application, which uses a com4j library to connect to, and extract data from an external database. My application work seamlessly on my localhost, which runs a maven/jetty setup.

However, I need the application to be hosted on a WebLogic server, which i am not the admin of. When deploying and starting the web-app there, I get an unsatisfied link exception, as shown below.

I have been trying numerous suggested solutions to similar problems, without any luck. The errors have been changing slightly from time to time, but mostly the same. All of the suggested solutions I have found, can be boiled down to three suggestions, found on this site: https://com4j.java.net/deployment.html

  • It should work automatically when you package the jar: It does not. The jar is definitely in the war-file, and the dll is inside the .jar but still the same exception occurs.

  • Place com4j.dll in the same directory as com4j.jar: Does absolutely nothing to the error message.

  • Set the system property java.library.path to include the directory where com4j.dll resides: The error changed to .dll is already loaded in another ClassLoader.

i've tried one at the time, all at once, and different combinations of the above.

I do not expect a wizard to swoop down and tell me exactly what to do here, but I would love some help finding another angle of attack to this problem.

    <11-06-2014 15:23:34 CEST> <Error> <Deployer> <BEA-149265> 
    <Failure occurred in the execution of deployment request with ID 
    '1402493014299' for task '158'. Error is: 

    'weblogic.application.ModuleException: Unable to load com4j.dll'
     weblogic.application.ModuleException: Unable to load com4j.dll
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1401)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace

    Caused By: java.lang.UnsatisfiedLinkError: no com4j-x86 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at com4j.COM4J.loadNativeLibrary(COM4J.java:530)
    at com4j.COM4J.<clinit>(COM4J.java:522)
    Truncated. see log file for complete stacktrace
> 
jumps4fun
  • 3,994
  • 10
  • 50
  • 96
  • Are you sure java.library.path is set properly and is not being overwritten by any weblogic startup script ? Have you tried print it out `System.getProperty("java.library.path")` before you are calling jni ? I configured wl recently to use native libraries and i just put them on path and they are visible. – Kasper Ziemianek Jun 26 '14 at 14:36
  • I am not. I would actually love a tutorial on that. I have been trusting that my colleagues has been knowing what they were doing in that regard. I'm fairly newly educated, and servers, builds, system variables and such is not my strongest side. And honestly, I am not sure if or where I am calling jni. – jumps4fun Jun 26 '14 at 14:38
  • The server admin says that, yes we are positive that the library path is set the correct way. However, the error message changed on the particular time that we tried that, and it claimed that the .dll was already loaded in another ClassLoader. – jumps4fun Jun 26 '14 at 14:54

1 Answers1

0

Solution for your problem is probably explained here : https://com4j.java.net/deployment.html

You can set up java.library.path variable in various ways :

Modify startWebLogic script in your domain.

or

Login to weblogic administator console, go to Environment -> Servers -> My Server ->Server Start tab -> Add -Djava.library.path=PATH_TO_LIBRARY in Arguments: text field.

Kasper Ziemianek
  • 1,329
  • 8
  • 15