Native Libraries

What is the effect of loading native libraries into a WLS instance? Is this
forbidden/frowned upon/ok ?
One effect we have seen is that may be related is that if a native library
is not properly unloaded - either via WLS crash or just poor programming,
restarting the WLS instance is not possible as it belives that the port is
still in use (by another process) What is the relationship here?
thanks,
g

Loading native libraries is not recommended, however, not forbidden.
Writing a stable native code is not easy, if your native code screws up
(such as memory leak), in most cases, weblogic will screw up too.
For restarting, if you restart weblogic, weblogic can use its port. Once
weblogic is killed, OS will release its port for reuse.
My 2 cents.
Cheers - Wei
Garrick Evans <[email protected]> wrote in message
news:8itojp$b0j$[email protected]..
What is the effect of loading native libraries into a WLS instance? Isthis
forbidden/frowned upon/ok ?
One effect we have seen is that may be related is that if a native library
is not properly unloaded - either via WLS crash or just poor programming,
restarting the WLS instance is not possible as it belives that the port is
still in use (by another process) What is the relationship here?
thanks,
g

Similar Messages

  • The struggle of creating a Custom ClassLoader for Native libraries

    Hello Everyone,
    I'm having a really hard time writing and using my own ClassLoader in a Java Applet.
    Context :
    As the this link shows - http://codethesis.com/tutorial.php?id=1 - loading and especially unloading native libraries through Java requires defining our own ClassLoader, and use it to instantiate a class loading a library. When the class using native libraries has finished execution, setting all references to the classloader and calling the garbage collector will cause the native library to be unloaded. The class to load within the custom classloader is thus read byte after byte from the jar and defined using the Classloader.defineClass(..) function. So that's what I did. But I've got two problems.
    Problem 1 :
    On one single machine over 15 tested, the magic number of a given class read from the Jar using Applet.class.getResourceAsStream(classname) takes a value different from CAFEBABE and the defineClass function then throws an "Incompatible magic value" exception (see below). The workaround I found is to force the first 4 bytes of the byte array read from the class with CAFEBABE. But I still would like to understand why it takes a different value on this machine.
    Exception in thread "thread applet-MyApplet.class-1" java.lang.ClassFormatError: Incompatible magic value 409165630 in class file Reader
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at NativeClassLoader.findClass(Unknown Source)
    Problem 2 :
    On windows, the NativeClassLoader works perfectly, but on Linux, I'm getting a java.lang.VerifyError (see below).
    Code is compiled with java 1.6.0_06 on windows XP. I tried to remove everything related to native code (remove .so load), the same error is raised.
    java.lang.VerifyError: (class: Reader, method: <clinit> signature: ()V) Illegal instruction found at offset 1
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    Code :
    NativeClassReader (custom) :
    public class NativeClassLoader extends ClassLoader {
        //the unique instance of the NativeClassLoader
        private static NativeClassLoader instance;
        private NativeClassLoader () {
            super(NativeClassLoader.class.getClassLoader());
         * Get the Singleton instance of the class
        public static NativeClassLoader getInstance () {
            if (instance == null)
                instance = new NativeClassLoader();
            return instance;
        public static void dispose () {
            instance = null;
         * Load a class using its full java name (prefixed with package)
        public Class findClass (String theName) {
            byte[] b = null;
            try {
                b = loadClassDataFromJar(theName);
                Class clazz = defineClass(theName, b, 0, b.length);
                resolveClass(clazz);
                return clazz;
            } catch (Exception e) {
                return null;
         * Gets the bytes of a class file stored in the current jar using
         * its full class name
        public byte[] loadClassDataFromJar (String theName)
                                     throws Exception {
            String filename = "/" + theName.replace('.', '/') + ".class";
            InputStream is = SawsApplet.class.getResourceAsStream(filename);
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            //compute file size
            Vector vChars = new Vector();
            int c;
            while ((c = br.read()) != -1)
                vChars.add(new Byte((byte) c));
            //fill in byte array with chars read from the buffer
            byte[] buff = new byte[vChars.size()];
            //workaround for a bug on one (some) Vista machine(s)
            //force magic number to CAFEBABE instead of 18635F3E
            if (vChars.size() > 3) {
                buff[0] = (byte) 0xCA;
                buff[1] = (byte) 0xFE;
                buff[2] = (byte) 0xBA;
                buff[3] = (byte) 0xBE;
            for (int i = 4; i < vChars.size(); ++i)
                buff[i] = ((Byte) vChars.get(i)).byteValue();
            return buff;
    }Reader (loading native libary) :
    public class Reader {
       static {
         System.loadLibrary("myLib");
        public static native String getData();
    }Main :
        NativeClassLoader cLoader = NativeClassLoader.getInstance();
        Class clazz = cLoader.findClass("Reader"); // ClassFormatError thrown here
        Object reader = clazz.newInstance(); // VerifyError thrown here
        Method m = clazz.getMethod("getData");
        String s = m.invoke(reader);
        print(s);
        s = null;
        m = null;
        reader = null;
        clazz = null;
        cLoader = null;
        NativeClassLoader.dispose();
        System.gcAny ideas would be really appreciated :-)
    Guillaume

    Are you using the executable exe file and the filename as a parameter in the custom task?
    Andreas Baumgarten | H&D International Group

  • Native libraries in ABAP runtime

    Hello
    I have a question. Im developing application which is doing lots of XML processing (quite complicated and time consuming). Since XML support in ABAP itself its very poor we decided to use Java libraries on external server. Comunication between java and abap is done via Jco. But ... the best solution could be if we could use native libraries (java or C JNI wrapper to java) in ABAP. Is there a method or approach to expose interface in ABAP OO and then code implementation to use native library. How to deploy such library in R3.
    I saw that all classes from iXML are connected somehow to native runtime.
    Does anybody know how to do that, or just can point me to any documentation or example ?
    Best regards
    Marcin

    Can you make sure this native library is in the PATH(Windows) or LD_LIBRARY_PATH
    (UNIX)?
    Cameron Purdy wrote:
    That has nothing to do with it being an EJB. It just means it can't find the
    code to call.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "marc claeys" <[email protected]> wrote in message
    news:3cd7e60a$[email protected]..
    Everywhere I read not to use (load) native libraries in a bean.
    However I couldn't find a reason for not doing so I tried.
    The loading of the lib. is successful but when trying to call
    a function of it I receive:
    java.lang.UnsatisfiedLinkError: beanHelloWorld
    Could someone explain why this happens?
    Thanks in advance
    Marc
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • Using native libraries in web application (weblogic on linux)

    I have a problem with loading native libraries for use with my web application. Where do I have to put them in order for the server to see them? The same app on windows runs perfectly fine, because it has no problems finding the dll files.
              So far I have tried modifying the weblogic startup scripts, to include the library in LD_LIBRARY_PATH environment variable. I've also tried modifying the security policy just in case, but I don't think it's the case, because like I said, the app ran fine on windows without messing with the policies. So, any ideas, how I could load the libraries?
              The system is a WebLogic 8.1SP4 installed on Linux i386 using JRockit JVM, the native library in question is JAI 1.1.3-alpha native acceleration library.
              PS. if it's in the wrong group, please direct me to the correct one.

    <p>Fukiku,</p>
              <p>Did you get this working?</p>
              <p>You can also try setting the environment variable java.library.path.</p>
              <p>Please post your stack trace to the forum as well.</p>
              <p>
              Hussein Badakhchani</br>
              </p>

  • JMF with Native Libraries as Signed Applet

    Hello
    After spending a few days hunting through forums, digging into JMF source code and hacking in the dark I'm about to give up, but thought I'd start yet another thread on this. It's a long, sad story...
    Problem: Deploying a JMF based program that relies on native libraries (in this case the FOBS4JMF bindings) as an applet: how to get jmf.properties and the native libraries loaded properly.
    Partial Solution: the native libraries packaged in a signed jar file, added to the applet's archive property, extracted using getResourceAsStream(), and loaded using System.load(). This is how FOBS4JMF loads it's native library anyway (via the com.moesol.NativeLibraryFinder):
    Class classInApplet; // name of a class loaded by the applet
    File outputFile; // location for extracted library
    InputStream is = classInApplet.getResourceAsStream(resource);
    copyStream(is, outputFile);
    System.load(outputFile.getAbsolutePath());Why this doesn't really work:
    (a) JMF (com.media.util.Registry) only searches for jmf.properties (which contains the instructions to use the FOBS4JMF plugin) in real folders (i.e. not jars) on the classpath of the local machine. I could extract the jmf.properties to a folder on the local machine, but have no way of making sure that folder would be on the classpath. Calls to "System.getProperty("java.class.path") give varying results - including an empty string on FF/OSX. Even if i could get the classpath somehow, chances are that it wouldn't contain any folders writable under Vista's UAC, which would leave me out of luck.
    JMF also looks for a file called ".jmfdir" in various platform specific locations, and appends the contents of this file to the classpath, so if i could write to that file i'd be golden. This seems like it would work on non windows platforms, because JMF looks for that in "user.home"). However, from what i can tell, on windows, JMF uses a native call to a function called nGetUserHome() to determine where to find .jmfdir - which leads to the second problem...
    (b) the JMF native libraries are loaded through calls to System.loadLibrary(), not System.load(), which means that they have to be on the "java.library.path" in order to be found - and again, I have no way of extracting the libraries to a directory on that path (at least not one writable under Vista UAC). This wouldn't be a problem, as I could pre-load the libraries myself with System.load(), except that JMF throws an exception if it can't find one, and stops trying to do whatever it thinks it needs the library for. Again, not a problem if I use only the FOBS4JMF native code (though i would like to use the DirectAudio renderer on windows) - except that the nGetUserHome() function described above is in a native library (jmutil.dll). So, when com.media.util.Registry.getJMFDir() tries to find ".jmfdir" it first tries to load "jmutil.dll" using System.loadLibrary(). This throws an exception inf "jmutil.dll" is not on the "java.library.path", and com.media.util.Registry.getJMFDir() returns null. Here's the relevant code from com.media.util.Registry.getJMFDir() - with my annotations
    All of these problems are fixable by relatively minor tweaks to the JMF source - but I don't think that's allowed under the SCSL. So if anyone has any, i mean ANY other suggestions, please BRING 'EM ON.
    thanks
    -chris
    EDIT: just for kicks, i checked to see where JMF expects to find .jmfdir on windows - ie the result of nGetUserHome(). At least on XP this seems to be c:\WINDOWS. if it's the same on Vista, then fixing the loadLibrary problem won't help bc I still won't be able to write to this file.
    Edited by: wodenx on May 7, 2010 9:46 AM

    Hi-
    Thanks for responding so quickly.
    As far as the natives go, you might try using the new JNLP embedded applet ability in the plugin2 architecture.I was going to look into that, but decided it wasn't necessary since I can get the FOBS native code to link properly. It's really the registry that's the problem, since without solving that I can't get JMF to USE the FOBS code.
    Can you get it all to work if the JMF installer is invoked? If so, perhaps if you add an installer-desc that calls the normal JMF setup.exe (though that final warning to reboot is both unnecessary and odious).I don't think it would work even with the JMF installer, bc I need to point JMF at the FOBS specific jmf.properties. I might be get it to work by invoking my own installer though, to place my jmf.properties somewhere in the native class path, so that's worth looking at. Thank you. Problem there is that on Vista users would have to elevate to run the applet, which is not ideal.necessary and odious).
    Why do you particularly want to embed media in a web page?The customer may want it. I might be able to convince them to go with JNLP/WebStart, but I think I might have the same problem there. Please correct me if I'm wrong...
    I've also read that there are problems with JMF and JNLP owing to the fact that JMF doesn't recognize the security manager invoked by JNLP, and so gives your program no permissions. Haven't tried it myself yet.
    Thanks again!
    Edited by: wodenx on May 7, 2010 12:07 PM

  • Loading native libraries

    Hi,
    The other day a came across an UnsatisfiedLinkError with the message "... already loaded in another classloader". I saw the JNI specification states a native library is only permitted to be loaded by a single classloader. My question is why is this the case? What if I have two indipendent applications running on the same JVM instance, and both rely on the same native library? the problem with these native libraries is that there is no classloader delegation architecture when loading one(as there is with java classes), the library will always be loaded by the calling classes' classloader. So what can a developer do? What is the idea behind this behavior?
    Any help is appreciated....

    Thanks for your answers,
    The thing is -
    1) I don't really want to load the library again, I
    simply wish there will be no exception if I attempt to
    load it again from a different classloader. After all,
    what does it matter from which classloader i try to
    load the library? If it is the same classloader the
    method will simply return as if it loaded the lib
    succesfully(even though it didn't since it detected
    it's already loaded), why should there be any
    difference if it's not the same classloader? the
    library is already loaded anyway, all classes in the
    JVM instance will have access to it anyway....Write the code so that it checks for the already loaded exception.
    2) What if I one of my applications is a "third party"
    app in which I cannot change the code to load the
    library through my "library loader"?You are probably out of luck.
    Although I would question why you would want a third party library used by mutliple applications to be individually loaded. In J2EE containers the database drivers are loaded outside the class loaders probably for similar reasons.

  • Wls 6.1 on solaris 8 intel: native libraries missing (libmuxer.so ...)

    It seems that the native libraries for sparc only are included in WLS 6.1???
    #file libmuxer.so
    libmuxer.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked,
    not stripped
    Where can I get the intel version?
    # ./startWebLogic.sh
    LD_LIBRARY_PATH=/usr2/bea/wlserver6.1/lib/solaris:/usr2/bea/wlserver6.1/lib/solaris/oci816_8
    * To start WebLogic Server, use the password *
    * assigned to the system user. The system *
    * username and password must also be used to *
    * access the WebLogic Server console from a web *
    * browser. *
    Starting WebLogic Server ....
    <Jan 18, 2002 9:57:11 AM CET> <Notice> <Management> <Loading configuration file
    ./config/helsana/config.xml ...>
    <Jan 18, 2002 9:57:17 AM CET> <Notice> <WebLogicServer> <Starting WebLogic Admin
    Server "sunetweb"
    for domain "helsana">
    <Jan 18, 2002 9:57:22 AM CET> <Notice> <Management> <Starting discovery of Managed
    Server... This feature is on by default, you may turn this off by passing -Dweblogic.management.discover=false>
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <Management> <Application Poller not started
    for production
    server.>
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <WebLogicServer> <ListenThread listening
    on port 80>
    <Jan 18, 2002 9:57:28 AM CET> <Error> <Performance Pack> <Unable to load performance
    pack, using Java I/O instead.
    Please ensure that libmuxer library is in /usr/j2sdk1_3_1_02/jre/bin/../lib/i386/hotspot:/usr/j2sdk1_3_1_02/jre/bin/../lib/i386::/usr2/bea/wlserver6.1/lib/solaris:/usr2/bea/wlserver6.1/lib/solaris/oci816_8:/usr/lib
    java.lang.UnsatisfiedLinkError: /usr2/bea/wlserver6.1/lib/solaris/libmuxer.so:
    ld.so.1: /usr/j2sdk1_3_1_02/jre/bin/../bin/i386/native_threads/java: fatal: /usr2/bea/wlserver6.1/lib/solaris/libmuxer.so:
    wrong ELF data format: ELFDATA2MSB
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1419)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1343)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:90)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:192)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:144)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:232)
    >
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <WebLogicServer> <SSLListenThread listening
    on port 443>

    Hi.
    We only support Solaris on Sparc platforms, so there are no intel libs for Solaris 8.
    Regards,
    Michael
    Dominik wrote:
    It seems that the native libraries for sparc only are included in WLS 6.1???
    #file libmuxer.so
    libmuxer.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked,
    not stripped
    Where can I get the intel version?
    # ./startWebLogic.sh
    LD_LIBRARY_PATH=/usr2/bea/wlserver6.1/lib/solaris:/usr2/bea/wlserver6.1/lib/solaris/oci816_8
    * To start WebLogic Server, use the password *
    * assigned to the system user. The system *
    * username and password must also be used to *
    * access the WebLogic Server console from a web *
    * browser. *
    Starting WebLogic Server ....
    <Jan 18, 2002 9:57:11 AM CET> <Notice> <Management> <Loading configuration file
    /config/helsana/config.xml ...>
    <Jan 18, 2002 9:57:17 AM CET> <Notice> <WebLogicServer> <Starting WebLogic Admin
    Server "sunetweb"
    for domain "helsana">
    <Jan 18, 2002 9:57:22 AM CET> <Notice> <Management> <Starting discovery of Managed
    Server... This feature is on by default, you may turn this off by passing -Dweblogic.management.discover=false>
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <Management> <Application Poller not started
    for production
    server.>
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <WebLogicServer> <ListenThread listening
    on port 80>
    <Jan 18, 2002 9:57:28 AM CET> <Error> <Performance Pack> <Unable to load performance
    pack, using Java I/O instead.
    Please ensure that libmuxer library is in /usr/j2sdk1_3_1_02/jre/bin/../lib/i386/hotspot:/usr/j2sdk1_3_1_02/jre/bin/../lib/i386::/usr2/bea/wlserver6.1/lib/solaris:/usr2/bea/wlserver6.1/lib/solaris/oci816_8:/usr/lib
    java.lang.UnsatisfiedLinkError: /usr2/bea/wlserver6.1/lib/solaris/libmuxer.so:
    ld.so.1: /usr/j2sdk1_3_1_02/jre/bin/../bin/i386/native_threads/java: fatal: /usr2/bea/wlserver6.1/lib/solaris/libmuxer.so:
    wrong ELF data format: ELFDATA2MSB
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1419)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1343)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:90)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:192)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:144)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:232)
    >
    <Jan 18, 2002 9:57:28 AM CET> <Notice> <WebLogicServer> <SSLListenThread listening
    on port 443>--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Unloading Native Libraries in java

    Hi all,
    This is what i have read from a document.
    The VM calls JNI_OnUnload when the class loader containing the native library is garbage collected.
    When the class loader containing the native library is garbage collected, will the native library gets unloaded.

    Well it should be unloaded:
    "The benefits of the new approach are:
    1. Name space separation based on class loaders is preserved in native libraries. A native library cannot easily mix classes from different class loaders.
    2. In addition, native libraries can be unloaded when their corresponding class loaders are garbage collected"
    As stated in the same document.

  • [Java 3D] Wich OpenGL versions are supported by natives libraries ?

    Hi,
    anyone could tell me which OpenGL specifications are supported by Java 3D natives libraries ?
    Thanks in advance.

    Hi,
    Java 3D requires at least OpenGL 1.2. It runs on all newer releases up to the current release 4.1 and will run on future versions. Java 3D creates an OpenGL compatibility profile context supporting the (legacy) fixed function pipeline as well as the OpenGL Shading Language GLSL.
    Java 3D's on-screen and off-screen rendering capabilities correspond to OpenGL 2.0 and support vertex and fragment shaders inclusive newest shading language features. On my OpenGL 3.2/DirectX 10 capable graphics device I successfully ran GLSL 1.5 features, see http://www.java.net/forum/topic/javadesktop/java-desktop-technologies/java-3d/shaders-java-3d-0 .
    August

  • Problem in loading Native libraries

    While trying to load native libraries I'm getting the following error message
    java.lang.UnsatisfiedLinkError: /XXX/XXX/libMySharedObj.so: ld.so.1: <JAVA_HOME>/bin/sparcv9/java: fatal: libskgxp10.so: open failed: No such file or directory
    At which place the 'libskgxp10.so' file should present and from where I can get a copy of the same?
    I'm using webLogic 8.15 on a solaris(5.8) box. The JVM has been started in 64bit mode with the options JAVA_VM="-server" and JAVA_OPTIONS="-d64" in the 'startWebLogic.sh' script.
    Any idea to fix this issue?

    Suspecting the same, I've tried to run the application in the same machine where the shared object has been created.
    This time I got the error message as
    java.lang.UnsatisfiedLinkError: /XXX/XXX/libMySharedObj.so: ld.so.1: <JAVA_HOME>/bin/java: fatal: /XXX/XXX/libMySharedObj.so: wrong ELF class: ELFCLASS64.
    I have created the native library 'libMySharedObj.so' by the following way
    gcc -c xxx.c
    gcc -c yyy.c
    gcc -c zzz.c
    ld -G xxx.o yyy.o zzz.o -o libMySharedObj.so -lm -lc -lpthreadPlease advice if I'm taking the wrong track somewhere or with any alternative approach.

  • Native Libraries and Swing

    Hi everyone,
    I have a problem with the awt/jfc packages...
    I'm making a p2p client which sends a request to a server (as a part of the client) which respondes in to this request. Sending and responding to the request takes a couple of milliseconds. My problem arise when I want to transfer files - When the server notice that a filetransfer is incoming, it should pop up a filedialog to define the target file to store the data. To spice things up I've created a custom frame and filedialog which extends JWindow. This works great, but the loadingtime sucks! If I remove EVERYTHING from the constructor in the filedialog, the creation of an instance (which now does nothing,doesn't even call super) takes about 14 seconds! How can this be?? The conclusion I've reached is that this only occurs during the instantiation of the first graphical component, meaning that it loads the native libraries during this instantiation. But how can this take 14 seconds??? If anyone knows why and,even more important, how to solve this, please let me know...
    Regards,
    Andreas Nilsson

    The source of all evil was a simple deadlock.

  • Diagnostic Problem: Native Libraries FOUND!!

    Hello All,
    I would like some help installing JMF2.1.1e.
    I'm using Windows XP. I installed it using the InstallShield, and my classpath & path were set to the relevant directory... however I get the following error when running the JMF diagnostic...
    JMF Version... 2.1.1e
    Win32 Build
    Native Libraries Found
    Can somebody please shed some light...
    Many thanks...

    That is not an error.
    That is what it should say.

  • Defining Native Libraries? (Unsatisifed link error)

    I am testing an application that we previously had working on 10g release 2 (as well as Tomcat and WebLogic, all on Windows). At the moment my application can't find a couple of native libraries, which should be easy enough to fix. Just set the java.library.path.
    My problem is that I can't find anywhere in the Oracle 10g administration to specify the locations of the libraries or set the java.library.path that is used. How is this done?
    I added the location to the PATH environment variable (which 10g seems to ignore) and I have tried following the docs at http://download-west.oracle.com/docs/cd/B14099_12/core.1012/b13996/oc4j.htm#sthref394 (although I realise this is for release 2 and not release 3) without success.
    I've search the forums and this seems to be an oft asked question. Does anyone know how to do it, or can point me at the documentation?
    Cheers

    Thanks Maro, but I have already tried that without success I am afraid. I had added the following:
    <environment>
    <variable id="LD_LIBRARY_PATH" value="C:\Program Files\Documentum\Shared" append="true" />
    </environment>
    I still get "java.lang.UnsatisfiedLinkError: no dmcl40 in java.library.path"
    And, indeed, when I look that the java.library.path all I have is
    C:\product\10.1.3\OracleAS_1\jdk\bin;.;C:\WINDOWS\system32;C:\WINDOWS;
    C:\product\10.1.3\OracleAS_1\opmn\bin;C:\product\10.1.3\OracleAS_1\opmn\lib;
    C:\product\10.1.3\OracleAS_1\bin;C:\WINDOWS;C:\WINDOWS\system32
    The folder C:\Program Files\Documentum\Shared is also in my PATH environment varibale (which Oracle is ignoring for some reason).
    This is really frustrating. :o(

  • Calling native libraries from OC4J (howto config)

    Hello folks,
    I need your help. I am trying to set up OC4J so that I can call native libraries from my servlet. Could you point me to the respective documentation or give a hint on how to configure OC4J for this? Thank you.
    GKK

    gday GKK --
    I don't have an example, so I'm working from memory here and assuming you are using OC4J standalone.
    There's two aspects which need to be considered:
    1: the Java wrapper classes you have which call out to the native libary.
    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.
    cheers
    -steve-

  • How to unload native libraries?

    Hi,
    we have written a J2EE application which needs native libraries (DLL's). Every time that we redeploy the ear file the DLL does not get unloaded and reloaded 'coz it seems 2 B loaded by a classloader which is not a child of the ear classloader. Is there a way we can unload and reload native libraries (DLL's)? Right now, the only way 2 get around this problem is 2 restart the application server (Weblogic 7.0) which is a pain!
    Thanx in advance
    Sid

    Is there a way we can
    unload and reload native libraries (DLL's)?Yes and no.
    There is no way to doit in java.
    There is a way in C/C++.
    You create two dlls. One with the code and one that just proxies to the other dll. The proxy also loads and unloads the dll as it changes and keeps track of the methods.
    If the actual interface to the dll changes then it is somewhat more problematic. If the proxy uses va_args then it can handle that as well.
    Obviously care must be taken in what is being done in the dll. For instance static values would have to be re-initialized with the correct values. That is going to be difficult if a method in java drove the initialization.

Maybe you are looking for