Results 1 to 1 of 1
- 11-26-2007, 11:42 PM #1Member
- Join Date
- Nov 2007
- Rep Power
JNI - No System.out for ExceptionDescribe
- Operating System: Win2k3
- Java SDK: 1.5.0_11
- JNI: JNI_VERSION_1_4
- The code is a C++/Java plugin to a third-party process that is running as a Windows Service.
The plugin is design to handle requests from the third-party process and return a response. The interface to the third-party process is a C++ base class. The plug-in works by receiving a request, passing the request to the Java code in the plug-in using JNI. The Java code passes on the request to another Windows Service for processing. The Java code passes the response of the other Windows Service back to the C++ code in the plugin as the results of the JNI method call. The C++ uses the reponse to formulate a response to the third-party process using a callback object.
This configuration of third-party process -- C++/JNI/Java Plug-In -- other process has worked under load in the past. Recently, I added logging in the plug-in in the Java code and the C++ code accesses logging using JNI. Now, the configuration runs successfully for several requests, and then on the next request each JNI call fails. An Exception is passed back to the C++ code from the JNI when each error occurs is unreadable. In other words, it appears to have no exception message or exception class type associated with it.
Using the JNI ExceptionDescribe() method is not working. ExceptionDescribe() only writes to System.out (or System.err) but because the code is running as a plug-in to a Windows Service, all System.out messages are sent to the equivalent of /dev/null (the proverbial bit bucket).
How can I obtain information about the error that is occurring?
I have tried redirecting both System.out and System.err to files using System.setOut() and System.setErr(). This works fine for the Java classes in the plug-in but JNI is not using the redirected streams. I have also tried closing System.out and System.err before redirecting them to new file output streams.
I have also added code to call the JNI ExceptionClear() before each JNI call it insure that there are no exceptions pending when a JNI call is made.
I have even tried JNI version JNI_VERSION_1_2.
- By Java Tip in forum Java TipReplies: 0Last Post: 11-19-2007, 06:00 PM
- By nitinborge5 in forum New To JavaReplies: 1Last Post: 08-07-2007, 10:25 AM
- By osval in forum Advanced JavaReplies: 2Last Post: 08-06-2007, 04:54 AM
- By ai_2007 in forum Advanced JavaReplies: 1Last Post: 06-29-2007, 04:16 PM