Publish a native library

I am trying to load a native library to be used among many applications in a wls, but I am getting UnsatisfiedLinkError if loaded the library by one application and try to use it by another.
Please if anyone knows how to get this implementation working, I really appreciate it!!

hello all
i cann't find out (or don't understand) the way what i need. i mean how can i copy the dll file(s) in the windows system diractory? i can put the dll in the jar file then how can i copy that dll after extract?
"daney" said that he have done it.
This certianly is possible. I have done it.
You have to extract the dll from the jar file and write it to a temporary >file in the file system. Then call System.load() on the file you just >extracted.
Do you want to delete the temporary file when you are done with it? >That is a bit more difficult, but it is possible if you use a ClassLoader >to run your code containing native methods.anybody have any idea how he has done? please give some details if anyone have worked on it before.i am waiting for the solutions.
thanks
bashar

Similar Messages

  • Common JNI Native Library inside servlets

    I need to load a native library from a jee application, every things runs pretty well until I instanciate a new class inside a different application and try to load the same native library, wls throws a UnsatisfiedLinkException.
              How can I share the native library for both applications and avoid the UnsatisfiedLinkException?
              Any idea, thoughts?
              thanks

    Finally I get it working by myself. In difference to WAS, WLS does not have any document where specifies how to load a shared native library.
              After two weeks of research, I went for an EJB solution followed by a singleton class. Why EJB? because I need to have an only one object where I can load the native library both loaded by the same classloader and share it by any mean. With this implementation avoid the UnsatisfiedLinkException, and publish an object which has access to the native library. And finally the singleton, you know how it works, it loads once the native library in its constructor avoids the restriction to load just once a native library in the same JVM.

  • NOT WORKING: Putting a jar file requiring native library in bootclasspath

    Hi,
    I put my own jar file into the bootclasspath like this:
    java -Xbootclasspath/p:myboot.jar TestClass
    Some classes in the jar require a native library. For JVM 1.3 on Solaris, I put the native library in $JAVA_HOME/jre/lib/sparc and everything works just fine.
    However, when I try the same thing on JVM1.4, I got the following error when my class containing the native methods is called:
    Failed to load the native library: myboot_native
    java.lang.UnsatisfiedLinkError: no myboot_native in java.library.path
    I tried to put that native library in several different directories in jre/lib but still had no luck.
    Is there anybody know the solution? Does JVM1.4 allow me to put a custom jar file that requires a native library in the bootclasspath?
    Regards,
    Eman

    Well is your file in a directory included in the java.library.path environement variable. I use java on windows but I have to add the directory where my native library is to the path variable (not classpath) in order to avoid the error you get.

  • Can I create more than one instance of a native library?

    Hello all,
    I am using Java to access a Win32 DLL with JNI. Everything is working fine, but I have several threads using the same instance of the native library because it is loaded "statically" in the Java class which uses it, and I suspect I am getting a bottle-neck at the native library.
    Does anyone know if there is any way to load more than one "instance" of a native library?
    The use of System.loadLibrary() would indicate not, and my (limited) knowledge of the Windows environment would tell me that a "shared" library only has on instance. (confirm anyone?)
    I need to find a way around this bottle-neck issue... (and "no", before anyone suggests it, I can't ditch Windows!)
    Thanks.

    I am not sure about the behaviour of the dll as it's not mine. It's a COM DLL which I have "wrapped" in a standard windows DLL so I can expose the JNI methods. I assume because it's COM that it IS reentrant, but I am a bit of a novice when it comes to Windows and COM. I didn't install the COMponent either, it was installed as part of another application. (It's an antivirus COM dll that is part of an AV application)
    Thanks for your help though, I think I will just have to live with it.

  • How to use a native library packaged in a connector

    Hi,
    I know how to package a native library into a connector in my app server. But I don't quite know how to use it. Suppose I provide a wrapper java class for the native library, can I use the java class directly in my EJB (since the classloader of the RA is the parent of the EJB classloader) or I have to issue an outbound call?
    Thanks,
    Haitao

    Thanks Vidyut! You've answered my question.
    I placed the jar file in the $CATALINA_HOME/shared/lib directory. But where should I place the taglib TLD file? And how should I reference it in web.xml?
    Currently, my web.xml is as follows and it doesn't work.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <taglib>
    <taglib-uri>http://abc.com</taglib-uri>
    <taglib-location>c:\Tomcat\shared\lib\mytags-taglib.tld</taglib-location>
    </taglib>
    </web-app>
    Thanks again!
    Joe

  • How to use a native library (.so) in EJB

    Hi,
    I know how to package a native library into a connector in iAS. But I don't quite know how to use it. Suppose I provide a wrapper java class for the native library, can I use the java class directly in my EJB (since the classloader of the RA is the parent of the EJB classloader) or I have to issue an outbound call?
    Also, if I package the native library into a RA (standalone), iAS will automatically load it so in my wrapper java class, I don't have to call System.loadLibrary(...). Correct?
    Thanks,
    Haitao

    Thanks, Russ. My older Mac Pro is a 2,1 -- I think I only missed by a few months in buying one that would run Mavericks (64 bit EFI).  I do intend to buy a "trashcan" Mac Pro but not just yet.
    As for updating projects — that's my issue, I think. The Mac Pro and the laptop are networked so I can be working on my laptop and go to the Mac Pro and open the Final Cut Pro that is resident on that computer. What is odd is that it doesn't open any of the projects that normally open up with I start up FCP X on the Mac Pro.
    I frequently work inside the house on my laptop running programs that are on my Mac Pro outside in my office — usually no problem at all with Adobe applications. 
    FCP X won't let me open a project by clicking on the project — it insists that I "Open projects from within FCP X" but they won't open that way.  This what is odd — that it won't let me open projects even thought they are fully native to that version of FCP and are even on the same hard drive on the Mac Pro.

  • Native library working in Eclipse but not in command line ...

    I was working on a Nutch project combing CMeCab with the analyzer.
    It uses:
    System.load('CMeCab');
    where the problem occured. I have the file libCMeCab.so in /usr/lib/ and it was working fine inside eclipse.
    But when I complie with ant (by the way I'm not familiar with this great tool, but followed the easy tutorial), and then run everything inside terminal like normal Nutch project. Everything was fine until the index process which uses native library CMeCab to analyze.
    The error was:
    java.io.IOException: Job failed!
    And in the hadoop.log in detail:
    java.lang.UnsatisfiedLinkError: no CMeCab in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1028)
    I didn't have runtime -D option in Eclipse run configuration for library path, and didn't know what was the difference that's causing the trouble. I googled trying hard, but most of the MeCab documentations is in Japanese and merely had the problem I had.
    Please help me.
    Thanks in advance.

    Hello,
    I was working on a Nutch project combing CMeCab with the analyzer.No idea what Nutch and CMeCab are (but apparently this latter has unkempt hair ;o).
    I didn't have runtime -D option in Eclipse run configuration for library path, and didn't know what was the difference that's causing the trouble.I won't know either why it works in Eclipse, but have you tried adding -Djava.library.path=/usr/lib to the command line, to check how it works? If it works, would this be a problem to use this configuration?
    Regards,
    J.

  • Error in Java Runtime Environment when running JNI native library

    Hi,
    I am kinda new to JNI but understand it [and done some tutorials]. I am trying to implement JavaStyle [ a Java vst host that uses JNI ] and have reached a point where i successfully build the native code to a dll, and almost manage to load the native dll library. I do not get a Unsatisfied Link Error, but instead have the JVM close due an internal error.
    I am completely lost and dont know what to try now, and I would appreciate any help offered.
    I have debugged and the error arrives at the System.load line of code:
      static {
        System.out.print("Pre loadLibrary..."); 
        System.loadLibrary("JaVaSTyle");
        System.out.println("JavaStyle dll loaded in JVSTLibrary");
      }Detail: I compiled the native library with MS visual studio .NET 2003 using the project settings supplied from the CVS repository.
    I use Netbeans 6.0 for the java side of things. The console output is:
    # An unexpected error has been detected by Java Runtime Environment:
    #  Internal Error (0xe0434f4d), pid=1500, tid=6012
    # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
    # Problematic frame:
    # C  [kernel32.dll+0x12a5b]
    # An error report file with more information is saved as hs_err_pid1500.logand the error report is :
    # An unexpected error has been detected by Java Runtime Environment:
    #  Internal Error (0xe0434f4d), pid=1500, tid=6012
    # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
    # Problematic frame:
    # C  [kernel32.dll+0x12a5b]
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    ---------------  T H R E A D  ---------------
    Current thread (0x00297000):  JavaThread "main" [_thread_in_native, id=6012]
    siginfo: ExceptionCode=0xe0434f4d
    Registers:
    EAX=0x0090f4c0, EBX=0x00000001, ECX=0x000b0fd0, EDX=0x00000000
    ESP=0x0090f4bc, EBP=0x0090f510, ESI=0x00000000, EDI=0x00000000
    EIP=0x7c812a5b, EFLAGS=0x00000246
    Top of Stack: (sp=0x0090f4bc)
    0x0090f4bc:   000b0fd0 e0434f4d 00000001 00000000
    0x0090f4cc:   7c812a5b 00000000 791b9d02 02ea1198
    0x0090f4dc:   07624998 000b0fd0 0090f4fc 791be271
    0x0090f4ec:   000ae008 00000002 07624998 00000000
    0x0090f4fc:   0090f50c 791be286 000ae008 07624998
    0x0090f50c:   0090f51c 0090f568 7921020d e0434f4d
    0x0090f51c:   00000001 00000000 00000000 000b0fd0
    0x0090f52c:   0090f578 00000001 7c812a5b 0090f1f0
    Instructions: (pc=0x7c812a5b)
    0x7c812a4b:   8d 7d c4 f3 a5 5f 8d 45 b0 50 ff 15 08 15 80 7c
    0x7c812a5b:   5e c9 c2 10 00 85 ff 0f 8e 36 93 ff ff 8b 55 fc
    Stack: [0x008c0000,0x00910000),  sp=0x0090f4bc,  free space=317k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C  [kernel32.dll+0x12a5b]
    C  [mscorwks.dll+0x6020d]
    C  [mscorwks.dll+0x60190]
    C  [mscorwks.dll+0x60144]
    C  [mscorwks.dll+0xa6dcb]
    C  [mscorwks.dll+0x26a7e]
    C  0x000b15f6
    j  java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;)V+0
    j  java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+300
    j  java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+268
    j  java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String;)V+54
    j  java.lang.System.loadLibrary(Ljava/lang/String;)V+7
    j  org.tango.JaVaSTyle.JVSTLibrary.<clinit>()V+10
    v  ~StubRoutines::call_stub
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;)V+0
    j  java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+300
    j  java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+268
    j  java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String;)V+54
    j  java.lang.System.loadLibrary(Ljava/lang/String;)V+7
    j  org.tango.JaVaSTyle.JVSTLibrary.<clinit>()V+10
    v  ~StubRoutines::call_stub
    j  org.tango.JaVaSTyle.Main.main([Ljava/lang/String;)V+3
    v  ~StubRoutines::call_stub
    ---------------  P R O C E S S  ---------------
    Java Threads: ( => current thread )
      0x02a6d800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4752]
      0x02a68c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4472]
      0x02a67800 JavaThread "Attach Listener" daemon [_thread_blocked, id=2016]
      0x02a66c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4328]
      0x02a62400 JavaThread "Finalizer" daemon [_thread_blocked, id=5072]
      0x02a5dc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=5552]
    =>0x00297000 JavaThread "main" [_thread_in_native, id=6012]
    Other Threads:
      0x02a5cc00 VMThread [id=4660]
      0x02a6f000 WatcherThread [id=3864]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation   total 960K, used 199K [0x22970000, 0x22a70000, 0x22e50000)
      eden space 896K,  22% used [0x22970000, 0x229a1ff0, 0x22a50000)
      from space 64K,   0% used [0x22a50000, 0x22a50000, 0x22a60000)
      to   space 64K,   0% used [0x22a60000, 0x22a60000, 0x22a70000)
    tenured generation   total 4096K, used 0K [0x22e50000, 0x23250000, 0x26970000)
       the space 4096K,   0% used [0x22e50000, 0x22e50000, 0x22e50200, 0x23250000)
    compacting perm gen  total 12288K, used 23K [0x26970000, 0x27570000, 0x2a970000)
       the space 12288K,   0% used [0x26970000, 0x26975c48, 0x26975e00, 0x27570000)
        ro space 8192K,  66% used [0x2a970000, 0x2aebf860, 0x2aebfa00, 0x2b170000)
        rw space 12288K,  52% used [0x2b170000, 0x2b7bf078, 0x2b7bf200, 0x2bd70000)
    Dynamic libraries:
    0x00400000 - 0x00423000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\java.exe
    0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f5000      C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f02000      C:\WINDOWS\system32\RPCRT4.dll
    0x77fe0000 - 0x77ff1000      C:\WINDOWS\system32\Secur32.dll
    0x7c340000 - 0x7c396000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\msvcr71.dll
    0x6d870000 - 0x6daba000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\client\jvm.dll
    0x7e410000 - 0x7e4a0000      C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000      C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
    0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.DLL
    0x5cd70000 - 0x5cd77000      C:\WINDOWS\system32\serwvdrv.dll
    0x5b0a0000 - 0x5b0a7000      C:\WINDOWS\system32\umdmxfrm.dll
    0x003a0000 - 0x003ad000      C:\WINDOWS\system32\myokent.dll
    0x6d3c0000 - 0x6d3c8000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d820000 - 0x6d82c000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\verify.dll
    0x6d460000 - 0x6d47f000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\java.dll
    0x6d860000 - 0x6d86f000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\zip.dll
    0x10000000 - 0x10018000      D:\NetbeansWorkspace\myJavaStyle\JaVaSTyle.dll
    0x79170000 - 0x79196000      C:\WINDOWS\system32\mscoree.dll
    0x10480000 - 0x1053c000      C:\WINDOWS\system32\MSVCP71D.dll
    0x10200000 - 0x10287000      C:\WINDOWS\system32\MSVCR71D.dll
    0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x77c10000 - 0x77c68000      C:\WINDOWS\system32\msvcrt.dll
    0x791b0000 - 0x79412000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll
    0x79040000 - 0x79085000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
    0x7c9c0000 - 0x7d1d6000      C:\WINDOWS\system32\SHELL32.dll
    0x773d0000 - 0x774d3000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
    0x5d090000 - 0x5d12a000      C:\WINDOWS\system32\comctl32.dll
    0x79780000 - 0x79980000      c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll
    0x774e0000 - 0x7761d000      C:\WINDOWS\system32\ole32.dll
    0x79430000 - 0x7947c000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\MSCORJIT.DLL
    0x51a70000 - 0x51af0000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\diasymreader.dll
    VM Arguments:
    java_command: org.tango.JaVaSTyle.Main
    Launcher Type: SUN_STANDARD
    Environment Variables:
    CLASSPATH=.;C:\jdk1.5.0_09\bin;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
    PATH=C:\Program Files\MiKTeX 2.7\miktex\bin;c:\program files\imagemagick-6.3.7-q16;C:\texmf\miktex\bin;C:\Program Files\ActiveState Komodo IDE 4.2\;C:\Program Files\Autodesk\Maya2008\bin;C:\Python25\;C:\Program Files\PC Connectivity Solution\;C:\ORANT\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\GPS Pathfinder Office 3.00;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\ENGLISH;C:\Program Files\Common Files\Motorola\Toolbox;C:\PROGRA~1\COMMON~1\Motorola\Toolbox;C:\Program Files\Novell\ZENworks\;C:\Program Files\Novell\SecureLogin;C:\Program Files\Smart Projects\IsoBuster;C:\Latex\MikTeX\V2.10;C:\PROGRA~1\CA\Common\SCANEN~1;C:\Program Files\CA\Common\ScanEngine;C:\Program Files\CA\SharedComponents\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\SubscriptionLicense\;C:\PROGRA~1\CA\ETRUST~1;C:\Program Files\QuickTime\QTSystem\;C:\cygwin\bin;C:\Program Files\Tcl\bin;D:\netbeansWorkspace\myJavaStyle;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\Csound\bin;C:\Program Files\CVSNT\
    USERNAME=hectorj
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
    ---------------  S Y S T E M  ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 13 stepping 8, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 1047920k(270244k free), swap 2520456k(1654520k free)
    vm_info: Java HotSpot(TM) Client VM (1.6.0_03-b05) for windows-x86, built on Sep 24 2007 22:24:33 by "java_re" with unknown MS VC++:1310

    Something is wrong with the library.
    Staring at java code will not help you figure that out.
    Maybe it isn't intended to be loaded in java but instead it loads java itself?
    If not then write a C/C++ basic app that links that dll in and see if you can at least get it to start.

  • Error ocurred during initialization of VM. Unable to load native library...

    Hi,
    I´m trying to install Oracle 9i on a PC with Suse 9.2.
    when I put the first CD it comes with this error:
    Initializing Java Virtual Machine from /tmp/OraInstall2006-05-04_11-13-11PM/jre/bin/java. Please wait...
    Error occurred during initialization of VM
    Unable to load native library: /tmp/OraInstall2006-05-04_11-13-11PM/jre/lib/i386/libjava.so: symbol __libc_wait, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
    I´ve seen that there was a similar issue in 2004 and I´ve trying to do what it says but it didn´t work this time.
    Unable to load native library:
    Could everyone help me to install Oracle??? I´ve been trying it for a few days and doesn´t work.
    Regards,

    I had same problems long time ago. Ok, I try to remember.
    First I read the recommandation. You need a special GLIBC-Library to support the JAVA 1.1.8 runtime environment.
    Some of the Oracle9i tools are compiled with gcc 2.95 compiler.
    You may need ”gcc_old for SLES9” for linking of those tools.
    gcc_old-2.95.3-175.2.i586.rpm is included in SLES 9 SP2 CD1
    For Suse you can obtain a package called orarun. You will get further support for installing, starting and stopping ORACLE. Please look at http://ftp.novell.com/partners/oracle/docs/9205_sles9_install.pdf.
    Good luck.

  • Problem :  Native Library already loaded in another classloader

    I created a shared library HaspKeyAPI.dll by using JNI and add path to Java class library. I need to call native functions in my servletAction class to check some information in a key. Sometimes not always, I met �java.lang.UnsatisfiedLinkError: Native Library C:\eclipse\workspace\HaspKey\SharedLib\HaspKeyAPI.dll already loaded in another classloader� problem. I have to restart tomcat server then to restart my web app.
    Does anyone know how to fix it?
    Thank you in advance!
    ////////////////////////////////////my native function class, a singleton class////////////////////////////////
    package haspkey.api;
    import java.util.Collection;
    import java.util.Vector;
    import haspkey.HardwareSecurityKey;
    Public class HaspKeyAPI {
    Public static final int KEYEXIST = 1;
    //A Singleton Class
    private static HaspKeyAPI haspKeyAPI;
    private HaspKeyAPI()
    public static HaspKeyAPI getSingletonObject()
    if ( haspKeyAPI== null)
    haspKeyAPI = new HaspKeyAPI();          
    return haspKeyAPI;
    public Object clone()
         throws CloneNotSupportedException
    throw new CloneNotSupportedException();
    /**********use native functions to call hasp C API***********/
    public native int keyPresent(int password1, int password2);
    public native int getId(int password1, int password2);
    public native void readBlock(int startMemoryLocation, int size,
    byte[] block, int password1, int password2);
    public native void writeBlock(int startMemoryLocation,int size, byte[] block, int password1,
    int password2);
    public native boolean decodeData(int size, byte[] block, int password1,
    int password2);
    public native boolean encodeData(int size, byte[] block, int password1,
    int password2);
    static {
    System.loadLibrary("HaspKeyAPI");
    private int getPrivMachineSpeed(boolean decrypt, int pass1, int pass2, String MLOCRTypeCode){
    byte[] block = new byte[8];
    int privMachineSpeed = 0;
    boolean isNumeric = true;;
    readKeyMemory(40,8,block, decrypt, pass1, pass2);
    if(block.length!=8){
    return -1;
    }else{
    String s = new String(block);
    for(int n=0; n<3; n++){
    if(s.charAt(n)<48 || s.charAt(n)>57){
    isNumeric = false;
    if(isNumeric){
    privMachineSpeed = Integer.parseInt(s.substring(0,3));
    return privMachineSpeed;
    public HardwareSecurityKey getHardwareSecurityKey(boolean decrypt, int pass1, int pass2, String AuthorizationCodes,String MLOCRTypeCode){
    HardwareSecurityKey key = new HardwareSecurityKey();
    if(keyPresent(pass1,pass2)==KEYEXIST){
    key.setPrivKeyID(getId(pass1, pass2));
    key.setPrivMachineSpeed(getPrivMachineSpeed(true, pass1,pass2, MLOCRTypeCode));
    }else{
    return null;
    /////////////////////////////// a class include some static final information to call the native function///////////////
    import com.bowebellhowell.haspkey.api.HaspKeyAPI;
    import com.bowebellhowell.winsort.vo.haspkey.HardwareSecurityKey;
    public class HaspKey{
    public static final String MLOCRTypeCode ="mmmmmmmmmmmmmmm";
    public static final String AuthorizationCodes = "bbbbbbbbbbbbbbbb";
    public static final int p1 = 0;
    public static final int p2 = 0;
    public static HardwareSecurityKey getHardwareSecurityKey(){
    HaspKeyAPI key = HaspKeyAPI.getSingletonObject();
    return key.getHardwareSecurityKey(true,p1,p2,AuthorizationCodes,MLOCRTypeCode);
    /////////////////////////////////// a servlet to call native function///////////////////////////////////
    public class LogonAction extends Action {
         public ActionForward execute(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws Exception {
              int n = HaspKey.isKeyPresent();
              if(n!=1){
              if(n==2){
              message = "KeyDriverNotMatch";          
              }else if(n==3){
              message = "KeyOldModel";
              }else if(n==4){
              message = "KeyPasswordNotMatch";
              }else if(n==-1){
              message = "keyNotExist";
              request.getSession().setAttribute("message",message);
    java.lang.UnsatisfiedLinkError: Native Library C:\eclipse\workspace\HaspKey\SharedLib\HaspKeyAPI.dll already loaded in another classloader
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1551)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at haspkey.api.HaspKeyAPI.<clinit>(HaspKeyAPI.java:76)
    at util.HaspKey.isKeyPresent(HaspKey.java:35)
    at LogonAction (LogonAction .java:65)

    Hi EveryBody:
    i working in 2 servlets, these servlets import a login.jar library and login.jar call to Login.dll (a native Library)
    then. when i start second servlet i have this message
    java.lang.UnsatisfiedLinkError: Native Library dllLogin.dll already loaded in another classloader
    i read about class loader and i know about a only one load for native library but i don't know how resolve this exception because both servlets need dllLogin.dll to validate the user
    please anybody knows how or have any idea?
    Kind Regards
    Edson
    --sorry i know. my english is very bad                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem with loading native library in java version "1.5.0_05"

    My application uses a native coded drawing. With java version 1.4.xx it was working just fine but with java 1.5.xx it gives the following error at the time of loading native library:
    java.lang.UnsatisfiedLinkError: /home/abyzov/tmp/friend32-1.6.02/libfriend.so:
    /home/abyzov/tmp/friend32-1.6.02/libfriend.so: undefined symbol: XtWindowToWidget
    I assumed that java loads all necessary X-libraries at start up but it seems to be not true for version 1.5.xx. Does anybody now about this kind of problems? Should I report it as a bug?

    I have this exact same problem. I developed an application all along using 1.4.2_08 to be exact no problems. I was forced to switch to 1.5.0_06, now when I try to run the app I get:
    java.lang.UnsatisfiedLinkError: <path to library>/libcomlib.so: <path to library>/libcomlib.so: undefined symbol: yp_get_default_domain
    I have tried compiling it in both 1.4.2_8 and 1.5.0_06 and it compiles perfectly but when I run with 1.5.0_06 it messes up.
    If you found the problem with this or anyone else has any advice please let me know.

  • Native library NOT thread safe - how to use it via JNI?

    Hello,
    has anybody ever tried to use a native library from JNI, when the library is not thread safe?
    The library (Windows DLL) was up to now used in an MFC App and thus was only used by one user - that meant one thread - at a time.
    Now we would like to use the library like a "server": many Java clients connect the same time to the library via JNI. That would mean each client makes its calls to the library in its own thread. Because the library is not thread safe, this would cause problems.
    Now we discussed to load the library several times - separately for each client (for each thread).
    Is this possible at all? How can we do that?
    And do you think we can solve the problem in this way?
    Are there other ways to use the library, though it is not thread safe?
    Any ideas welcome.
    Thanks for any contributions to the discussion, Ina

    (1)
    has anybody ever tried to use a native library from
    JNI, when the library (Windows DLL) is not thread safe?
    Now we want many Java clients.
    That would mean each client makes its calls
    to the library in its own thread. Because the library
    is not thread safe, this would cause problems.Right. And therefore you have to encapsulate the DLL behind a properly synchronized interface class.
    Now the details of how you have to do that depends: (a) does the DLL contain state information other than TLS? (b) do you know which methods are not thread-safe?
    Depending on (a), (b) two extremes are both possible:
    One extreme would be to get an instance of the interface to the DLL from a factory method you'll have to write, where the factory method will block until it can give you "the DLL". Every client thread would obtain "the DLL", then use it, then release it. That would make the whole thing a "client-driven" "dedicated" server. If a client forgets to release the DLL, everybody else is going to be locked out. :-(
    The other extreme would be just to mirror the DLL methods, and mark the relevant ones as synchronized. That should be doable if (a) is false, and (b) is true.
    (2)
    Now we discussed to load the library several times -
    separately for each client (for each thread).
    Is this possible at all? How can we do that?
    And do you think we can solve the problem in this
    way?The DLL is going to be mapped into the process address space on first usage. More Java threads just means adding more references to the same DLL instance.
    That would not result in thread-safe behavior.

  • Java code to invoke a native library in a Resource Adapter

    Have any of you done the project on invoking a native library in a Resource Adapter that you could share some experience/tips? Thanks

    Hi Frances,
    I haven't yet done anything in this area, but I should be rather staright forward in following the related manuals:
    Configuring the Use of Resource Adapter Native Libraries
    http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28956/adminra.htm#CACJAJHC
    The oc4j-connectors.xml File <security-permission> Element
    http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28957/jcacontinued.htm#CHDHFEDA
    BTW: as far as I can see (haven't read the whole manual) the most important point isn't addressed in this manual: to make the native code available in your Java code, you have to load the native library with a code line like:
    System.loadLibrary("....");
    or
    Runtime.getRuntime().loadLibrary("...");
    This code line is a very critical one, because you can call it only ONCE for a native library during the runtime of a JVM.
    From the Runtime.loadLibrary JavaDoc:
    If this method is called more than once with the same library name, the second and subsequent calls are ignored.
    This statement is also true for calls in different ClassLoaders!
    Best,
    Manfred

  • Bundling a native library in a jar file

    Is it possible to bundle a native library ( a windows dll ) in a jar file. How to let the vm know that the native dll is in a jar file.
    Is this possible?
    thanks
    --kiran                                                                                                                                                                                                                                                                                                                                                   

    hello all
    i cann't find out (or don't understand) the way what i need. i mean how can i copy the dll file(s) in the windows system diractory? i can put the dll in the jar file then how can i copy that dll after extract?
    "daney" said that he have done it.
    This certianly is possible. I have done it.
    You have to extract the dll from the jar file and write it to a temporary >file in the file system. Then call System.load() on the file you just >extracted.
    Do you want to delete the temporary file when you are done with it? >That is a bit more difficult, but it is possible if you use a ClassLoader >to run your code containing native methods.anybody have any idea how he has done? please give some details if anyone have worked on it before.i am waiting for the solutions.
    thanks
    bashar

  • Native library loading problem

    Hi Folks,
    I currently downloaded, and compiled the bDB core using VS 2010 x64 (I run 64 bit win7, and JRE 64 bit). In Eclipse I'm trying to use the native library (setting up the path correctly), however the java is complaining that it cannot find dependencies.
    I switched to JE, it works fine, but I'm not sure if JE is as performant as the core version. Anybody had the same problem?
    thanks in advance
    Edited by: user5493457 on Mar 22, 2011 3:35 AM

    Hi,
    Please review the building process of the Berkeley DB libraries, to ensure you have correctly built them. Review Building Berkeley DB for Windows, Building the Java API and Java configuration. If you want to build 64-bit libraries, make sure you select x64 as platform configuration in Visual Studio when building.
    I assume you are getting a java.lang.UnsatisfiedLinkError exception at runtime. Just to make sure Eclipse correctly finds the native BDB libraries, in your Run Configuration for the project you're trying to run, under Environment, add a new variable, LD_LIBRARY_PATH with a value of something like D:\BerkeleyDB\db-5.1.25\build_windows\x64\Debug (substitute Debug with Release depending on how you built the libraries) -- this is the path to the location of the native BDB libs, libdb51d.dll and libdb_java51d.dll (or libdb51.dll and libdb_java51.dll), so you should change it as appropriate for your system.
    Also, for that Run Configuration add a new variable, CLASSPATH with a value of something like D:\BerkeleyDB\db-5.1.25\build_windows\x64\Debug\db.jar;D:\BerkeleyDB\db-5.1.25\build_windows\x64\Debug\classes (this is the path to the Java API classes and the Java API jar file -- db.jar). Make sure that "Append environment to native environment" option is checked, in the Run Configurations screen.
    Regards,
    Andrei

Maybe you are looking for

  • Pavilion g6 1378sa Hard drive not detected!!!

    Hi all,  Im new on the forum and really need hellp.   Let me explain: One day my notebook didnt start as normal...kept asking to repair the system,I have tried a few times and it still didnt fix the problem.I have 4 x 360 HDD spare ones at home so I

  • Data statistics ALV

    Hi, Till 4.7 when you wanted to see the output of a table in an ALV grid / ALV list the data statistics were showed when you executed this in the background. From 5.0 these data statistics are disappeared. Is there a way to get these statistics back?

  • Question related to use of a managed library in iPhoto11

    Question 1 - A family member decided to place folders with photos on the desktop. I want to import those photos and delete those folders from the desktop? Will the photos be properly transferred and stored in iPhoto 11? Question 2- The photos were pl

  • Iphone 5s network

    sometimes my iphone network signal become disabled ,,,, but when i turn on the airplane mode and turn it off the signal become better and wanna ask about the opensignal's app ( is that app help me ??? )

  • Qulified lookup table field can be viewed at Maintable.

    We have 2 non qualifiers in Qualified lookup table and the field type are lookup flat, If i change the data in this fields, i can able to see the change tracking history at main table level. Thanks NK