Results 1 to 1 of 1
- 12-03-2008, 02:58 AM #1Member
- Join Date
- Dec 2008
- Rep Power
intermittent error in JNI_CreateJavaVM
I have a C++ a class that is using JNI Invocation mechanism to create a JVM and call methods in a java application. I am using IBM Java 1.4.2 version with the Visual Age C++ 9.0 compiler and running the application in Windows XP.
We had the JVM created using the main application thread at the very beginning when the application initializes. We also invoked the JNI method once at the application initialization so that it will load all the Java DLLs, needed Java classes to run the method into memory. When a button is clicked on the UI (from different threads) this JNI method gets invoked. Therefore we had to use attachcurrentthread prior to invoking the method and detachcurrentthread after invoking the method.
Everything worked fine.
But then we had to move the JVM creation/initial invocation of the JNI method to a different thread. This thread gets spawned by the main application thread and it will keep running till the application terminates. But now we are seeing an intermittent problem that sometime JVM is failing to get created (return with -1). Or sometimes the JVM gets created successfully but when the Java method get invokes it fails with link error or class not found error.
We have close to 2500 machines running with this code, but whenever the application starts up only about 30 machines fails with the error and it is occurring randomly.
Here is the error that Java is throwing for the cases where it is able to create the JVM but still unable to invoke the method.
Caused by: java.lang.UnsatisfiedLinkError: C:\Program Files\IBM\WebSphere\AppClient\java\jre\bin\nio.dll : The segment is already unlocked
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.jav a:2144)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java :2004)
at sun.security.action.LoadLibraryAction.run(LoadLibr aryAction.java:76)
at java.security.AccessController.doPrivileged1(Nativ e Method)
at java.security.AccessController.doPrivileged(Access Controller.java:287)
at sun.nio.ch.WindowsSelectorImpl.<clinit>(WindowsSel ectorImpl.java:73)
at sun.nio.ch.WindowsSelectorProvider.openSelector(Wi ndowsSelectorProvider.java:52)
Has anyone ever seen a similar error. I googled and search lot of web sites but could not find anything related to this spefic problem.
So any help is greatly appreciated.
- By cheongww in forum NetworkingReplies: 4Last Post: 10-02-2008, 06:32 PM
- By rgale in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 05-12-2008, 04:28 PM