Unable to call a native method

Hi All,
I am trying to call a native method tapi3Init from tapi3.dll present in Windows\System32 folder. But I get an error as below.
Exception in thread "Main Thread" java.lang.UnsatisfiedLinkError: DLLCall.tapi3Init
     at DLLCall.main(DLLCall.java:25)
I have verified my java.library.path and it has the path in it. I have cross verified by typing a wrong dll name and that gave a relevant error. So, please let me know what is going wrong?
Also, is it not possible to call a native method from a dll which is not formed by using the javah header file?
Thanks.

native method tapi3Init from tapi3.dllSo that would be your JNI method.
Exception in thread "Main Thread" java.lang.UnsatisfiedLinkError: DLLCall.tapi3Init And you are not calling it. Standard reasons apply.
- library not loaded
- Signatures are different.

Similar Messages

  • EXCEPTION_ACCESS_VIOLATION  while calling a native method.....

    Hi guys,
    i am trying to call a native method from my java code, but i am getting this following error,
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x052bd55f, pid=2740, tid=3884
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode, sharing)
    # Problematic frame:
    # C [F3BC1ENG.DLL+0xd55f]
    In the log file,
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x052bd55f, pid=2740, tid=3884
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode, sharing)
    # Problematic frame:
    # C [F3BC1ENG.DLL+0xd55f]
    --------------- T H R E A D ---------------
    Current thread (0x03b26e50): JavaThread "httpWorkerThread-8080-0" daemon [_thread_in_native, id=3884]
    siginfo: ExceptionCode=0xc0000005, reading address 0x05e71000
    Registers:
    EAX=0x31304443, EBX=0x05d048f0, ECX=0x0c4c0d16, EDX=0x05e70000
    ESP=0x2c76ef38, EBP=0x2c76f034, ESI=0x05e71000, EDI=0x05d06d20
    EIP=0x052bd55f, EFLAGS=0x00010213
    Top of Stack: (sp=0x2c76ef38)
    0x2c76ef38: 00000001 052a9264 2c76f228 052a92a4
    0x2c76ef48: 01190002 00000000 00000000 00000000
    0x2c76ef58: 00000000 ffffffff 00000002 05d05d38
    0x2c76ef68: 00000000 00000000 00000000 00000000
    0x2c76ef78: ffffffff 7c9106eb 00000004 00000000
    0x2c76ef88: 00000000 00000000 00000000 00000000
    0x2c76ef98: 00000000 00000000 00000000 00000000
    0x2c76efa8: 00000000 052bf3e1 2c76efd4 0000101f
    Instructions: (pc=0x052bd55f)
    0x052bd54f: 00 8b 7c 24 2c 8b 4a 18 8d 72 18 8b c1 c1 e9 02
    0x052bd55f: f3 a5 8b c8 eb 16 8b b4 24 bc 00 00 00 8b 7c 24
    Stack: [0x2c670000,0x2c770000), sp=0x2c76ef38, free space=1019k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [F3BC1ENG.DLL+0xd55f]
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j palmsecuresdk.sample.PvsAuthenticationJNI.identifyMatch(I[BLjava/util/List;ILjava/util/List;)I+0
    j packService.palmsImpl.identify([B)Ljava/lang/String;+55
    j packService.palmsSEI_Tie.invoke_identify(Lcom/sun/xml/rpc/server/StreamingHandlerState;)V+50
    j packService.palmsSEI_Tie.processingHook(Lcom/sun/xml/rpc/server/StreamingHandlerState;)V+58
    j com.sun.xml.rpc.server.StreamingHandler.handle(Lcom/sun/xml/rpc/spi/runtime/SOAPMessageContext;)V+819
    j com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+394
    j com.sun.enterprise.webservice.JAXRPCServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+139
    j javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+139
    j javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30
    j org.apache.catalina.core.ApplicationFilterChain.servletService(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/Servlet;Lorg/apache/catalina/util/InstanceSupport;)V+93
    j org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)I+644
    j org.apache.catalina.core.StandardPipeline.doInvoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+77
    j org.apache.catalina.core.StandardPipeline.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+3
    j org.apache.catalina.core.StandardContextValve.invokeInternal(Lorg/apache/catalina/Wrapper;Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)I+238
    j org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)I+252
    j org.apache.catalina.core.StandardPipeline.doInvoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+77
    j com.sun.enterprise.web.WebPipeline.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+53
    j org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)I+89
    j org.apache.catalina.core.StandardPipeline.doInvoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+77
    j com.sun.enterprise.web.VirtualServerPipeline.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+149
    j org.apache.catalina.core.ContainerBase.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+6
    j org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)I+58
    j org.apache.catalina.core.StandardPipeline.doInvoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+77
    j org.apache.catalina.core.StandardPipeline.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+3
    j org.apache.catalina.core.ContainerBase.invoke(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)V+6
    j org.apache.coyote.tomcat5.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+296
    j com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter()V+19
    j com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(Ljava/io/InputStream;Ljava/io/OutputStream;)Z+15
    j com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Ljava/io/InputStream;Ljava/io/OutputStream;)Z+25
    j com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask()Z+74
    j com.sun.enterprise.web.connector.grizzly.ReadTask.doTask()V+161
    j com.sun.enterprise.web.connector.grizzly.TaskBase.run()V+1
    j com.sun.enterprise.web.connector.grizzly.WorkerThread.run()V+22
    v ~StubRoutines::call_stub
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x037aec00 JavaThread "AWT-Windows" daemon [_thread_in_native, id=2664]
    0x0376bb10 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=4020]
    0x03a526c0 JavaThread "Thread-25" daemon [_thread_blocked, id=2508]
    0x03a3b8e8 JavaThread "Timer-5" daemon [_thread_blocked, id=2260]
    0x03a51e18 JavaThread "Timer-4" [_thread_blocked, id=2192]
    0x035bae38 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[__JWSappclients]]" daemon [_thread_blocked, id=2548]
    0x035fac10 JavaThread "httpWorkerThread-4848-1" daemon [_thread_blocked, id=3492]
    0x03786530 JavaThread "httpWorkerThread-4848-0" daemon [_thread_blocked, id=1952]
    0x035fa9e8 JavaThread "SelectorThread-4848" [_thread_in_native, id=408]
    0x03576828 JavaThread "httpWorkerThread-8181-1" daemon [_thread_blocked, id=1964]
    0x0356ee10 JavaThread "httpWorkerThread-8181-0" daemon [_thread_blocked, id=3476]
    0x00c29278 JavaThread "SelectorThread-8181" [_thread_in_native, id=3512]
    0x03acb208 JavaThread "httpWorkerThread-8080-1" daemon [_thread_blocked, id=3472]
    =>0x03b26e50 JavaThread "httpWorkerThread-8080-0" daemon [_thread_in_native, id=3884]
    0x03bea780 JavaThread "SelectorThread-8080" [_thread_in_native, id=1500]
    0x03606198 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv]]" daemon [_thread_blocked, id=3788]
    0x03b57620 JavaThread "SingleSignOnExpiration" daemon [_thread_blocked, id=3528]
    0x03b5fb58 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]]" daemon [_thread_blocked, id=3480]
    0x03c03d58 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[newPalmService]]" daemon [_thread_blocked, id=3524]
    0x03629bf0 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[palmSecure_ws]]" daemon [_thread_blocked, id=3560]
    0x03acbee8 JavaThread "SingleSignOnExpiration" daemon [_thread_blocked, id=2308]
    0x0374f418 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[__asadmin].StandardContext[]]" daemon [_thread_blocked, id=2708]
    0x03601a88 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[__asadmin].StandardContext[web1]]" daemon [_thread_blocked, id=2284]
    0x03b4e748 JavaThread "ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[__asadmin].StandardContext[asadmin]]" daemon [_thread_blocked, id=680]
    0x037e4ac8 JavaThread "Timer-3" [_thread_blocked, id=2100]
    0x03a97b08 JavaThread "RMI RenewClean-[192.168.10.19:1464]" daemon [_thread_blocked, id=2080]
    0x037a7f38 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=1580]
    0x03a4a050 JavaThread "RMI TCP Accept-8686" daemon [_thread_in_native, id=1316]
    0x0379ccd0 JavaThread "Thread-15" [_thread_blocked, id=316]
    0x03771d20 JavaThread "Thread-14" [_thread_blocked, id=228]
    0x0376bcf0 JavaThread "Thread-13" [_thread_blocked, id=436]
    0x0373d2a8 JavaThread "RMI LeaseChecker" daemon [_thread_blocked, id=904]
    0x0373aa68 JavaThread "RMI RenewClean-[192.168.10.19:1429,com.sun.enterprise.admin.server.core.channel.LocalRMIClientSocketFactory@ac4d3b]" daemon [_thread_blocked, id=2320]
    0x00c66dd0 JavaThread "Timer-2" daemon [_thread_blocked, id=1512]
    0x038e3350 JavaThread "Timer-1" [_thread_blocked, id=2272]
    0x03a4ac60 JavaThread "Thread-10" [_thread_in_native, id=4052]
    0x03a6fc88 JavaThread "Thread-8" [_thread_in_native, id=1052]
    0x03a43818 JavaThread "Thread-7" [_thread_in_native, id=2600]
    0x03a1e808 JavaThread "Thread-6" [_thread_in_native, id=1648]
    0x03a1ac20 JavaThread "GC Daemon" daemon [_thread_blocked, id=4084]
    0x03a52e18 JavaThread "RMI Reaper" [_thread_blocked, id=144]
    0x03a52c30 JavaThread "Timer-0" daemon [_thread_blocked, id=208]
    0x03a3d730 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=2044]
    0x00c17020 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3456]
    0x00c15bf0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4064]
    0x00c14ed8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4060]
    0x00c0fd90 JavaThread "Finalizer" daemon [_thread_blocked, id=4044]
    0x00c0e8c0 JavaThread "Reference Handler" daemon [_thread_blocked, id=2436]
    0x0032df88 JavaThread "main" [_thread_blocked, id=1532]
    Other Threads:
    0x00bdc778 VMThread [id=4028]
    0x00c31a20 WatcherThread [id=4068]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 11712K, used 4051K [0x06a70000, 0x07720000, 0x11510000)
    eden space 10432K, 27% used [0x06a70000, 0x06d435b0, 0x074a0000)
    from space 1280K, 90% used [0x075e0000, 0x077017d8, 0x07720000)
    to space 1280K, 0% used [0x074a0000, 0x074a0000, 0x075e0000)
    tenured generation total 25784K, used 15468K [0x11510000, 0x12e3e000, 0x26a70000)
    the space 25784K, 59% used [0x11510000, 0x1242b290, 0x1242b400, 0x12e3e000)
    compacting perm gen total 26880K, used 26785K [0x26a70000, 0x284b0000, 0x2aa70000)
    the space 26880K, 99% used [0x26a70000, 0x28498618, 0x28498800, 0x284b0000)
    ro space 8192K, 67% used [0x2aa70000, 0x2afcd9f8, 0x2afcda00, 0x2b270000)
    rw space 12288K, 46% used [0x2b270000, 0x2b813808, 0x2b813a00, 0x2be70000)
    Dynamic libraries:
    0x00400000 - 0x00406000      D:\Sun\AppServer\lib\appserv.exe
    0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f4000      C:\WINDOWS\system32\kernel32.dll
    0x77c10000 - 0x77c68000      C:\WINDOWS\system32\MSVCRT.dll
    0x6d730000 - 0x6d8c7000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\client\jvm.dll
    0x77d40000 - 0x77dd0000      C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f56000      C:\WINDOWS\system32\GDI32.dll
    0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f01000      C:\WINDOWS\system32\RPCRT4.dll
    0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
    0x6d2f0000 - 0x6d2f8000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
    0x00a10000 - 0x00a27000      C:\Program Files\Common Files\Logishrd\LVMVFM\LVPrcInj.dll
    0x6d700000 - 0x6d70c000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\verify.dll
    0x6d370000 - 0x6d38d000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\java.dll
    0x6d720000 - 0x6d72f000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\zip.dll
    0x6d530000 - 0x6d543000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\net.dll
    0x71ab0000 - 0x71ac7000      C:\WINDOWS\system32\WS2_32.dll
    0x71aa0000 - 0x71aa8000      C:\WINDOWS\system32\WS2HELP.dll
    0x71a50000 - 0x71a8f000      C:\WINDOWS\System32\mswsock.dll
    0x76f20000 - 0x76f47000      C:\WINDOWS\system32\DNSAPI.dll
    0x76fb0000 - 0x76fb8000      C:\WINDOWS\System32\winrnr.dll
    0x76f60000 - 0x76f8c000      C:\WINDOWS\system32\WLDAP32.dll
    0x76fc0000 - 0x76fc6000      C:\WINDOWS\system32\rasadhlp.dll
    0x04220000 - 0x04248000      C:\WINDOWS\system32\rsaenh.dll
    0x769c0000 - 0x76a73000      C:\WINDOWS\system32\USERENV.dll
    0x5b860000 - 0x5b8b4000      C:\WINDOWS\system32\netapi32.dll
    0x6d550000 - 0x6d559000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\nio.dll
    0x662b0000 - 0x66308000      C:\WINDOWS\system32\hnetcfg.dll
    0x71a90000 - 0x71a98000      C:\WINDOWS\System32\wshtcpip.dll
    0x6d520000 - 0x6d528000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\management.dll
    0x6d670000 - 0x6d676000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\rmi.dll
    0x6d070000 - 0x6d1d7000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\awt.dll
    0x73000000 - 0x73026000      C:\WINDOWS\system32\WINSPOOL.DRV
    0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.dll
    0x774e0000 - 0x7761c000      C:\WINDOWS\system32\ole32.dll
    0x73760000 - 0x737a9000      C:\WINDOWS\system32\ddraw.dll
    0x73bc0000 - 0x73bc6000      C:\WINDOWS\system32\DCIMAN32.dll
    0x73940000 - 0x73a10000      C:\WINDOWS\system32\D3DIM700.DLL
    0x6d2b0000 - 0x6d2ef000      C:\Program Files\Java\jdk1.5.0_07\jre\bin\fontmanager.dll
    0x7c9c0000 - 0x7d1d4000      C:\WINDOWS\system32\shell32.dll
    0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x773d0000 - 0x774d2000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
    0x5d090000 - 0x5d127000      C:\WINDOWS\system32\comctl32.dll
    0x05290000 - 0x0529a000      C:\WINDOWS\system32\PvsApiJv.dll
    0x052a0000 - 0x052ac000      D:\Java Project\PalmSecure\src\dll\PvFw.dll
    0x052b0000 - 0x052dc000      D:\Java Project\PalmSecure\src\dll\F3BC1ENG.DLL
    0x052e0000 - 0x0531f000      D:\Java Project\PalmSecure\src\dll\F3BC4CAP.DLL
    0x05320000 - 0x05344000      D:\Java Project\PalmSecure\src\dll\F3BC4COM.DLL
    0x73dd0000 - 0x73ece000      C:\WINDOWS\system32\MFC42.DLL
    0x05c50000 - 0x05cf7000      D:\Java Project\PalmSecure\src\dll\F3BC4MAT.DLL
    VM Arguments:
    jvm_args: -client -Xmx512m -XX:NewRatio=2 -Dcom.sun.aas.defaultLogFile=D:/Sun/AppServer/domains/domain1/logs/server.log -Djava.endorsed.dirs=D:/Sun/AppServer/lib/endorsed -Djava.security.policy=D:/Sun/AppServer/domains/domain1/config/server.policy -Djava.security.auth.login.config=D:/Sun/AppServer/domains/domain1/config/login.conf -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.rmi.dgc.client.gcInterval=3600000 -Djavax.net.ssl.keyStore=D:/Sun/AppServer/domains/domain1/config/keystore.jks -Djavax.net.ssl.trustStore=D:/Sun/AppServer/domains/domain1/config/cacerts.jks -Djava.ext.dirs=C:/Program Files/Java/jdk1.5.0_07/jre/lib/ext;D:/Sun/AppServer/domains/domain1/lib/ext;D:/Sun/AppServer/javadb/lib -Djdbc.drivers=org.apache.derby.jdbc.ClientDriver -Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder -Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory -Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-impl.jar -Dcom.sun.enterprise.taglisteners=jsf-impl.jar -Dcom.sun.aas.classloader.optionalOverrideableChain=appserv-ws.jar,commons-logging.jar,commons-launcher.jar -Dcom.sun.aas.classloader.appserverChainJars=admin-cli.jar,admin-cli-ee.jar,dbschema.jar,j2ee-svc.jar -Dcom.sun.aas.classloader.serverClassPath.ee=%HADB_HOME%/lib/hadbjdbc4.jar,D:/Sun/AppServer/lib/SUNWjdmk/5.1/lib/jdmkrt.jar,%HADB_HOME%/lib/dbstate.jar,%HADB_HOME%/lib/hadbm.jar,%HADB_HOME%/lib/hadbmgt.jar,D:/Sun/AppServer/lib/SUNWmfwk/lib/mfwk_instrum_tk.jar -Dcom.sun.aas.configName=server-config -Ddomain.name=domain1 -Djmx.invoke.getters=true -Dcom.sun.aas.promptForIdentity=true -Dcom.sun.aas.classloader.optionalOverrideableChain.ee= -Dcom.sun.aas.instanceRoot=D:/Sun/AppServer/domains/domain1 -Dcom.sun.aas.domainName=domain1 -Dcom.sun.aas.classloader.sharedChainJars=javaee.jar,C:/Program Files/Java/jdk1.5.0_07/lib/tools.jar,install/applications/jmsra/imqjmsra.jar,commons-launcher.jar
    java_command: <unknown>
    Launcher Type: generic
    Environment Variables:
    JAVA_HOME=C:\Program Files\Java\jdk1.5.0_07
    CLASSPATH=C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\PROGRA~1\JMF21~1.1E\lib;C:\Program Files\Java\jdk1.5.0_07\jre\lib;.
    PATH=C:/Program Files/Java/jdk1.5.0_07\jre\bin\client;D:\Sun\AppServer\lib;D:\Sun\AppServer\lib;C:\Program Files\Java\jdk1.5.0_07\bin;.;C:\WINDOWS\system32;C:\WINDOWS;D:\Sun\AppServer\lib;D:\Sun\AppServer\bin;D:\Sun\AppServer\lib;D:\Sun\AppServer\bin;C:\Sun\share\lib;C:\Sun\share\bin;C:\PROGRA~1\Java\JDK15~2.0_0\bin;C:\Sun\MessageQueue\lib;C:\Sun\MessageQueue\bin;c:\oracledb\product\10.2.0\db_2\bin;D:\oracle\product\10.2.0\db_1\bin;c:\oracle\ora92\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:\wamp\php;C:\wamp\Apache\GnuWin32\bin;d:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\Java Project\PalmSecure\src\dll;D:\Java Project\PalmSecure\src\Lib;.;D:\Sun\AppServer\bin;;C:\Sun\AppServer;C:\Program Files\Java\jdk1.5.0_07\bin;C:\Program Files\Cvsnt;C:\Program Files\CVSNT\;D:\Java Project\PalmSecure\src\dll;D:\Java Project\PalmSecure\src\Lib;
    USERNAME=subbu.chandrasekaran
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 15 Model 44 Stepping 2, AuthenticAMD
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 1 family 47, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 457904k(42684k free), swap 3464136k(2905608k free)
    vm_info: Java HotSpot(TM) Client VM (1.5.0_07-b03) for windows-x86, built on May 3 2006 01:04:38 by "java_re" with MS VC++ 6.0
    what is the reason for this one....?
    In my case, whenever the user has clicked the Identify button then the native method Identify should be called. That time it's working fine.
    But once the user has clicked the Enroll button, then first the Identify native method should be called, based upon the result, the enroll() native method will be called. I am getting the error whenever i am clicking the Enroll button.
    while clicking the Identify button i didn't get any such error....
    What would be the reason?
    someone pls clear my doubt.
    --Subbu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

    You have a bug in your C code, and are attempting to access memory location 0.
    Look for an unitialized pointer.

  • Why I can't call my native method from my package?

    it is fine if my java code didn't complied into a package.
    But if I complied my java code as a package, and call its native method outside. It give me "UnsatisfiedLinkError". And can not find my method. It is indeed the method is inside.
    Thank a lot any helps. Email me on [email protected]

    I have found that javah does not generate the correct JNI function names when the native function is in a class that is within a Java package. The net result is an Unsatisfied link error.
    The JNI function name must be included in the package name. The naming is a bit complicated and that's why javah should be used, except in this case it does not work. I can't quite remember exactly how it works, something like adding in packagename_1 into the JNI name. The SWIG tool (http://www.swig.org) does generate the correct names when using packages. It is a tool which takes C or C++ header files and generates the JNI and Java classes for you so that you can call C/C++ code from Java. Once you have installed SWIG and run 'make check', have a look in the directory Examples/test-suite/java for the JNI naming for packages. I'll try remember to post the exact naming if you don't want to install SWIG.

  • Unable to call exported client methods of EJB session bean remote interface

    I am unable to call client methods of a BC4J application module deployed as a Session EJB to Oracle 8i at the client side of my multi-tier application. There is no documentation, and I am unable to understand how I should do it.
    A business components project has been created. For instance, its application module is called BestdataModule. A few custom methods have been added to BestdataModuleImpl.java file, for instance:
    public void doNothingNoArgs() {
    public void doNothingOneArg(String astr) {
    public void setCertificate(String userName, String userPassword) {
    theCertificate = new Certificate(userName, userPassword);
    public String getPermission() {
    if (theCertificate != null)
    {if (theCertificate.getPermission())
    {return("Yes");
    else return("No, expired");
    else return("No, absent");
    theCertificate being a protected class variable and Certificate being a class, etc.
    The application module has been tested in the local mode, made remotable to be deployed as EJB session bean, methods to appear at the client side have been selected. The application module has been successfully deployed to Oracle 8.1.7 and tested in the remote mode. A custom library containing BestdataModuleEJBClient.jar and BestDataCommonEJB.jar has been created.
    Then I try to create a client basing on Example Oracle8i/EJB Client snippet:
    package bestclients;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.naming.*;
    import oracle.aurora.jndi.sess_iiop.*;
    import oracle.jbo.*;
    import oracle.jbo.client.remote.ejb.*;
    import oracle.jbo.common.remote.*;
    import oracle.jbo.common.remote.ejb.*;
    import oracle.jdeveloper.html.*;
    import bestdata.client.ejb.*;
    import bestdata.common.ejb.*;
    import bestdata.common.*;
    import bestdata.client.ejb.BestdataModuleEJBClient;
    public class BestClients extends Object {
    static Hashtable env = new Hashtable(10);
    public static void main(String[] args) {
    String ejbUrl = "sess_iiop://localhost:2481:ORCL/test/TESTER/ejb/bestdata.BestdataModule";
    String username = "TESTER";
    String password = "TESTER";
    Hashtable environment = new Hashtable();
    environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    environment.put(Context.SECURITY_PRINCIPAL, username);
    environment.put(Context.SECURITY_CREDENTIALS, password);
    environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    BestdataModuleHome homeInterface = null;
    try {
    Context ic = new InitialContext(environment);
    homeInterface = (BestdataModuleHome)ic.lookup(ejbUrl);
    catch (ActivationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (CommunicationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (NamingException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    try {
    System.out.println("Creating a new EJB instance");
    RemoteBestdataModule remoteInterface = homeInterface.create();
    // Method calls go here!
    // e.g.
    // System.out.println(remoteInterface.foo());
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    It doesnt cause any errors. However, how must I call methods? The public interface RemoteBestdataModule has no such methods:
    void doNothingNoArgs();
    void doNothingOneArg(java.lang.String astr);
    void setCertificate(java.lang.String userName, java.lang.String userPassword);
    java.lang.String getPermission();
    Instead of that it has the following methods:
    oracle.jbo.common.remote.PiggybackReturn doNothingNoArgs(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn doNothingOneArg(byte[] _pb, java.lang.String astr) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn customQueryExec(byte[] _pb, java.lang.String aQuery) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn setCertificate(byte[] _pb, java.lang.String userName, java.lang.String userPassword) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn getPermission(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    I cannot call those methods. I can see how they are called in BestdataModuleEJBClient.java file:
    public void doNothingNoArgs() throws oracle.jbo.JboException {
    try {
    oracle.jbo.common.remote.PiggybackReturn _pbRet = mRemoteAM.doNothingNoArgs(getPiggyback());
    processPiggyback(_pbRet.mPiggyback);
    if (_pbRet.isReturnStreamValid()) {
    return;
    catch (oracle.jbo.common.remote.ejb.RemoteJboException ex) {
    processRemoteJboException(ex);
    catch (java.rmi.RemoteException ex) {
    processRemoteJboException(ex);
    throw new oracle.jbo.JboException("Marshall error");
    However, I cannot call getPiggyback() function! It is a protected method, it is available to the class BestdataModuleEJBClient which extends EJBApplicationModuleImpl, but it is unavailable to my class BestClients which extends Object and is intended to extend oracle.jdeveloper.html.WebBeanImpl!
    It seems to me that I mustnt use RemoteBestdataModule interface directly. Instead of that I must use the public class BestdataModuleEJBClient that extends EJBApplicationModuleImpl and implements BestdataModule interface. It contains all methods required without additional arguments (see just above). However, how must I create an object of BestdataModuleEJBClient class? That is a puzzle. Besides my custom methods the class has only two methods:
    protected bestdata.common.ejb.RemoteBestdataModule mRemoteAM;
    /*This is the default constructor (do not remove)*/
    public BestdataModuleEJBClient(RemoteApplicationModule remoteAM) {
    super(remoteAM);
    mRemoteAM = (bestdata.common.ejb.RemoteBestdataModule)remoteAM;
    public bestdata.common.ejb.RemoteBestdataModule getRemoteBestdataModule() {
    return mRemoteAM;
    It looks like the remote application module must already exist! In despair I tried to put down something of the kind at the client side:
    RemoteBestdataModule remoteInterface = homeInterface.create();
    BestdataModuleEJBClient dm = new BestdataModuleEJBClient(remoteInterface);
    dm.doNothingNoArgs();
    Of course, it results in an error.
    System Output: null
    System Error: java.lang.NullPointerException
    System Error: oracle.jbo.common.PiggybackOutput oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyForRemovedObjects(oracle.jbo.common.PiggybackOutput) (ApplicationModuleImpl.java:3017)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyfront(boolea
    System Error: n) (ApplicationModuleImpl.java:3059)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyback() (ApplicationModuleImpl.java:3195)
    System Error: void bestdata.client.ejb.BestdataModuleEJBClient.doNothingNoArgs() (BestdataModuleEJBClient.java:33)
    System Error: void bes
    System Error: tclients.BestClients.main(java.lang.String[]) (BestClients.java:76)
    I have studied a lot of documents in vain. I have found only various senseless discourses:
    "Use the Application Module Wizard to make the Application Module remotable and export the method. This will generate an interface for HrAppmodule (HrAppmodule.java in the Common package) which contains the signature for the exported method promoteAllEmps(). Then, deploy the Application Module. Once the Application Module has been deployed, you can use the promoteAllEmps() method in your client-side programs. Calls to the promoteAllEmps() method in client-side programs will result in calls to the promote() method in the application tier."
    However, I have failed to find a single line of code explaining how it should be called.
    Can anybody help me?
    Best regards,
    Svyatoslav Konovaltsev,
    [email protected]
    null

    Dear Steven,
    1. Thank you very much. It seems to me that the problem is solved.
    2. "I logged into Metalink but it wants me to put in both a tar number and a country name to see your issue." It was the United Kingdom, neither the US nor Russia if you mean my issue.
    I reproduce the text to be written by everyone who encounters the same problem:
    package bestclients;
    import java.util.Hashtable;
    import javax.naming.*;
    import oracle.jbo.*;
    public class BestdataHelper {
    public static ApplicationModule createEJB()
    throws ApplicationModuleCreateException {
    ApplicationModule applicationModule = null;
    try {
    Hashtable environment = new Hashtable(8);
    environment.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    environment.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_EJB);
    environment.put(Context.SECURITY_PRINCIPAL, "TESTER");
    environment.put(Context.SECURITY_CREDENTIALS, "TESTER");
    environment.put(JboContext.HOST_NAME, "localhost");
    environment.put(JboContext.CONNECTION_PORT, new Integer("2481"));
    environment.put(JboContext.ORACLE_SID, "ORCL");
    environment.put(JboContext.APPLICATION_PATH, "/test/TESTER/ejb");
    Context ic = new InitialContext(environment);
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup("bestdata.BestdataModule");
    applicationModule = home.create();
    applicationModule.getTransaction().connect("jdbc:oracle:kprb:@");
    applicationModule.setSyncMode(ApplicationModule.SYNC_IMMEDIATE);
    catch (NamingException namingException) {
    throw new ApplicationModuleCreateException(namingException);
    return applicationModule;
    package bestclients;
    import bestdata.common.*;
    import certificate.*;
    public class BestClients extends Object {
    public static void main(String[] args) {
    BestdataModule bestdataModule = (BestdataModule)BestdataHelper.createEJB();
    Certificate aCertificate = new Certificate("TESTER", "TESTER");
    //calling a custom method!!
    bestdataModule.passCertificate(aCertificate);
    Thank you very much,
    Best regards,
    Svyatoslav Konovaltsev.
    [email protected]
    null

  • JNI Calls to Native Methods No Longer Work: Possible Versioning Issue ?

    Hello, all. Just a quick question... is it possible that invoking a method in a JNI-compliant DLL from Java 6 will fail if the DLL's source was compiled against the JNI header files from Java 4 or 5 ? I have a DLL with methods that used to be called successfully (and now fail outright and don't even seem to be getting inside the native method), but it seems that the only thing that could have changed in the environment is the installed JRE. Even stranger, I don't get the hs_err* files anymore to indicate that the JVM crashed. Does anyone know why this might happen ? Thanks !

    Cthulhu76 wrote:
    Hello, all. Just a quick question... is it possible that invoking a method in a JNI-compliant DLL from Java 6 will fail if the DLL's source was compiled against the JNI header files from Java 4 or 5 ? Solely? No.
    You could of course be doing something in the JNI code in terms of working with Java which no longer works. Just as it is at least possible that java code from one version might not work with another.
    Correct error checking in the JNI code would at least correctly identify this problem however.
    I have a DLL with methods that used to be called successfully (and now fail outright and don't even seem to be getting inside the native method), but it seems that the only thing that could have changed in the environment is the installed JRE.The only thing that you assume changed was the JRE.
    You seem unsure whether the JNI is being called at all, so verifying that first would be a good idea.

  • Calling multiple DLL from Java and calling same native method

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java Application
    But the problem is that , whenever i try to call the Notify Method , it calls the Notify method of DLL_1 only.
    How do i call the Notify Methos of second DLL(i.e DLL_2).
    Is there any reference that i can get to all the DLL files when i load then , so that i can use that reference to invoke the Notify method of that particular DLL.

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a
    signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java
    Application
    But the problem is that , whenever i try to call the
    Notify Method , it calls the Notify method of DLL_1
    only.
    How do i call the Notify Methos of second DLL(i.e
    DLL_2).
    Is there any reference that i can get to all the DLL
    files when i load then , so that i can use that
    reference to invoke the Notify method of that
    particular DLL.You need to explain exactly what you are trying to achieve.
    As per the description above it is impossible in java.
    And I didn't say JNI, I said java.
    Your above statement suggests that you think that you can have exactly the same java signature do two different things.
    Note again that I said java not JNI.
    A JNI method is just a tag that represents a java signature. Your description suggests that you are attempting to do it twice.
    There are three possibilities.
    1. Your explanation is incomplete.
    2. You are trying to do something that is impossible in java.
    3. You are trying to solve a problem and your description of your solution is not sufficient to determine what that is (and of course the solution is wrong.)

  • Unable to call Java class method within Embedding Java Activity in BPEL

    Hi ,
    I have written Java Class named 'Class3' .
    When I am creating and trying to call these classes whithin Embedding Java Activity , compile time error is coming. Compiler is not finding class . Error message is like this one.
    uildfile: C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml
    scac:
    [scac] Validating composite : 'C:\JDeveloper\mywork\Application7\Embedded15\composite.xml'
    [scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
    [scac] symbol : class Class3
    [scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
    [scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
    [scac] symbol : class Class3
    [scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
    [scac] Note: C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\BPEL_BIN.java uses unchecked or unsafe operations.
    [scac] Note: Recompile with -Xlint:unchecked for details.
    [scac] FATAL_ERROR: location {ns:composite/ns:component[@name='BPELEmbedded15']}(20,36): Failed to compile bpel generated classes.
    [scac] failure to compile the generated BPEL classes for BPEL process "BPELEmbedded15" of composite "default/Embedded15!1.0"
    [scac] The class path setting is incorrect.
    [scac] Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.
    [scac]
    BUILD FAILED
    C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml:264: Java returned: 1 Check log file : C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\classes\scac.log for errors
    Total time: 8 seconds
    I am creating Class3 directly in Application Resources folder indide Project Folder in Jdeveloper without creating any package. Code of the class is .......
    public class Class3 {
    public Class3() {
    super();
    public String getValue(){
    return "BBBBBBB";
    Can any one help?
    Regards
    Yogendra Rishishwar
    9867927087

    Hi ,
    In your java project frm jdev..right click and choose general and then choose deployment profiles and then choose Jar ..and then give some appropriate name(abc) and then click ok.
    Then under resources file u get a abc.deploy file right click and say deploy to jar ..u will find the jar in that director.Now include this jar in your prjct libraries.
    have a look at the link http://niallcblogs.blogspot.com/search/label/embedded%20Java

  • A way to set a flag in java layer when native method has been called?

    Hi,
    I'm calling a native method from the java layer through to a native c function. Is there a way I can set a flag in the java layer when this native method has been called?
    Thanks!

    1. Create a wrapper method. The wrapper method is the only exposed method. It calls the native method. It sets the flag.
    2. Set the flag in the native method itself.
    3. You might be able to use the debugging API to do this however it is going to require quite a bit of work. And it injects itself at runtime.
    Is there a reason for this request? There might be other solutions if a general problem was posed.

  • Calling native methods in a package

    Hi!
    We have a problem when calling native methods in a class which is in a package. As you can see from the code below we have a class making an instance of a class<testBando> which makes a instance of another class<Bando> which contains the native methods. When running the program we get the error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: initialize
    at test2.Bando.initialize(Native Method)
    at test.testBando.<init>(testBando.java:10)
    at Main.main(Main.java:5)
    When we take the class that calls the native methods out of any package every thing works fine! Can you not call native methods inside a package or what are we doing wrong?
    // testBando.java
    package test;
    import test2.*;
    public class testBando {
    Bando b;
    public testBando() {
         b = new Bando();
         b.initialize();
    // Bando.java
    package test2;
    public class Bando {
    public native void initialize();
    static {
         System.loadLibrary("bando");
    // Main.java
    import test.*;
    public class Main {
    public static void main(String[] args) {
         new testBando();

    I suspect that your problem is that you have not
    regenerated the signature when you placed the native
    method's object in a package. Or same result but different sourc:
    -package name was changed and it wasn't regen'd
    -javah was run incorrectly (which gens the signatures with no package name.)

  • Accessing a native method from within a packaged class

    I have seen some very useful information from RPaul. However, I can not quite get it to work.
    I have a class "JNIGetUserId" that is in a package "com.services.localoptions". I am trying to call a native method from a dll. it works fine at the default package level. But not in the package. I have tried adding the "_" between each level of the directory in the h and c++ files. I also found that doing a javah at the top of the package structure it includes some information in the h file. A "_0005" shows up between each level.
    This is on Windows XP. I am also using VisualAge for Java. I also am using JDK 1.3.1.
    The source files:
    package com.services.localoptions;
    * This class provides the JNI Interface to call the
    * AD User Maintainence routines.
    * These routines are stored in the JNIGetUserIdLibrary.dll.
    * The routines are:
    * <ul>
    * <li>getUser - returns a string containing the User Id
    * <eul>
    * @author: Ray Rowehl
    * @date (10/15/2003 10:30:59 AM)
    public class JNIGetUserId
         // Load the library
         static
         try
              System.out.println("loading dll");
         System.loadLibrary("JNIGetUserIdLibrary");
         System.out.println("loaded dll");
         catch (UnsatisfiedLinkError ue)
              System.out.println("Link Error");
    * native C++ method to call getUserId routine
    public native String getUser() throws Exception;
    * This method allows us to test standalone..
    * Creation date: (10/16/2003 2:08:58 PM)
    * @param args java.lang.String[]
    public static void main(String[] args)
         try
              System.out.println("Trying method 3");
              JNIGetUserId lGUD = new JNIGetUserId();
              System.out.println(lGUD.getUser());
         catch (Exception e)
              System.out.println("Got an exception " + e);
              e.printStackTrace();
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class JNIGetUserId */
    #ifndef IncludedJNIGetUserId
    #define IncludedJNIGetUserId
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: JNIGetUserId
    * Method: getUser
    * Signature: ()Ljava/lang/String;
    JNIEXPORT jstring JNICALL Java_com_localoptions_JNIGetUserId_getUser
    (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif
    // Implements method to return a string to Java
    // C++ core header
    #include <iostream.h>
    // header from Java Interface
    #include "JNIGetUserId.h"
    #include "JNIGetUserId2.h"
    // returns a string back to Java for package structure
    JNIEXPORT jstring JNICALL Java_com_services_localoptions_JNIGetUserId_getUser
    ( JNIEnv * env, jobject thisObject )
         // set up constant user id for testing return
         char* userid = "RROWEHLP";
         // return userid to caller
         return env->NewStringUTF( userid );     
    // returns a string back to Java for flat structure
    JNIEXPORT jstring JNICALL Java_JNIGetUserId_getUser
    ( JNIEnv * env1, jobject thisObject1 )
         // set up constant user id for testing return
         char* userid1 = "RROWEHL1";
         // return userid to caller
         return env1->NewStringUTF( userid1 );     
    }

    Ok. A co-worker figured it out for me. The key thing is to do "javah com.services.localoptions.JNIGetUserId". Note the use of "." instead of "\". Running on windows, I was used to doing "\". That was part of the problem. Another key is doing the javah at the top of the package structure. This was mentioned in a post over at IBM.
    We got our JNI stuff working now. thanks, ray.

  • Calling a native library from Java

    Hello,
    I'm trying to call a native method (windows dll) from a web service implemented in Java. I've confirmed that the class I've created to call the native method works when used outside of my web service (ie. in a standard Java application). However, when I try to use the class in the web service, an exception is thrown when
    System.loadLibrary("MyLibrary");
    is executed. The exception thrown is:
    InvocationTargetException
    JAXRPCSERVLET28: Missing port information
    Does any one have any suggestions as to what might be causing this error?
    Thanks

    There are basically 3 steps to calling a native method from your Java code.
    1. Create a C/C++ stub function that will translate between your Java call and the native C method.
    2. Create the dll that exports the stub function.
    3. Invoke the System.loadLibrary("myDllName") method.
    Here's what I did to learn how to use the JNI.
    I first created the class that would be calling the dll:
    public class CallDll
    /** Creates a new instance of CallDll */
    public CallDll()
    static
    //LVtoJava is my dll name.
    System.loadLibrary("LVtoJava");
    //AddDll is the name of the function I'm exporting from my Dll
    //It does not have to be static
    public native static double AddDll(int func, double x, double y);
    I then used the javah utility in the jdk/bin directory to create the C stub header file. Once you have the generated stub header file, you can create an implementation file, and compile it into a dll.
    //My C++ stub, generated by javah utility
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class LabViewDll_CallDll */
    #ifndef IncludedLabViewDll_CallDll
    #define IncludedLabViewDll_CallDll
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: LabViewDll_CallDll
    * Method: AddDll
    * Signature: (IDD)D
    JNIEXPORT jdouble JNICALL Java_LabViewDll_CallDll_AddDll
    (JNIEnv *, jclass, jint, jdouble, jdouble);
    #ifdef __cplusplus
    #endif
    #endif
    You may want to note the stub function's signature and how it decorates the function name that you created from your Java class. Do not modify it, as the format is required by the JNI. The javah utility appends the fully qualified package name and the word Java, separated by underscores, to your original function name. You do not need to change the name in your Java class.
    All the other special key words in the function's signature are defined in the jni.h or the jni_md.h (if your using windows).
    You may want to refer to the JNI documention on Sun's website. The book I learned out of is the Core Java Volume 2, published by Sun Microsystems Press. It goes through the details of invoking your first native function and I've found it to be a good reference.
    Hope this helps,
    PS. I seemed to have found the issue with calling my dll from a web service. My dll is actually calling another dll and that seems to be the source of my problems. When I removed the call to the 2nd dll, everything worked fine. So now I need to figure out why the 2nd dll call is an issue.
    Any suggestions?

  • Errors in compiling native method

    I am trying to call a native method from a java source program. I generated header file by javah and wrote c file for native method implementation. I work on RedHat Linux-7.2.
    Java file for native method:-
    class HelloNative
    {  public static native void greeting();
    static
    {  System.loadLibrary("HelloNative");
    Java file for calling native method(main java file):-
    class HelloNativeTest
    {  public static void main(String[] args)
    {  HelloNative.greeting();
    C file implementing native method:-
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_HelloNative_greeting
    (JNIEnv* env, jclass cl)
    {  printf("Hello world!\n");
         I am using following command for compiling c source file:-
    cc -G -I/usr/java/jdk1.3.1/include -I/usr/java/jdk1.3.1/include/linux HelloNative.c -o HelloNative.so
    It gave me followig errors on compiling:-
    cc: unrecognized option `-G'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
    collect2: ld returned 1 exit status.

    Looks to me like you're not telling the linker to create a library (DLL). I'm not familiar with Linux, but clearly if the linker if looking for 'main' then its trying to build an executable.

  • Stuck Inside Native Method

    I have developed some Java code to call a third party DLL using JNI. Most of the time everything works as expected, but once in a while (generally after several days of processing) my program hangs. The root cause appears to be related to an intermittent issue with the driver that I am calling, something that I have no control over. When I perform a thread dump I can see that the thread is "stuck" inside the native method that I am calling. I am able to detect the hangup using a timer, and even obtain the "stuck" thread, but I cannot kick it back into life...or kill it in any way. Does anyone have any ideas?
    My code that is calling the native method is as follows:
    public void process() {
        System.out.println("Hello world from Java");
        Timer timer = new Timer();
        timer.schedule(new MyTimerTask(), 1000);
        myNativeMethod();
        System.out.println("Goodbye world from Java");
    }And the code for my timer task is as follows:
    public class MyTimerTask extends TimerTask {
        @Override
        public void run() {
            System.out.println("Timeout");
            ThreadGroup tg = Thread.currentThread().getThreadGroup();
            Thread[] list = new Thread[tg.activeCount()];
            tg.enumerate(list);
            for (Thread t : list) {
                System.out.println(t);
                System.out.println("---------------------------------------");
                StackTraceElement[] st = t.getStackTrace();
                for (StackTraceElement ste : st) {
                    System.out.println(ste);
                    if (ste.getMethodName().equals("myNativeMethod") && ste.isNativeMethod()) {
                        System.out.println("stuck thread " + t.getName() + " detected!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                        t.interrupt();
                        break;
    }

    StuartyBoarder wrote:
    a) As it's a server I must use a separate process to communicate with a DDL because that's the only way to communicate with a DLL inside the serverNo
    b) As it's a server I must use a separate process to communicate with a DLL if I want to be able to kill a stuck process
    Absolutely.
    I am assuming that you mean b), which is not really an option A process is a process. Doesn't matter what it runs.
    An advantage that hasn't been mentioned in terms of a separate process is that if the dll has a system exception it will cause the process to exit. And there is no way to stop that. If that process is your JBoss server then it will exit. Which probably isn't what you want.
    As a separate process if if exits all you need to is detect that (via correct usage of Process) and then just start it up again.

  • Problem in running a web service having Native Method invocation

    Hi guys,
    i am trying a run web service, that is calling some Native Method
    The arguement for the operation is a byte[] and the return type is boolean.
    The web service type i am using is "Documentary-Literal"
    Actually what happend is, whenever i am calling the web service, i didn't get any error or exception, but i didn't get any output too.
    if the code inside the operation is executed properly then, operation should return FALSE, but now it is returning TRUE.
    What may be the problem?
    someone help me..........
    thanx,
    subbu

    Hi guys,
    i am trying a run web service, that is calling some Native Method
    The arguement for the operation is a byte[] and the return type is boolean.
    The web service type i am using is "Documentary-Literal"
    Actually what happend is, whenever i am calling the web service, i didn't get any error or exception, but i didn't get any output too.
    if the code inside the operation is executed properly then, operation should return FALSE, but now it is returning TRUE.
    What may be the problem?
    someone help me..........
    thanx,
    subbu

  • Problem with OSB 11g - Unable to call non-static java methods

    I have a problem in OSB. Unable to see any java methods when loading java callout. I have checked the java classes in the .jar file and they are all non-static java methods.
    Is there any way where OSB is able to see this non-static java methods?
    Need help urgently!
    Thanks!

    Technical standpoint: Do you know why OSB is not able to call non-static methods?
    This is by design. Ability to call non-static methods require Object creation which adds additional complexity. eg How to pass variables in constructor?. How/where to store created object for use across across pipeline instance?. Object life cycle (when and how to create object) etc. To avoid above complexites static methods are only supported.
    "a lot of non-static method to call" just for my understanding what are the number involved?. If number is too high you can always request for a enhancement.
    Thanks
    Manoj

Maybe you are looking for

  • SFTP Dynamic Filename Configuration Issue

    Hi Experts, I am using SFTP adapter which is provided by SAP as a add-ons, and I have configured FTP to SFTP (Without IR). I have done all the nessary setups in ASMA properties as well , also I have maintained the filename as " * "  in channel adapte

  • Muse to Dreamweaver?

    Can I build my business web site in Muse and import it into my CS3 Dreamweaver to edit and update it?  I want to be able to update it and edit it without having to pay a new subscription everytime I want to change it. 

  • IPhoto is loading very slowly and very unresponsive

    I am running a 24" iMac with 2.16 Ghz Intel Core 2 Duo with 1 GB SDRAM. I recently upgraded to iPhoto 11 and really enjoy some of the new features, but it is running terribly slowly.  I have about 19,000 photos and very few videos, is that too many? 

  • New RAM made me lose my Bluetooth mouse

    Hey all, I recently installed 2GB worth of G.Skill RAM into my blackbook. It was a great upgrade, but I've had really spotty use of my Bluetooth mouse as a result. Sometimes it will not connect at all and other times it will work for a few minutes an

  • Looking for WiFi.

    Hi. I've searched the board and haven't found an answer to my issue, so please forgive me if this has been asked before. I have an 8330, Verizon is my carrier and I have an unlimited data plan. The wireless coverage in my home is virtually non-existe