Loading JNI library on Tomcat startup

I am trying to load a JNI library on startup of servlet. I have written the following code in my servlet init function:
public void init(ServletConfig config) throws ServletException {
super.init(config);
log.info("Loading native libraries...");
System.loadLibrary("foo");
log.info("Native libraries loaded...");
On Tomcat startup, I see the "Loading native libraries..." message, but I don't see the "Native libraries loaded...". As if the system hung in the System.loadLibrary function.
Anybody knows how to solve this problem?
Martin

The specification specifically forbids the use of native libraries in container objects. So you might want to take that into consideration with whatever you are doing.
If you do want to do that then I would suggest loading it outside of the container. There is probably some configuration option that allows you to force tomcat to load something on start up.
You might also want to consider if hot deploys are part of your future. If they are then you might want to put the interface inside of your own custom class loader, so you can probably control the unload of the shared library.
If you search the J2EE lists you will find that almost everyone states that JNI should not even be loaded into the server. Instead you should create a seperate application and use RMI to access it. Myself I think that is overkill, but I would probably consider exactly what I am interfacing to before making that final decision. If your JNI library blows up it will take down the entire server (which is why the spec forbids it.)

Similar Messages

  • Error in SAPGUI-on AIX- Can't load JNI library

    Error in SAPGUI-on AIX- Can't load JNI library
    I am getting error as below:
    ^C# ./sapgui /H/punlparidm06 /S/sapdbIND
    ERROR #############################
    07.03. 12:48:37.619 ERROR: Attempt to load shared library /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so failed.
    07.03. 12:48:37.619 ERROR: The library file exists, so either the program
    07.03. 12:48:37.619 ERROR: don't has the privileges to access the library
    07.03. 12:48:37.619 ERROR: or the library is not loadable by the shared object loader
    07.03. 12:48:37.619 ERROR: Technical information:
    07.03. 12:48:37.619 ERROR: Error location: GuiJniLoader.loadPlatinLibrary()
    07.03. 12:48:37.619 ERROR: Error message : /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so: load ENOEXEC on shared library(s) /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so
    ERROR #############################
    java.lang.UnsatisfiedLinkError: /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so: load ENOEXEC on shared library(s) /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2144)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1973)
    at java.lang.Runtime.load0(Runtime.java:773)
    at java.lang.System.load(System.java:887)
    at com.sap.platin.r3.util.GuiJniLoader.loadPlatinLibrary(GuiJniLoader.java:114)
    at com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:24)
    at com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:289)
    at com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:316)
    at com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:860)
    at com.sap.platin.base.logon.GuiImpl.evalCommandLine(GuiImpl.java:275)
    at com.sap.platin.base.logon.GuiImpl.<init>(GuiImpl.java:44)
    at com.sap.platin.base.logon.GuiImpl.main(GuiImpl.java:447)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at com.sap.platin.micro.Microkernel.invokeMainMethod(Microkernel.java:1670)
    at com.sap.platin.micro.Microkernel.startApplication(Microkernel.java:1750)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at com.sap.platin.Gui.main(Gui.java:65)
    java.lang.Exception: JniAgiLibAdaptor.<init>: Cannot load JNI library
    at com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:25)
    at com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:289)
    at com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:316)
    at com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:860)
    at com.sap.platin.base.logon.GuiImpl.evalCommandLine(GuiImpl.java:275)
    at com.sap.platin.base.logon.GuiImpl.<init>(GuiImpl.java:44)
    at com.sap.platin.base.logon.GuiImpl.main(GuiImpl.java:447)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at com.sap.platin.micro.Microkernel.invokeMainMethod(Microkernel.java:1670)
    at com.sap.platin.micro.Microkernel.startApplication(Microkernel.java:1750)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at com.sap.platin.Gui.main(Gui.java:65)
    ERROR #############################
    07.03. 12:51:52.173 ERROR: GuiConnection: Connect failed
    07.03. 12:51:52.173 ERROR: JniAgiLibAdaptor.<init>: Cannot load JNI library
    ERROR #############################

    Hi,
    It seems to be a permission issue.
    Just check the permissions and grant 755 using chmod comand.
    Hope it helps.
    Reward suitable points!!!!!

  • Solaris java sapgui error JniAgiLibAdaptor. init : Cannot load JNI library

    i have a problem java sapgui.
    Launch the Sapgui and then try to connect to any one of the three choices and it should produce the following error.
    i am running this on a Solaris 10 32bit. This sam java SAPGUI runs fine when i boot into the windows xp pro. Hope this helps.
    gui version;
    SAPGUI for Java 7.10 rev 8 (java),
    no library (lib)
    (Version ID 071000040800)
    Mon Mar 30 10:34:24 MEST 2009
    uw1059, 710_REL, 1054563
    Java VM: Sun Microsystems Inc. Version 1.6.0_14
    OS: SunOS(x86) Version 5.10
    The version of Java being used is:
    java -version
    java version "1.5.0_16"
    Java(TM) Platform, Standard Edition for Business (build 1.5.0_16-b02)
    Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
    Thank You,
    Ferhan
    JniAgiLibAdaptor.<init>: Cannot load JNI library
    details;
    java.lang.Exception: JniAgiLibAdaptor.<init>: Cannot load JNI library
    at: com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:29)
    at: com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:283)
    at: com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:297)
    at: com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:798)
    at: com.sap.platin.base.logon.GuiLogonFrame.doConnect(GuiLogonFrame.java:838)
    at: com.sap.platin.base.logon.GuiLogonFrame$SymListener.actionPerformed(GuiLogonFrame.java:443)
    at: javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at: javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at: javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at: javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at: javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at: java.awt.Component.processMouseEvent(Unknown Source)
    at: javax.swing.JComponent.processMouseEvent(Unknown Source)
    at: java.awt.Component.processEvent(Unknown Source)
    at: java.awt.Container.processEvent(Unknown Source)
    at: java.awt.Component.dispatchEventImpl(Unknown Source)
    at: java.awt.Container.dispatchEventImpl(Unknown Source)
    at: java.awt.Component.dispatchEvent(Unknown Source)
    at: java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at: java.awt.LightweightDispatcher.proc
    Attempt to load shared library
    /opt/SAPClients/SAPGUI7.10rev8/bin/libJPlatin.so failed.
    The library file exists, so either the program has
    insufficient privileges to access the library or the library
    is not loadable by the shared object loader.
    Please recheck the system requirements for your operating
    system and make sure all required libraries are installed.
    details;
    ava.lang.UnsatisfiedLinkError: /opt/SAPClients/SAPGUI7.10rev8/bin/libJPlatin.so: ld.so.1: java: fatal: /opt/SAPClients/SAPGUI7.10rev8/bin/libJPlatin.so: wrong ELF data format: ELFDATA2MSB (Possible cause: endianness mismatch)
    at: java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at: java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at: java.lang.ClassLoader.loadLibrary(Unknown Source)
    at: java.lang.Runtime.load0(Unknown Source)
    at: java.lang.System.load(Unknown Source)
    at: com.sap.platin.r3.util.GuiJniLoader.loadPlatinLibrary(GuiJniLoader.java:56)
    at: com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:27)
    at: com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:283)
    at: com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:297)
    at: com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:798)
    at: com.sap.platin.base.logon.GuiLogonFrame.doConnect(GuiLogonFrame.java:838)
    at: com.sap.platin.base.logon.GuiLogonFrame$SymListener.actionPerformed(GuiLogonFrame.java:443)
    at: javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at: javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at: javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at: javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at: javax.swing.plaf.basic.BasicB

    Hello Ferhan,
    the output of the AboutBox is indicating that you are trying to run SAP GUI for Java on Solaris 10 with x86 CPU. Unfortunately, the library required to be loaded is complied for SPARC. Please have a look at the system requirements part of the manual coming with the installer of SAP GUI for Java or [note 959236|https://service.sap.com/sap/support/notes/959236].
    Best regards
    Rolf-Martin

  • Verify installation of MS C Runtime Library - Cannot load JNI library

    Hello,
    I´am working on a MS XP frontend on customer side and have no admin rights, installed is  SAPGUI for Java 7.10rev4 with sun java version 1.5.0_11
    The admin from the customer told me that he had completly installed the MS C Runtime Library VS2005 SP1, file vcredist_x86.msi.
    However, if I try to use the JAVA Gui I found in the trace file the following error:
    29.07. 10:25:16.039 CON: new GuiNiNetConnection
    0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1. ERROR #############################
    29.07. 10:25:16.055 ERROR: GuiConnection: Connection failed
    29.07. 10:25:16.055 ERROR: JniAgiLibAdaptor.: Cannot load JNI library
    0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1. ERROR #############################
    0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2. ERROR #############################
    29.07. 10:25:16.055 ERROR: JniAgiLibAdaptor.: Cannot load JNI library
    29.07. 10:25:16.055 ERROR: Technical Details
    29.07. 10:25:16.055 ERROR: java.lang.Exception: JniAgiLibAdaptor.: Cannot load JNI library
    29.07. 10:25:16.055 ERROR: at: com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init
    In an old posted message I found the information that the reason should be that the MS C Runtime Library is not installed.
    - Is there a simple way to check if the vcredist_x86.msi is installed in a correct and completed way?
    - Any other ideas about the error "Cannot load JNI library" on a windows XP system?
    Thanks in advance,
    Stefan

    Hi szgyurka!
    I have an article here that can help you troubleshoot this issue with your iTunes application:
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/ts1717
    Take care, and thanks for visiting the Apple Support Communities.
    Cheers,
    Braden

  • Check if applet can load JNI library within the applet

    Hello,
    I have a signed applet that is part of a bigger application. The application has native installer that installs some JNI libraries and grants permissions to my applet in java.policy file. However if the user did not install the application (using the installer) which means that the java.policy file is not modified. Then if he/she go directly go to the web UI, and opens my applet the user sees a dialog with the following warning: "The applet was signed by "xxx", but Java cannot verify the authenticity of the signature's certificate. Do you trust this certificate?" that have two buttons "Trust" and "Don't trust".
    I have two questions:
    A) Is it possible instead of showing the dialog, the JVM directly to choose "Don't trust", which means that I will get a security exception inside my code, so I can navigate to another site with installation instructions.
    B) what is the exact reason for showing this dialog. Is it because I am calling System.loadLibrary("xxx"); which requires privileges. If this is the case, how can I check if the applet has enough privileges before calling System.loadLibrary()?
    Thanks in advance
    Kiril

    A) Is it possible instead of showing the dialog, the JVM directly to choose "Don't trust", which means that I will get a security exception inside my code, so I can navigate to another site with installation instructions.Just don't sign it. It will be totally untrusted, except for clients that have java.policy modified.
    You will get the exception, will catch it and you will be able to navigate to another page from the
    catch block.
    B) what is the exact reason for showing this dialog.The reason is that the applet is signed.
    The reason for the "but..." part is that the certificate was created by a certificate authority that
    Java does not recognize (it would recognize 'well known' CA's like Verisign, Thawte etc.).
    Is it because I am calling System.loadLibrary("xxx"); which requires privileges. If this is the case, how can I check if the applet has enough privileges before calling System.loadLibrary()?Why 'before'? Isn't this good enough?
    try
      System.loadLibrary("xxx");
      // Applet has privileges
    catch ( SecurityException e )
      // Applet does not have privileges
    }

  • Error: Can't load libJPlatin.so -(JNI Library)in SAP GUI  for java 7.0 -AIX

    Hi,
    I am getting error in SAP GUI  for java 7.0 -AIX
    <b>Error: Can't load libJPlatin.so -(JNI Library)</b>
    I ran command as
    <b>./guistart /H/localhost/S/sapdbIND</b>
    I gave 777 permission to corressponding library.

    It's on AIX.
    <b>I am getting error as below:</b>
    ^C# ./sapgui /H/punlparidm06 /S/sapdbIND
    ERROR #############################
    07.03. 12:48:37.619 ERROR: Attempt to load shared library /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so failed.
    07.03. 12:48:37.619 ERROR: The library file exists, so either the program
    07.03. 12:48:37.619 ERROR: don't has the privileges to access the library
    07.03. 12:48:37.619 ERROR: or the library is not loadable by the shared object loader
    07.03. 12:48:37.619 ERROR: Technical information:
    07.03. 12:48:37.619 ERROR: Error location: GuiJniLoader.loadPlatinLibrary()
    07.03. 12:48:37.619 ERROR: Error message : /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so:  load ENOEXEC on shared library(s) /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so
    ERROR #############################
    java.lang.UnsatisfiedLinkError: /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so:  load ENOEXEC on shared library(s) /local/SAPClients/SAPGUI7.00rev2.1/bin/libJPlatin.so
            at java.lang.ClassLoader$NativeLibrary.load(Native Method)
            at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2144)
            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1973)
            at java.lang.Runtime.load0(Runtime.java:773)
            at java.lang.System.load(System.java:887)
            at com.sap.platin.r3.util.GuiJniLoader.loadPlatinLibrary(GuiJniLoader.java:114)
            at com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:24)
            at com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:289)
            at com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:316)
            at com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:860)
            at com.sap.platin.base.logon.GuiImpl.evalCommandLine(GuiImpl.java:275)
            at com.sap.platin.base.logon.GuiImpl.<init>(GuiImpl.java:44)
            at com.sap.platin.base.logon.GuiImpl.main(GuiImpl.java:447)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
            at java.lang.reflect.Method.invoke(Method.java:391)
            at com.sap.platin.micro.Microkernel.invokeMainMethod(Microkernel.java:1670)
            at com.sap.platin.micro.Microkernel.startApplication(Microkernel.java:1750)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
            at java.lang.reflect.Method.invoke(Method.java:391)
            at com.sap.platin.Gui.main(Gui.java:65)
    java.lang.Exception: JniAgiLibAdaptor.<init>: Cannot load JNI library
            at com.sap.platin.r3.protocol.diag.JniAgiLibAdaptor.<init>(JniAgiLibAdaptor.java:25)
            at com.sap.platin.r3.protocol.diag.GuiDiagToAutomationParser.configure(GuiDiagToAutomationParser.java:289)
            at com.sap.platin.base.connection.GuiConnection.open(GuiConnection.java:316)
            at com.sap.platin.base.application.GuiApplication.createConnection(GuiApplication.java:860)
            at com.sap.platin.base.logon.GuiImpl.evalCommandLine(GuiImpl.java:275)
            at com.sap.platin.base.logon.GuiImpl.<init>(GuiImpl.java:44)
            at com.sap.platin.base.logon.GuiImpl.main(GuiImpl.java:447)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
            at java.lang.reflect.Method.invoke(Method.java:391)
            at com.sap.platin.micro.Microkernel.invokeMainMethod(Microkernel.java:1670)
            at com.sap.platin.micro.Microkernel.startApplication(Microkernel.java:1750)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
            at java.lang.reflect.Method.invoke(Method.java:391)
            at com.sap.platin.Gui.main(Gui.java:65)
    ERROR #############################
    07.03. 12:51:52.173 ERROR: GuiConnection: Connect failed
    07.03. 12:51:52.173 ERROR: JniAgiLibAdaptor.<init>: Cannot load JNI library
    ERROR #############################

  • Having trouble with including JNI library in netbeans

    [Sorry a newbie question - I am more used to writing large amounts of Solaris kernel and writing a JNI for the first time]
    Guys,
    I have a C library that needs to hook into the Java bean. I created a JNI library wrapper around the C library using swig/javah
    and that went fine (using some of the examples/ref in this forum). The JNI library contains classes like SysInfoJNI created
    by swig.
    class SysInfoJNI {
    public final static native int NAME_LEN_get();
    public final static native int NAME_LEN_set();
    I quickly wrote a standalone test program where I did
    public class test {
    // Load JNI Library
    static {
    System.loadLibrary("SysInfo");
    public static void main(String[] args) {
    SysInfoJNI siJNI = new SysInfoJNI();
    I can compile and run this on command line doing
    javac *.java
    java -Djava.library.path=./ Sysinfotest
    and it all works fine. Now I move this code to netbeans since I need to add some more code
    and create a java->web project and pretty much transfer the code there. I add the libSysinfo.so
    using the property->library->create option but netbeans still can't see the symbols coming
    out of Sysinfo JNI library. I suspect it wants the class definitions. My question is how do I
    supply that? swig didn't really crate a header file but it did create Sysinfo.java file. Do I
    just copy Sysinfo.java in the src directory (ugly?) or is there a convention of keeping the
    *.java files in some standard place (like /usr/include for C headers) and then what would be
    the method to include SysInfo.java to my netbeans src so that symbols can be found.
    Thanks,
    Sunay

    OK, seems like I had some kind of mismatch between the library & classes.
    The loadLibrary only had the name and I had the library in /usr/lib. After running
    truss -f -t open /usr/tomcat6/bin/startup.sh >& tomcat.out
    I could see the tomcat was finding the library but still reporting link error.
    Recompiling the library and classes again and then placing the library
    in /usr/lib and classes in the right directory resolved the issue.
    So I guess the answer to my original question is that classes need to
    be delivered as a jar along with the rest of the distribution while the
    library can be delivered in /usr/lib as part of the system.
    Appreciate the help and quick responses.
    Sunay

  • Loading ibatis on tomcat startup

    can I connect ibatis when tomcat loads the web.xml file of my webapp

    The specification specifically forbids the use of native libraries in container objects. So you might want to take that into consideration with whatever you are doing.
    If you do want to do that then I would suggest loading it outside of the container. There is probably some configuration option that allows you to force tomcat to load something on start up.
    You might also want to consider if hot deploys are part of your future. If they are then you might want to put the interface inside of your own custom class loader, so you can probably control the unload of the shared library.
    If you search the J2EE lists you will find that almost everyone states that JNI should not even be loaded into the server. Instead you should create a seperate application and use RMI to access it. Myself I think that is overkill, but I would probably consider exactly what I am interfacing to before making that final decision. If your JNI library blows up it will take down the entire server (which is why the spec forbids it.)

  • PHP Startup: Unable to load dynamic library './oci8.so' - ./oci8.so:

    I have oracle 11g, php5, and apache2 are running on server(A). One of my php application need to connect Oracle 10g on server(B). so I have to configure PHP5 and OCI8. Here is what I have done.
    #env
    ORACLE_SID=demo
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.1.0/db_1/lib
    TNS_ADMIN=/u01/app/oracle/product/11.1.0/db_1/network/admin
    ## PHP configured
    #./configure prefix=/usr/local/php5 with-apxs2=/usr/local/apache2/bin/apxs --with-oci8=/u01/app/oracle/product/11.1.
    0/db_1 enable-sigchild with-config-file-path=/usr/local/apache2/conf
    ##OCI8
    ./configure -with-oci8=shared,/u01/app/oracle/product/11.1.0/db_1
    Then I add "extension=oci8.so" on the php.ini file (/usr/local/php/conf/php.ini)
    ## Here is a problem
    # php phpinfo.php |grep oci
    PHP Warning: PHP Startup: Unable to load dynamic library './oci8.so' - ./oci8.so: cannot open shared object file: No such file or directory in Unknown on line 0
    oci8
    oci8.default_prefetch => 10 => 10
    oci8.max_persistent => -1 => -1
    oci8.old_oci_close_semantics => 0 => 0
    oci8.persistent_timeout => -1 => -1
    oci8.ping_interval => 60 => 60
    oci8.privileged_connect => Off => Off
    oci8.statement_cache_size => 20 => 20
    OLDPWD => /usr/local/apps/oci8-1.3.4
    _SERVER["OLDPWD"] => /usr/local/apps/oci8-1.3.4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    what is your OS?
    Under Fedora 9 I used :
    locate oci8.soI had to use yumex to install a bunch of php files (pecl and phpize) that had the programs to dowload and install oci8.
    Another post has the instructions! Search on phpize or pecl
    in /etc/php.ini put :
    extension=oci8.so

  • Unable to load dynamic library oci8.so

    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?

    Madhu.149 wrote:
    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?
    Madhu.149 wrote:
    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?
    >Why it is searching for libclntsh.so.10.1?
    old PHP software that does not know about V11
    So just create a softlink as below
    ln -s libclntsh.so.11.1 libclntsh.so.10.1

  • Can't load a library that depends on another

    I built a library and it loaded perfectly (just for testing).
    Now, my library is supposed use ALSA's API.
    Now, I get to compile my library, just like before, but now I can't load the library. I get a UnsatisfiedLinkError. The message is a little cryptic: Can't load IA 32-bit .so on a IA 32-bit platform
    It seems like when my library is being loaded, the alsa library on which it depends (libalsa09.so) can't be loaded. How can I avoid this? I added both my library's and alsa's directories to LD_LIBRARY_PATH, but I just can't get it done.
    Here's what happens:
    $ LD_LIBRARY_PATH=/usr/lib/ao/plugins-2:lib java -cp bin wmagic.basic.Wave 440
    Can't load library wmagic_alsa
    java.lang.UnsatisfiedLinkError: /home/antoranz/eclipse/europa/workspace/wmagic/lib/libwmagic_alsa.so: Can't load IA 32-bit .so on a IA 32-bit platform
            at java.lang.ClassLoader$NativeLibrary.load(Native Method)
            at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
            at java.lang.Runtime.loadLibrary0(Runtime.java:822)
            at java.lang.System.loadLibrary(System.java:993)
            at wmagic.basic.SoundOutput.initializeAlsa(SoundOutput.java:87)
            at wmagic.basic.SoundOutput.<init>(SoundOutput.java:29)
            at wmagic.basic.Wave.main(Wave.java:61)Maybe the problem is the way I'm creating my jni so (in an ant target):
    <echo>Compiling Library</echo>
    <exec executable="${Ccompiler}">
         <arg value="-o"/>
         <arg value="${library.dir}/libwmagic_alsa.so" />
         <arg value="-shared" />
         <arg value="-I${source.dir}/wmagic/alsa" />
         <arg value="-I${jni.includes.dir}" />
         <arg value="-I${jni.includes.dir}/linux" />
         <arg value="-lalsa09" />
         <arg value="-L/usr/lib/ao/plugins-2" />
         <arg value="${source.dir}/wmagic/alsa/wmagic_alsa.c" />
         <arg value="-static" />
         <arg value="-lc" />
    </exec>How can I get it to work? I'm catching the exception and using Java Sound as a fall back, but I want to use alsa (and that's another thread in the forums: How to use alsa's default device in Java Sound... but nobody has told me how to... so don't go down that path, please. :-)).

    If you are linking to a shared library then one of the following must be true.
    1. The shared library must be in the shared library path of the OS
    2. You must explicitly load the shared library first using an explicit path.

  • Run servlet automatically when tomcat startup

    Dear all
    I need help to run servlet automatically when tomcat startup without starting even the application containing the servlet
    thanks in advance

    lol
    i've the same problem with my car,I want it to go ahead but without starting the engine and using all this gasoline...
    Seriously... the servlet IS almost your application
    when you start the server, the application starts to
    check the init() method of the servlet Interface
    and the "load-on-startup" parameter of the servlet in the deployment descriptor

  • Help / Configure PHP+IIS+Oracle "Unable to load dynamic library....."

    Hello,
    I am a seasoned Oracle user and PHP developer and for the life of me I cannot get our development server to load the php_oci8.dll file. I have spent hours searching the web, the Oracle forums and reading the FAQs and can still not get the web server to load correctly. Below are some specs about the environment we are running:
    -OS: Win2k Server SP4
    -Web Server: IIS 5.0
    -PHP Version: 5.1.4 PHP
    -Full Oracle Admin 10gr2 client is installed on web server
    When I pull up a page, I get the following warning: "PHP Warning: PHP Startup: Unable to load dynamic library 'D:\temp\php_oci8.dll' - The specified module could not be found. in Unknown on line 0 "
    Here is what I have done to troubleshoot:
    -'everyone' user has full access to the extension directory
    -I have tried moving the php_oci8.dll to other directories and changing the extension_dir in my php.ini
    -I am confident that my extension_dir in the ini file is correct
    -I have tried the Oracle instant client and the full admin OEM client. The machine currently has the full OEM client installed
    -All environment variables appear to be correct
    I rarely post to forums but I am running out of options. If I cannot figure this out soon, we will have to go another route for resolution. Any help is tremendously appreciated.
    Dave.
    [email protected]
    Message was edited by:
    user527623

    Should I explicity create environment variables named: ORACLE_HOME and NLS_LANGYep, you need to create those specific variables.
    Nooooo don't use ODBC!!!!
    Actually, I don't really care either way, I'm pretty much technology agnostic. Different things have different uses and you have to pick the best tool for the job. If I was a zealot I'd say "Don't use IIS" :p
    ~Jer

  • Problems with loading native library/missing methods: no ttJdbcCS1121

    Hi guys,
    Im getting this problem in glassfish 2.1, but in glassfish 3 or in tomcat, i dont get this problem. (Windows)
    Any thoughts?
    java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbcCS1121 in java.library.path
    at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1750)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at com.summitinvt.mdaq.db.handler.DBConnector.getConnection(DBConnector.java:108)
    at com.summitinvt.mdaq.db.handler.DBConnector.initiateConnection(DBConnector.java:101)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:34)
    at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:14)
    at com.summitinvt.mdaq.db.handler.DBConnector$DBConnectorUtil.<clinit>(DBConnector.java:24)
    at com.summitinvt.mdaq.db.handler.DBConnector.getInstance(DBConnector.java:28)
    at com.summitinvt.mdaq.rats.server.CommunicatorImpl.getPnLByCurrency(CommunicatorImpl.java:1074)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    regards
    John

    A similar problem was reported before on this Forum - see
    Re: not able create connection to timesten
    checking the Release Notes I can see 11.2.1.8.0 has been tested against Glassfish 3 but I
    can't see any mention about Glassfish 2 in the v7 or v11 Release Notes (albeit only on a quick
    search).
    In my full install on XP, ttJdbcCS1121.dll is in C:\TimesTen\tt1121_32\bin

  • Shared JNI Library

    Hello:
    I have two different web applications hosted on a server. Both of them use a servlet
    to initialize their own environment. This servlet needs to load a JNI library.
    That means two serlvet contexts will use the same library. The question is:
    When the first web application is done in initialization, and server is trying
    to load the second web application, I will get unsatisfiedLinkError message, that
    is like "the JNI library is loaded by another".
    I have no idea for this issue. Could anyone give me some ideas, doing some configuration
    in webLogic server or changing the design structure?
    I appreciate for any help.
    Johnson Ouyang

    Thank you. I fixed my issue.
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Native library can only be loaded by one classloader, so just move
    class(es) which use JNI to the system classpath. It will solve the
    problem you are currently seeing and will make your application redeployable.
    Johnson <[email protected]> wrote:
    Hello:
    I have two different web applications hosted on a server. Both of themuse a servlet
    to initialize their own environment. This servlet needs to load a JNIlibrary.
    That means two serlvet contexts will use the same library. The questionis:
    When the first web application is done in initialization, and serveris trying
    to load the second web application, I will get unsatisfiedLinkErrormessage, that
    is like "the JNI library is loaded by another".
    I have no idea for this issue. Could anyone give me some ideas, doingsome configuration
    in webLogic server or changing the design structure?
    I appreciate for any help.
    Johnson Ouyang --
    Dimitri

Maybe you are looking for

  • AMD Radeon(TM) HD 7650A Graphics Driver that supports Miracast

    Please  Anyone with any infomation as when will HP and  AMD release a new Display driver with Miracast support, would be very much appreciated. DxDiag on this cards driver is as follow: Display Devices           Card name: AMD Radeon(TM) HD 7650A Gra

  • Corrupted network traffic

    I'm not really sure what to call this problem, but basically any file transfered over Ethernet becomes corrupted and will not launch/will not verify. I've tried from many different sources (internet, local server, connecting to another machine) and e

  • JScrollpane and JPanel help

    i have a panel which is bigger than the main window's size. i want to add it onto the ScrollPane. but the scrollbar is not working. how do i refresh the scrollbar so that the scrollbar comes when the JPanel is attached onto it.

  • What Customer Service?

    i Had been a Sprint customer for 23 years and then made the mistake of switching to Verizon. In the little over 3 months I've been with Verizon, I've spent many hours on the phone about incorrect billing and wondering where 2 of my 3 port in credits

  • File dwonload from blob

    ADF 11g R2, ADF BC Hello I have a file uploaded to the DB as a blob column. I am now trying to download it. I've followed the smuen' example from 'Not yet dcoumented' sample #85: the code like : package olfms.view.backing; import java.io.IOException;