Setting java.library.path in OC4J on Oracle 10g release 3

Discussion in 'Java' started by, May 18, 2006.

  1. Guest

    This is a really simple question, but I'll be damned if I can figure
    out how to do it in OC4j on Oracle 10g release 3.

    I have an application on their J2EE application server deployed from a
    WAR and it needs to use native libraries. I found out how to add JARs
    to the classpath, but not how to add native libraries (or the folders
    containing them) to the library path and I can't seem to find anything
    in the docs and at the moment I am getting "unsatisfied link error".

    Does anyone know how? Even just pointing me to the right place in the
    docs would be great. Does Oracle not support the allow Java to call
    native libraries or something crazy? And this is on Windows 2003

    Thanks everyone,

    , May 18, 2006
    1. Advertisements

  2. Ganesh Iyer

    Ganesh Iyer Guest

    Did you check out the OTN forums?

    I found this information in OTN...

    There's two aspects which need to be considered:

    1: the Java wrapper classes you have which call out to the native

    2: the native libs themselves (which I'll call a .dll from hereon in
    for simplicity).

    What you would need to do is make sure the Java wrapper classes are all
    available to the web application. This can be done by either packaging
    them in a jar file and putting it into the web-inf/lib directory of
    your web application, or leaving them in an unpackaged form and putting
    it into the web-inf/classes directory.

    I do vaguely remember helping someone debug a JSP tag lib issue once
    before which used native code and we ran into some problems with
    concurrent use of the same DLL (a Java restriction) because a DLL can
    only be registered once per JVM instance and the threading model meant
    it was being loaded more than once -- but it may have also had
    something to do with the JSP taglib cache.

    If you do get some form of Java runtime exception showing concurrent
    access error for the native lib, what you can do is move the lib with
    the Java wrapper classes into the global classpath (j2ee/home/applib)
    meaning it's only ever loaded once..

    Then what you need to do is make sure the DLL itself is accessible to
    the Java process -- on Windows this is done by making sure directory
    holding the DDL is set in the PATH environment variable before --
    before starting OC4J. On other platforms, it can be done using the
    LD_LIBRARY_PATH environment variable.

    That should be all you need to do to make it work.


    Hope this helps,
    Thanks and regards,
    Ganesh Iyer
    Ganesh Iyer, May 18, 2006
    1. Advertisements

  3. Guest

    >Did you check out the OTN forums?
    Yes. Did get any help there I'm afraid.

    >Then what you need to do is make sure the DLL itself is accessible to
    >the Java process -- on Windows this is done by making sure directory
    >holding the DLL is set in the PATH environment variable before --
    >before starting OC4J.

    I have done this but as far as I can see, OC4J ignores the PATH
    environment variable.

    This is so frustrating. It is such a basic thing to want to do, I
    can't believe Oracle have made it so hard (and failed to document it!)


    , May 19, 2006
  4. Joined:
    Sep 8, 2006
    Were you able to get a fix to this problem. I have the same problem and my environmnet is OC4J 9.0.4 on Windows 2000
    , Sep 8, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sloan

    Access Oracle 10g using ASP.NET

    sloan, Mar 10, 2006, in forum: ASP .Net
  2. Replies:
    May 15, 2005
  3. javadev
    May 27, 2006
  4. Replies:
  5. yogi

Share This Page