Env- NewStringUTF confusion...
Hello,
I have a dll (that is calling another dll) that I am calling from my Java application.
I'm a little green with C++ so please excuse my ignorance...
The problem I am having is that env->NewStringUTF() seems to be only returning the first character in the char* I am passing it.
See code below. Any help would be appreciated emensly.
* Class: com_mypackage_Thing1
* Method: getLotsOfXML
* Signature: ()Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_com_mypackage_Thing1_getLotsOfXML
(JNIEnv *env, jclass c) {
jstring result;
TCHAR* pszResult = NULL;
TCHAR str[] = _T("127.0.0.1");
Thing2 Thinggy2(false);
Thinggy2.GetLotsOfXML(str, &pszResult);
if (pszResult != NULL) {
_tprintf(_T("\t\t***Lots of XML From Thing2***\n%s\n\n"), pszResult);
fflush(stdout);
result = env->NewStringUTF((char*)pszResult);
return result;
}
The problem seems to be with TCHAR.
even this returns only one char to the Java code:
<code>
TCHAR buf[] = _T("Test");
return env-NewStringUTF((char*)buf);
</code>
I get the same result with this:
<code>
TCHAR buf[] = _T("Test");
return env-NewStringUTF((char*)&buf);
</code>
This just crashes:
<code>
TCHAR buf[] = _T("Test");
return env-NewStringUTF((char*)*buf);
</code>
A printf will put the whole string to stdout so I know the whole thing is in the buf variable:
<code>
TCHAR buf[] = _T("Test");
tprintf(T("\t\tResult\n%s\n\n", buf);
return env-NewStringUTF((char*)buf);
</code>
Similar Messages
-
Env variable confusion - newbie install
Hello,
I have completed the installation sequence for db 10g (10.2.0.1) on RHEL 4.3 (x86_64). I am somewhat confused by this installation procedure wrt env. variables such as ORACLE_HOME, ORACLE_SID, ORACLE_BASE, etc.
The pre-installation guidelines are clear in saying that .bash_profile (in this case) for user 'oracle' should NOT set these variables prior to installation:
8. If the ORACLE_SID, ORACLE_HOME, or ORACLE_BASE environment variable is set
in the file, then remove the corresponding lines from the file. (Preinstallation Tasks 2-41)
User 'oracle's .bash_profile does not get updated during installation; subsequent login as 'oracle' shows that the env. variables are not set via other means. Is there a post-installation step I'm missing?
Thank you again,
Scottoraenv uses the ORACLE_SID to set the ORACLE_HOME and PATH - including making sure the ORACLE_HOME/bin is unique in the PATH
But ... unless there is a database instance involved, ORACLE_SID is meaningless. It really does not have meaning until dbca is used to create a database, or the manual counterpart to dbca is invoked and oratab is updated.
I have found there is a Catch-22 related to the oratab/oraenv which seems to have caused oraenv to be undervalued.
However, due to the possibility of several ORACLE_HOMEs and several databases, since Oracle7 I have used the following sequence in my .profile
export PATH=$PATH:/usr/local/bin # if not already done
export ORAENV_ASK=NO
ORACLE_SID=orcl
. orenv
export ORAENV_ASK=
and then I am able to source /usr/local/bin/oraenv on demand to set te SID, HOME and PATH for any database.
It's so useful, I add entries for each ORACLE_HOME into the oratab, regardless of whether it represents a database or not. For example, I will have entries for GridAgent, OMS, and so on.
I can not explain why the oraenv is not better discussed in the documentation. It misses a major 'feature'. -
Use of NewString and NewStringUTF to create a jstring
Hi, I try to use NewString() and NewStringUTF() to create a jstring to pass to SetObjectField().
I see that these 2 methods don't creany anything!
C++ code
jstring jstr1=env->NewStringUTF("my test");
if (!jstr1) printf("Warning ERROR\n");
printf("value of jstr1 is %s\n",,jstr1);
env->SetObjectField(ilContatore,fid1,jstr1);
when arrive at SetObjectField invocation, there is an error:
# HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Error ID: 4F533F57494E13120E43505002D4
abnormal program termination
I see that the jstr1 have a NULL value, but I assign it!!!
Is there anyone knowing why it's goes on?
Thanks!!If jstr1 is really NULL, then your program will crash when you attempt to printf its value just before the call to SetObjectField. In other words, printf is crashing, not SetObjectField.
You have to find out why the call to env->NewStringUTF is returning NULL. If it returns NULL, you can't use the return value in any other JNI calls.
Do other calls to env functions work properly? Perhaps your initialization is incorrect. -
Returning array of char with NewStringUTF
�Can anybody tell me how NewStringUTF creates a java string from an array of characters? �It stops when he founds a null character on the array or not? I dont want return the whole array but only the first significants characters.
Thanks in advance.!!PLEASE HELP!!
NewStringUtf returns more characters than expected
#define MAX_RCV_BUF 1920
char sendbuf,rcvbuf;
char devuelve[1920];
rcvbuf = (char *)tpalloc("X_OCTET", NULL, MAX_RCV_BUF)
/** (Im working with Tuxedo API)
memset(rcvbuf,'\0',MAX_RCV_BUF);
/**/I initialize the string to nulls so i thik i dont need put a null character later but...
strncpy(devuelve,rcvbuf,lRcvLen);
devuelve[lRcvLen]='\0';
tpfree(rcvbuf);
return (*env)->NewStringUTF(env,devuelve);
/** So NewStringUTF should return lRcvLen characters but, but it returns more!!! -
Hi evreyone,
I have a simple question :
I want to create a jstring with NewStringUTF, and pass it to a java method that takes a sting in parameter. Here's my code :
char c = 'a';
jstring j = (env)->NewStringUTF((const char*)c);
I get an error ! Can anyone tell me how to solve the problem ?
Thanks a lot.I get an error ! Can anyone tell me how to solve the
problem ?I would STRONGLY suggest that you look for a C tutorial and go through it before you try to do JNI.
Your error is simple. You have char. And you are trying to convert it via a cast into a pointer. That particular expression can be made to compile in C. However there is absolutely no way that that expression is what you want to do - so getting it to compile is pointless.
A c string looks like....
char const* s = "a";
The question itself demonstrates a severe lack of C knowledge. And that lack means that it will be almost impossible to figure out the inevitable pointer problems in your C code. Which is why I suggest looking into learning C, by itself, first. -
Parsing documents in Java called via JNI
My native application is in C running on WinXP, and I am attempting to call an API in Java using JNI. I am quite a JNI newbie so hopefully someone can shed some light on my issue. Everytime I attempt to parse a document in Java using:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true); // also tried false
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(this);
Document document = builder.parse(new File(filename));I get an IncompatibleClassChangeError exception thrown. This happens when I parse XML, text, you name it. The Java code works fine outside of JNI. The C source snippet (minus the exception checking) looks like the following:
testClass = (*env)->FindClass(env, "TestClass");
testMethod = (*env)->GetMethodID(env, testClass, "test", "(Ljava/lang/String;)I");
filename = (*env)->NewStringUTF(env, "test.xml");
value = (*env)->CallIntMethod(env, testClass, testMethod, filename); Any suggestions would be very much appreciated.I believe I have found the problem, and it's (of course) an exercise in double-checking everything. It also makes me want to slay my predecessors for their confusing design choices.
The class JNIMessage isn't in the class hierarchy of Message, though it appears to be if you're not inspecting the code closely enough. This is almost certainly the problem. I was looking in the wrong place; the JNI code is probably not suspect here. -
AttachCurrentThread fails when several VMs running in different threads
Hi,
I would like to build an application that runs several JVMs in parallel. I'm using Java6 and according to the JNI specs this should be possible as long as each VM instance is running in a separate thread.
In the below mentioned demo application two threads are created. Both instantiate a VM (which works well). But only one thread seems to be able to run AttachCurrentThread. When AttachCurrentThread is called for the second one I get the following error:
# An unexpected error has been detected by Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x080486ae, pid=1428, tid=3035118512
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
# Problematic frame:
# C [jvmthreads+0x6ae]But because one thread successfully instantiates a java class I think that the basic code structure is OK. It seems to be a threading issue. My application looks as follows:
#include <stdlib.h>
#include <jni.h>
#include <pthread.h>
#define USER_CLASSPATH "myclasses.jar"
#define CLASS_NAME "com.foobar/DummyRtbosFiller"
JavaVM* JavaThreads_createJVM(){
JNIEnv *env;
JavaVM *vm;
jint res;
setenv("JAVA_VM_VERSION", "1.5", 1);
// setenv("JAVA_VM_VERSION", "1.5", 0);
JavaVMInitArgs vm_args;
JavaVMOption options[7];
options[0].optionString = malloc(3000*sizeof(char));
sprintf(options[0].optionString, "-Djava.class.path="USER_CLASSPATH);
options[1].optionString = "-Xmx64m";
int enableRemDebugging = 0;
if(enableRemDebugging){
printf("enable remote debugging");
// intellij remote debugging support
options[2].optionString = "-Xdebug";
options[3].optionString = "-Xnoagent";
options[4].optionString = "-Djava.compiler=NONE";
options[5].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=34343";
vm_args.nOptions = 6;
}else{
vm_args.nOptions = 2;
vm_args.options = options;
vm_args.version = JNI_VERSION_1_4;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* Create the Java VM */
res = JNI_CreateJavaVM(&vm, (void**)&env, &vm_args);
printf("java started.\n");
return vm;
* \brief Shuts down an existing java virtual machine.
* \param jvm Pointer to the jvm to be destroyed.
* This method is used to shut down an existing java virtual machine.
int JavaThreads_destroyJVM(JavaVM *jvm){
// JNIEnv *env = getAttachedEnv(self, jvm);
// if ((*env)->ExceptionOccurred(env)) {
// (*env)->ExceptionDescribe(env);
// detach the current thread from the vm
(*jvm)->DetachCurrentThread(jvm);
(*jvm)->DestroyJavaVM(jvm);
return 0;
* \brief Attaches the current thread to a given vm instance
* \param self Pointer to bbcm-instance
* \param jvm Pointer to the jvm use for attachment
* This method is used to attach the current thread to a given vm instance
JNIEnv* getAttachedEnv(JavaVM *jvm){
JNIEnv *localEnv = NULL;
int envErr = 0;
/* get a local java env */
envErr = (*jvm)->AttachCurrentThread( jvm, (void**)&localEnv, NULL );
if ( envErr != 0 ){
if ( (*localEnv)->ExceptionCheck( localEnv ) == JNI_TRUE ){
(*localEnv)->ExceptionDescribe( localEnv );
if((*localEnv)->ExceptionOccurred(localEnv)){
(*localEnv)->ExceptionDescribe(localEnv);
if (localEnv == NULL) {
printf("ERROR: failed to get ENV pointer in pushContext");
// JavaThreads_destroyJVM(jvm);
return (JNIEnv*) NULL;
return localEnv;
* \brief Create a new instance of the transcriber application
* \return Pointer to the java object
* This method is used to create a new instance transcriber application
jobject startJavaSubSystem(JavaVM *jvm, char* argString){
printf("attaching env pointer.\n");
JNIEnv *env = getAttachedEnv(jvm);
printf("thread attachment done.\n");
jclass cls;
jmethodID mid;
jobject transcriber;
cls = (*env)->FindClass(env, CLASS_NAME);
if (cls == NULL) {
JavaThreads_destroyJVM(jvm);
jstring jArgumentString = (*env)->NewStringUTF(env, argString);
mid = (*env)->GetMethodID(env, cls, "<init>", "(ILjava/lang/String;)V");
if (mid == NULL) {
JavaThreads_destroyJVM(jvm);
printf("starting object instantiation\n");
(*env)->NewObject(env, cls, mid, 1, jArgumentString);
return transcriber;
void startJavaThread(char* arg){
JavaVM *jvm;
printf("create a jvm instance for component '%s'\n", arg);
jvm = JavaThreads_createJVM();
printf("attempting to start component '%s'\n", arg);
startJavaSubSystem(jvm, arg);
printf("component '%s' started !\n", arg);
// sleep forever to keep the thread alive
sleep(10000);
int main(int argc, char **argv) {
pthread_t thread1, thread2;
/* Create independent threads each of which will instantiate a java VM. */
int iret1 = pthread_create( &thread1, NULL, startJavaThread, (void*) "test47");
sleep(1);
int iret2 = pthread_create( &thread2, NULL, startJavaThread, (void*) "test48");
pthread_join( thread1, NULL);
pthread_join( thread2, NULL);
printf("Thread 1 returns: %d\n",iret1);
printf("Thread 2 returns: %d\n",iret2);
return 0;
}What could be my mistake?
Any help (links, docs, ideas) is welcome.
Best regards, HolgerYou're right. I got confused by the specs of JNI_GetCreatedJVMs:
JNI_GetCreatedJavaVMs function returns all virtual machine instances
that have been created in the current process.But unfortunately you're completely right (cf. http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#wp9502 )
As of JDK/JRE 1.2, creation of multiple VMs in a single process is not supported.Nothing seems to have changed since then. :-(
thanks for the help, bg, holger -
Exception access violation using jlong instead of jint
Hi,
I hope you can help me.
I'm using Java5 under Windows XP and I'm developing under Eclipse.
I try to use an "old" c-Application accesed via JNI.
Status Quo is that, I have access to the c-side, over my JNI-conform DLL. My current task is to translate the c-side structs to java-objects. This also works, but only with limitation.
Calling methods bidirectional is working, manipulation a java-object is like a walk on an warm and sunny Saturday afternoon.
But I'm not able to use all possible parameters (for now I have tried to use jobject, jstring, jint, jboolean, jlong).
The first problem I had, were using Strings as parameters, but this now I deal with the loopway over java/lang/object (using java/lang/String results in an access_violation).
The next problem, and the harder one, is, that I cannot use the type long or jlong.
int (jint) is no problem, with int all works fine, but if I change the environment, creating and using long, I allways get an the access_violation shown below.
Is there anything, I need to know?
working c-side-code:
jobject someObject;
jint anIntegerValue;
anIntegerValue =5;
jmethodID mid3 = (*env)->GetMethodID(env, cl, "initReturnSomeObject", "(ILjava/lang/Object;)Ljava/lang/Object;");
if(mid3 == (jmethodID)0) printf("\ndooofes MethodName4!\n");
else {
const char* myParams;
myParams = "ooooohwow!!!";
someObject = (*env)->CallObjectMethod(env, jobj, mid3,
anIntegerValue, (*env)->NewStringUTF(env, myParams));
}wokring java-side-code
public Object initReturnSomeObject(int i, Object obj) {
String s = (String)obj;
System.out.println("String: "+s+"\nInteger: "+i);
some = new SomeObject(s,i);
if(some==null) System.out.println("Some is not yet initialized, FEAR!!!!\n");
else System.out.println("Yoh, I'm soooo many good!! \nSome:\nString: "+some.getS1()+"\nInt: "+some.getI1()+"\n");
return (Object)some;
so, und this code, doesn't work. you can see, the changes are dramatically!! ;)
sorry for my sarcasm. I do not know, why it doesn't work.
jlong aLongValue;
aLongValue = 2;
jmethodID mid3 = (*env)->GetMethodID(env, cl, "initReturnSomeObject", "(JLjava/lang/Object;)Ljava/lang/Object;");
if(mid3 == (jmethodID)0) printf("\ndooofes MethodName4!\n");
else {
const char* myParams;
myParams = "ooooohwow!!!";
someObject = (*env)->CallObjectMethod(env, jobj, mid3,
aLongValue, (*env)->NewStringUTF(env, myParams));
public Object initReturnSomeObject(long i, Object obj) {
String s = (String)obj;
System.out.println("String: "+s+"\nInteger: "+i+"\nLong: ");
some = new SomeObject(s,(int)i);
if(some==null) System.out.println("Some is not yet initialized, FEAR!!!!\n");
else System.out.println("Yoh, I'm soooo many good!! \nSome:\nString: "+some.getS1()+"\nInt: "+some.getI1()+"\n");
return (Object)some;
# An unexpected error has been detected by Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d942975, pid=1784, tid=1648
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
# Problematic frame:
# V [jvm.dll+0x182975]
# An error report file with more information is saved as hs_err_pid1784.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#do you need some other informations or details? something out of the log-file? ok, i have to take the bus, so sorry for uncomplete informations or sentences ;)
till later.Hi,
I'm quite sure, the signature is correct. For failure check, yesterday I ran javap to check the signature, but I do also mean, that I changed the signature afterwards for several time. And, it works ;) at least the way, using Integer.
Trying to use java/lang/String everytime I got the Error, that the method could not be found - this is the part, I was wrong in my description. So the error-Message is a different one.
Belonging to the question for assumptions I made... it's difficult. I'm quite new to JNI, so, I don't know, what I can assume to do. The Method call seems to be a kind of reflection-mechanism. So I assume that the behaviour is similar. But reflection I'm not very firm, either ^^.
What I do assume is, that the parameter-value J fits to the java-type jlong. But a work around on this, I will try today. getting the jlong into an char* or using long instead of jlong or using Ljava/lang/Long; or a casted Long as Ljava/lang/Object; ...
I'm anxious to the ideas, I will have, bypassing this point. if there is no way, I will write a file, send a email or something like this ;)
Thx for thinking about my problem jschel!! It's great not to be alone.
John -
Returning several values from a C native method
Hi,
I need to return 3 values from a native methode : an int (the return code), a string of variable length and a double.
In pure C, my function would be defined as "int f ( char* s, double* d)", and I would "malloc" the string into the calling function, then copy my string to "s" and use "*d" to return the double...
Is there a way to do that with JNI? I found some examples where the native function returns only one parameterlike: "return(*env)->NewStringUTF(env, buffer);" But I didn't find examples where the native function returns several parameters, including a string.
Thanks in advance!
JMThis really has nothing to do with JNI.
You have a method, and you want to return more than one type of value.
The following solutions are possible.
1. Return an array that contains all the values (actual return value.)
2. Return an object that contains all the values (actual return value.)
3. Use an array via the parameter list and fill in a value.
4. Use an object via the parameter list and fill in the values. -
JNI Invocation: open file in Java, write file in CPP
Hello,
Warning: I am a dunce, bad CPP code ahead!
Using JNI invocation, I am trying to read a binary file in Java and write it in CPP.
Everything compiles and runs without error, but the input and output jpg files are of course different.
TIA to any help,
kirst
(begin ByteMe.java)
import java.io.*;
public class ByteMe
// Returns the contents of the file in a byte array.
public byte[] getBytesFromFile(String strInfo) throws IOException
System.out.println("Testing:" + strInfo);
File file = new File("1.jpg");
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
// Create the byte array to hold the data
byte[] bytes = new byte[(int)length];
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
// Ensure all the bytes have been read in
if (offset < bytes.length)
throw new IOException("Could not completely read file "+file.getName());
// Close the input stream and return bytes
is.close();
return bytes;
public ByteMe()
//System.out.println("in constructor");
}(end ByteMe.java)
(begin ByteMe.cpp)
#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include <windows.h>
// for file operations:
#include <fstream>
int main( int argc, char *argv[] )
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
JavaVMOption options[5];
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jobject obj_print;
options[0].optionString = "-Xms4M";
options[1].optionString = "-Xmx64M";
options[2].optionString = "-Xss512K";
options[3].optionString = "-Xoss400K";
options[4].optionString = "-Djava.class.path=.";
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_FALSE;
// Create the Java VM
res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
if (res < 0)
printf("Can't create Java VM");
goto destroy;
cls = env->FindClass("ByteMe");
if (cls == 0)
printf("Can't find ByteMe class");
goto destroy;
jmethodID id_construct = env->GetMethodID(cls,"<init>","()V");
jstr = env->NewStringUTF(" from C++\n");
obj_print = env->NewObject(cls,id_construct);
// signature obtained using javap -s -p ByteMe
mid = env->GetMethodID(cls, "getBytesFromFile", "(Ljava/lang/String;)[B");
if (mid == 0)
printf("Can't find ByteMe.getBytesFromFile\n");
goto destroy;
else
jbyteArray jbuf = (jbyteArray) env->CallObjectMethod(obj_print,mid,jstr);
jlong size = jsize(jbuf);
printf("size is: %d\n", size); // size shown in output is
std::ofstream out("data.jpg", std::ios::binary);
out.write ((const char *)jbuf, 100000);
destroy:
if (env->ExceptionOccurred())
env->ExceptionDescribe();
jvm->DestroyJavaVM();
}(end ByteMe.cpp)Hello,
Me again. Well, not such a dunce after all. Here is code that works correctly, and compiles with no errors and no warnings.
Will much appreciate help with clean-up code.
TIA,
kirst
(begin ByteMe.java)
import java.io.*;
public class ByteMe
public long getFilezize(String strInfo) throws IOException
// demonstrates String parameter passed from CPP to Java:
System.out.println("(getFilesize) Hello world" + strInfo);
File file = new File("1.bmp");
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
is.close();
return length;
// Returns the contents of the file in a byte array.
public byte[] getBytesFromFile(String strInfo) throws IOException
System.out.println("(getBytesFromFile) Hello world" + strInfo);
File file = new File("1.bmp");
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
System.out.println("length is: " + String.valueOf(length));
// Create the byte array to hold the data
byte[] bytes = new byte[(int)length];
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0)
offset += numRead;
// Ensure all the bytes have been read in
if (offset < bytes.length)
throw new IOException("Could not completely read file "+ file.getName());
// Close the input stream and return bytes
is.close();
return bytes;
public ByteMe()
//System.out.println("in constructor");
}(end ByteMe.java)
(begin ByteMe.cpp)
Signature obtained with command:
"C:\Program Files\Java\jdk1.5.0_15\bin\javap.exe" -s -p ByteMe
Compiled from "ByteMe.java"
public class ByteMe extends java.lang.Object{
public long getFilezize(java.lang.String) throws java.io.IOException;
Signature: (Ljava/lang/String;)J
public byte[] getBytesFromFile(java.lang.String) throws java.io.IOException;
Signature: (Ljava/lang/String;)[B
public ByteMe();
Signature: ()V
Compiled VC++ 2005 Express, run on Vista
#include <stdlib.h>
#include <string.h>
#include <jni.h>
// file operations
#include <fstream>
int main( int argc, char *argv[] )
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
JavaVMOption options[5];
jint res;
jclass cls;
jmethodID mid;
jmethodID sizeid;
jstring jstr;
jobject obj_print;
jlong filesize;
options[0].optionString = "-Xms4M";
options[1].optionString = "-Xmx64M";
options[2].optionString = "-Xss512K";
options[3].optionString = "-Xoss400K";
options[4].optionString = "-Djava.class.path=.";
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_FALSE;
// Create the Java VM
res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
if (res < 0)
printf("Can't create Java VM");
goto destroy;
cls = env->FindClass("ByteMe");
if (cls == 0)
printf("Can't find ByteMe class");
goto destroy;
jmethodID id_construct = env->GetMethodID(cls,"<init>","()V");
printf("%s\n",id_construct);
jstr = env->NewStringUTF(" from C++!\n");
if (jstr == 0)
// Normally not useful
printf("Out of memory (could not instantiate new string jstr)\n");
goto destroy;
obj_print = env->NewObject(cls,id_construct);
//BEGIN BLOCK to get file size
sizeid = env->GetMethodID(cls, "getFilezize", "(Ljava/lang/String;)J");
if (sizeid == 0)
printf("Can't find ByteMe.getFilezize\n");
goto destroy;
else
printf("got here\n");
filesize =(jlong) env->CallObjectMethod(obj_print,sizeid,jstr);
printf("got filesize\n");
// END BLOCK to get file size
// BEGIN BLOCK to write file
mid = env->GetMethodID(cls, "getBytesFromFile", "(Ljava/lang/String;)[B");
if (mid == 0)
printf("Can't find ByteMe.getBytesFromFile\n");
goto destroy;
else
jbyteArray ret =(jbyteArray) env->CallObjectMethod(obj_print,mid,jstr);
// Access the bytes:
jbyte *retdata = env->GetByteArrayElements(ret, NULL);
// write the file
std::ofstream out("data.bmp", std::ios::binary);
//out.write ((const char *)retdata, 921654);
out.write ((const char *)retdata, (long)filesize);
// END BLOCK to write file
destroy:
if (env->ExceptionOccurred())
env->ExceptionDescribe();
jvm->DestroyJavaVM();
}(end ByteMe.cpp) -
I am unable to figure out the way in which I can return an object
array from a cpp file to java. Is there any obvious error which you can spot in
my CPP file?
When I try to return a single object in the native function,
it works fine but when I try to extend it and return an array of the object, it
throws an error.
Please find below the details
h1. Java Class
public class Flight {
public String ID;
public class InterfaceClass {
private native Flight[] GetFlights();
public static void main(String[] args)
Flight[] objFlight = new
InterfaceClass().GetFlights();
System.+out+.println(objFlight[0].ID);
static {
System.+loadLibrary+("main");
h1. CPP File
JNIEXPORT jobjectArray JNICALL Java_InterfaceClass_GetFlights(JNIEnv env, jobject obj)
//1. ACCESSING THE FLIGHT CLASS
jclass cls_Flight = env->FindClass("LFlight;");
//2. CONSTRUCTOR FOR FLIGHT CLASS
jmethodID mid_Flight = env->GetMethodID(cls_Flight,"<init>", "()V");
//3. CREATING AN OBJECT OF THE FLIGHT CLASS
jobject objFlight = env->NewObject(cls_Flight, mid_Flight);
//4. ACCESSING THE FLIGHT's "ID" FIELD
jfieldID fid_ID = env->GetFieldID(cls_Flight, "ID","Ljava/lang/String;");
//5. SETTING THE VALUE TO THE FLIGHT's "ID" FIELD
env->SetObjectField(objFlight,fid_ID, env->NewStringUTF("ABC"));
//6. ACCESSING THE FLIGHT ARRAY CLASS
jclass cls_Flight_Array = env->FindClass("[LFlight;");
if(cls_Flight_Array == NULL)
printf("Error-1");
//7. CREATING A NEW FLIGHT ARRAY OF SIZE 1 jobjectArray arrFlightArray = env->NewObjectArray(1,cls_Flight_Array,NULL);
if(arrFlightArray == NULL)
printf("Error-2");
//8. INSERTING A FLIGHT BJECT TO THE ARRAY
env->SetObjectArrayElement(arrFlightArray,0,objFlight);
return arrFlightArray;
h1. Error
# A fatal error has been detected by the Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION
(0xc0000005) at pc=0x6d9068d8, pid=1804, tid=3836
# JRE version: 6.0_18-b07
# Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode, sharing
windows-x86
# Problematic frame:
# V [jvm.dll+0x1068d8]
# An error report file with more information is saved as:
# C:\Users\Amrish\Workspace\JNI Test\bin\hs_err_pid1804.log
# If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp
C:\Users\Amrish\Workspace\JNI Test\bin>java -Djava.library.path=.
InterfaceClass
Exception in thread "main" java.lang.ArrayStoreException
at
InterfaceClass.GetFlights(Native Method)
at
InterfaceClass.main(InterfaceClass.java:6)
C:\Users\Amrish\Workspace\JNI Test\bin>java -Djava.library.path=.
InterfaceClass
Exception in thread "main" java.lang.ArrayStoreException
at
InterfaceClass.GetFlights(Native Method)
at
InterfaceClass.main(InterfaceClass.java:6)
Edited by: amrish_deep on Mar 18, 2010 7:40 PM
Edited by: amrish_deep on Mar 18, 2010 7:40 PM//6. ACCESSING THE FLIGHT ARRAY CLASS
jclass cls_Flight_Array = env->FindClass("[LFlight;");The argument to NewObjectArray is the +element+ class of the array you're about to create, not the +array+ class itself. -
Deployment of JavaFX Web application on client machine(Windows OS.)
Problem Statement:
Deployment of JavaFX Web application on client machine(Windows OS.)
Error: unable to load the native libarary(JNI Windows dll) i.e. throws java.lang.UnsatisfiedLinkError exception.
Problem Description:
I have create the JavaFX application which have dependency on Native library written in Java Native Interface(JNI).
When the application is deployed on Apache 6.0 Tomcat Server(Copied .html file *.jnlp file and .jar file) and when client machine hit the html page in internet explorer version 8.0 its throws the following error(java.lang.UnsatisfiedLinkError: no JNIHelloWorld in java.library.path)
Note:
I have created the jar file which have my "JNIHelloWorld' native library dll in root directory. I have signed the jar with same signature which i have used for signing for my application Jar file.
I have mentioned the native library jar in JNLP file resource keyword as follows:
<resources os=Windows>
<nativelib href="JNIHelloWorld.jar" download="eager" />
</resources>
The complete jnlp file content is in "JavaFXApplication.jnlp file:" section below.
The description of error is as follows:
Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
platform is: 1.7
product is: 1.7.0_07
location is: http://java.sun.com/products/autodl/j2se
path is: C:\Program Files\Java\jre7\bin\javaw.exe
args is: null
native platform is: Windows, x86 [ x86, 32bit ]
JavaFX runtime is: JavaFX 2.2.1 found at C:\Program Files\Java\jre7\
enabled is: true
registered is: true
system is: true
Match: ignoring maxHeap: -1
Match: ignoring InitHeap: -1
Match: digesting vmargs: null
Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
Match: digest LaunchDesc: http://10.187.143.68:8282/KPIT/JavaFXApplication20.jnlp
Match: digest properties: []
Match: JVM args: [JVMParameters: isSecure: true, args: ]
Match: endTraversal ..
Match: JVM args final:
Match: Running JREInfo Version match: 1.7.0.07 == 1.7.0.07
*Match: Running JVM args match: have:<> satisfy want:<>*
*java.lang.UnsatisfiedLinkError: no JNIHelloWorld in java.library.path*
* at java.lang.ClassLoader.loadLibrary(Unknown Source)*
* at java.lang.Runtime.loadLibrary0(Unknown Source)*
* at java.lang.System.loadLibrary(Unknown Source)* at javafxapplication20.JavaFXApplication20.<clinit>(JavaFXApplication20.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.javafx.applet.FXApplet2.init(FXApplet2.java:63)
at com.sun.deploy.uitoolkit.impl.fx.FXApplet2Adapter.init(FXApplet2Adapter.java:207)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Java Plug-in 10.7.2.11
Using JRE version 1.7.0_07-b11 Java HotSpot(TM) Client VM
User home directory = C:\Users\io839
Please find my native library code and JavaFX application code:
Native library JNI Code:
JavaFXApplication.java:
JNIEXPORT jstring JNICALL Java_javafxapplication_SampleController_printString(JNIEnv *env, jobject envObject)
string str = "hello JNI";
jstring jniStr = env->NewStringUTF(str.c_str());
return jniStr;
JavaFX Application code:
JavaFXApplication.java:
package javafxapplication;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class JavaFXApplication extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
* @param args the command line arguments
public static void main(String[] args) {
launch(args);
static{
System.loadLibrary("JNIHelloWorld");
SampleController.java file:
package javafxapplication;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
public class SampleController implements Initializable {
@FXML
private Label label;
private native String printString();
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
String str = printString();
label.setText(str);
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
//String str = printString();
JavaFXApplication.jnlp file:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="JavaFXApplication.jnlp">
<information>
<title>JavaFXApplication20</title>
<vendor>io839</vendor>
<description>Sample JavaFX 2.0 application.</description>
<offline-allowed/>
</information>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="JavaFXApplication.jar" size="20918" download="eager" />
</resources>
<resources os=Windows>
<nativelib href="JNIHelloWorld.jar" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="JavaFXApplication" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="800" height="600" main-class="javafxapplication.JavaFXApplication" name="JavaFXApplication" />
<update check="always"/>
</jnlp>No problem.
Make sure your resources are set at the proper location. Could be that tje jni.jar is under a 'lib' folder?
Normally you don't have to worry about deployment a lot if you are using like Netbeans 7.2 or higher.
When you press 'Clean and build' it creates your deployed files in the 'dist' folder.
You can change specification by adapting the build.xml file.
Of course lot of different possibilities are available for deployment!
You can find lot of info here:
[http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm|http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm]
Important to know is if you want to work with
- a standalone application (self-contained or not)
- with webstart
- or with applets
(In my case I'm using webstart, but also Self-Contained Application Packaging (jre is also installed!) -
Throwing Exception having multiple arguments in constructor
hi,
I am trying to implement exception handling for a JAVA + C++ module.
In which C++ exception is caught by a Java module.
The c++ code is as follows,
try
///////////===========
} catch (Exception1 &e) {
jclass clazz = jenv->FindClass("test/Exception1Java");
if(clazz)
jenv->ThrowNew(clazz,e.getErrMsg().c_str());
return 0;
} catch (Exception2 &e) {
jclass clazz = jenv->FindClass("test/Exception2");
if(clazz)
jenv->ThrowNew(clazz,e.getErrMsg().c_str());
return 0;
This works perfectly fine.
But I want to pass one more argument as int while throwing the java exception.
jenv->ThrowNew(clazz,e.getErrId(),e.getErrMsg().c_str());
As the jenv->ThrowNew function only take two arguments I am unable to send the error id( int ) to the message.
Is there any alternate to this function or some other approach to throw the java exceptions.hi,
I am trying to implement exception handling for a
JAVA + C++ module.
In which C++ exception is caught by a Java module.
The c++ code is as follows,<snip>
>
But I want to pass one more argument as int while
throwing the java exception.
env->ThrowNew(clazz,e.getErrId(),e.getErrMsg().c_str());>
As the jenv->ThrowNew function only take two
arguments I am unable to send the error id( int ) to
the message.
Is there any alternate to this function or some other
approach to throw the java exceptions.Build the exception using the normal FindClass, GetMethodID approach,. and then throw it.
#include "NativeExceptionTest.h"
JNIEXPORT void JNICALL Java_NativeExceptionTest_test
(JNIEnv *env, jobject obj, jint data) {
if (data == 42) {
jclass excClass = env->FindClass("MyException");
if (!excClass) {
return;
jmethodID ctorID = env->GetMethodID(excClass, "<init>", "(ILjava/lang/String;)V");
if (!ctorID) {
return;
jstring excMessage = env->NewStringUTF("ILLEGAL VALUE");
jobject excObject = env->NewObject(excClass, ctorID,-1,excMessage);
if (!excObject) {
return;
env->Throw((jthrowable)excObject);
return;
}============================================
public class NativeExceptionTest {
static {
System.loadLibrary("nativeException");
NativeExceptionTest() {
try {
test(42);
} catch (MyException e) {
System.out.println("Exception: " + e.getCode() + "(" + e.getMessage() +")");
private native void test(int i) throws MyException;
public static void main(String[] args) {
new NativeExceptionTest();
class MyException extends Exception {
private int code;
MyException(int code, String message) {
super(message);
this.code = code;
int getCode() {
return this.code;
} -
Multiple classes accessing the same DLL???
This behaviour is completely unacceptable.
Let's visualise my app:
There a 2 java classes:
ClassA:
public String[] getPaths(){
return getNativePaths();
public native String[] getNativePaths();
static{
System.loadLibrary("mylib");
} ClassB:
public void setPaths(String[] paths){
setNativePaths(paths);
public native void setNativePaths(String[] paths);
static{
System.loadLibrary("mylib");
} MainClass:
public void testA(){
ClassB clsB=new ClassB();
String paths[]={"c:\\test.txt"};
clsB.setPaths(paths);
public void testB(){
ClassA clsA=new ClassA();
String paths[]=clsA.getPaths();
public void testC(){
ClassA clsA=new ClassA();
String[] paths=clsA.getPaths();
clsA=null;
ClassB clsB=new ClassB();
clsB.setPaths(paths);
}Method testA and testB in MainClass don't pose any problems, they work fine. :)
But when calling testC, I get this:
java.lang.UnsatisfiedLinkError: no mylib in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
...ClassA and ClassB both work good if used separately (another thread). But if we call one after another (same thread), an exception is thrown.
So, what's the problem here?
Is it the return of a string array?1 remark:
If I do this:
ClassA clsA=new ClassA();
ClassB clsB=new ClassB();
clsB.setPaths(clsA.getPaths());This works, but if you call the dll again after this, you'll get the same exception over and over again.
I think it has something to do with the release of strings (cause there isn't any).
My native code that returns an array of Strings:
jobjectArray strArray=null;
strArray=env->NewObjectArray(nSize,env->FindClass("java/lang/String"),env->NewStringUTF(""));
// loop
env->SetObjectArrayElement(strArray,nCount,env->NewStringUTF(dlg->GetNextPathName(pos)));
nCount++;
return strArray; -
JVM Crash When Using JNI and COM
I'm trying to call a DLL compiled from VB6 source code that I do not have access to. The VB6 code simply retrieves data from a DB2 database using ADO and my client code grabs that data and marshals it to my Java code. I'm attempting to achieve this using JNI and COM (without a third-party bridge). It works 75% of the time, but the other 25% of the time, the JVM crashes with the usual Hotspot crash log containing an access violation exception. However, I don't know what in my C++ code (VC++ 8) could be causing this except for passing a "wild" pointer to the code lying underneath the COM object interface. If that is the case, I don't know how I am doing that.
The Java code that is calling my native method is running on Tomcat 5.5.25 and just to be safe, I am not allowing multiple threads to concurrently call the method in my JNI DLL (though I realize that this will kill performance). Once I can get past this problem, I'll do the COM interfacing on a worker thread in my native code so I don't screw up CoInitialize and CoUninitialize calls in the case the same thread is concurrently executing multiple calls to my native code.
I've noticed that in most cases, the JVM crashes during my call to the pClsAccount->OpenConnection method. However, my DLL isn't what is listed on the top of the call stack, which is why I suspect the passing of a wild pointer, though I'm just taking a guess at that. Does anyone have an idea as to what's going on ?
JNIEXPORT jobject JNICALL Java_CustomerInfo_nGetCustomerAccountInfo(JNIEnv *env, jobject customerInfo, jstring accountNumber, jstring iniFileName)
jboolean isCopy;
// Account info class and instance to be instantiated
jclass accountInfoCls = NULL;
jobject accountInfoObj = NULL;
// The constructor ID of the accountInfoCls
jmethodID ctorID = NULL;
// Pointer to the interface for the ClsAccount COM object
_clsAccount *pClsAccount = NULL;
HRESULT hr;
BSTR bstrIniFileName(L"");
try
const char *nativeAccountNumber = NULL;
if (accountNumber != NULL)
nativeAccountNumber = env->GetStringUTFChars(accountNumber, &isCopy);
else
jclass newExcCls;
env->ExceptionDescribe();
env->ExceptionClear();
newExcCls = env->FindClass("java/lang/IllegalArgumentException");
env->ThrowNew(newExcCls, "accountNumber passed in was null !");
return NULL;
// Initialization
variantt varConnectionSucceeded = variantt(false);
variantt varGetAccountInfoSucceeded = variantt(false);
variantt varAccountNumber = variantt(nativeAccountNumber);
bstrt bstrLastPaymentDate = bstrt();
bstrt bstrLastErrorMessage = bstrt();
bstrt bstrLastErrorNumber = bstrt();
jlong jTotalDue = NULL;
jlong jEstablishedDueDay = NULL;
jlong jLastPaymentAmount = NULL;
jstring jLastPaymentDate = NULL;
jstring jLastErrorMessage = NULL;
jstring jLastErrorNumber = NULL;
jthrowable jException = NULL;
const char *chLastPaymentDate = NULL;
const char *chLastErrorMessage = NULL;
const char *chLastErrorNumber = NULL;
long long totalDue;
long long lastPaymentAmount;
long establishedDueDateDay;
//Convert string from Java string to C string to VB string
const char *nativeIniFileName = NULL;
if (iniFileName != NULL)
nativeIniFileName = env->GetStringUTFChars(iniFileName, &isCopy);
else
jclass newExcCls;
env->ExceptionDescribe();
env->ExceptionClear();
newExcCls = env->FindClass("java/lang/IllegalArgumentException");
env->ThrowNew(newExcCls, "iniFileName passed in was null");
return NULL;
bstrIniFileName = comutil::ConvertStringToBSTR(nativeIniFileName);
CoInitialize(NULL);
// Create an instance of the COClass with the interface over it
hr = CoCreateInstance(__uuidof(clsAccount), NULL, CLSCTX_INPROC_SERVER, __uuidof(_clsAccount), (void **)&pClsAccount);
if (hr == S_OK)
varConnectionSucceeded.boolVal = pClsAccount->OpenConnection(&bstrIniFileName);
 
if (varConnectionSucceeded.boolVal == -1)
varGetAccountInfoSucceeded.boolVal = pClsAccount->GetAccountPaymentInformation(&(varAccountNumber.GetVARIANT()));
env->ReleaseStringUTFChars(accountNumber, nativeAccountNumber);
// Extract all available account information from the ClsAccount object
if (varGetAccountInfoSucceeded.boolVal == -1)
totalDue = pClsAccount->TotalDue.int64;
establishedDueDateDay = pClsAccount->EstablishedDueDateDay;
lastPaymentAmount = pClsAccount->LastPaymentAmount.int64;
bstrLastPaymentDate = pClsAccount->LastPaymentDate;
chLastPaymentDate = comutil::ConvertBSTRToString(bstrLastPaymentDate.GetBSTR());
jTotalDue = (jlong)totalDue;
jEstablishedDueDay = (jlong)establishedDueDateDay;
jLastPaymentAmount = (jlong)lastPaymentAmount;
jLastPaymentDate = env->NewStringUTF(chLastPaymentDate);
delete[] chLastPaymentDate;
pClsAccount->CloseConnection();
// Populate error fields if any errors occur
bstrLastErrorMessage = pClsAccount->LastErrMessage;
chLastErrorMessage = comutil::ConvertBSTRToString(bstrLastErrorMessage.GetBSTR());
bstrLastErrorNumber = pClsAccount->LastErrNumber;
chLastErrorNumber = comutil::ConvertBSTRToString(bstrLastErrorNumber.GetBSTR());
jLastErrorMessage = env->NewStringUTF(chLastErrorMessage);
jLastErrorNumber = env->NewStringUTF(chLastErrorNumber);
delete[] chLastErrorMessage;
delete[] chLastErrorNumber;
const char* clsName = "com/nuance/merchantsmutual/businessentities/CustomerAccountInfo";
// Find the Java class and the ID of its constructor
accountInfoCls = env->FindClass(clsName);
ctorID = env->GetMethodID(accountInfoCls, "<init>", "(JJJLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
jException = env->ExceptionOccurred();
if (jException != NULL)
env->ExceptionDescribe();
env->ExceptionClear();
//Release all resources associated with the ClsAccount instance
pClsAccount->Release();
//Instantiate the class with the given parameters
accountInfoObj = env->NewObject(accountInfoCls, ctorID, jTotalDue, jEstablishedDueDay, jLastPaymentAmount, jLastPaymentDate, jLastErrorMessage, jLastErrorNumber);
jException = env->ExceptionOccurred();
if (jException != NULL)
env->ExceptionDescribe();
env->ExceptionClear();
else if (hr == REGDB_E_CLASSNOTREG)
cout << "COM class not registered" << endl;
else if ( hr == CLASS_E_NOAGGREGATION)
cout << "COM class can't be aggregated" << endl;
else if (hr == E_NOINTERFACE)
cout << "No interface for COM class clsAccount" << endl;
else if (hr == E_POINTER)
cout << "*ppv pointer was NULL !" << endl;
else
cout << "Error occurred while creating COM object. HR is [" << hr << "]" << endl;
// Free the BSTR because a new one was returned with a call to comutil::ConvertStringToBSTR
SysFreeString(bstrIniFileName);
// Release the string when it's no longer needed. MUST call if string won't be used
// anymore or else a memory leak will occur
env->ReleaseStringUTFChars(iniFileName, nativeIniFileName);
CoUninitialize();
 
catch (_com_error &e)
cout << "Encountered an exception in GetCustomerAccountInfo: Error was " << e.ErrorMessage();
pClsAccount->Release();
catch (...)
pClsAccount->Release();
return accountInfoObj;
Edited by: Cthulhu76 on Jan 5, 2010 9:18 AM0x49202400 JavaThread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon [_thread_blocked, id=5340, stack(0x49bf0000,0x49c40000)]
0x48a7e800 JavaThread "Thread-1" [_thread_in_native, id=5976, stack(0x48f00000,0x48f50000)]
0x48a0dc00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3072, stack(0x48c60000,0x48cb0000)]
0x48a09000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4988, stack(0x48c10000,0x48c60000)]
0x48a07c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3124, stack(0x48bc0000,0x48c10000)]
0x48a07000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2572, stack(0x48b70000,0x48bc0000)]
0x489f5c00 JavaThread "Finalizer" daemon [_thread_blocked, id=5752, stack(0x48b20000,0x48b70000)]
0x489f4c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2596, stack(0x48ad0000,0x48b20000)]
0x003c6000 JavaThread "main" [_thread_in_native, id=4252, stack(0x00820000,0x00870000)]
Other Threads:
0x489f0400 VMThread [stack: 0x48a80000,0x48ad0000] [id=5624]
0x48a18800 WatcherThread [stack: 0x48cb0000,0x48d00000] [id=1192]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 36288K, used 12762K [0x02940000, 0x050a0000, 0x07800000)
eden space 32256K, 34% used [0x02940000, 0x0343af58, 0x048c0000)
from space 4032K, 37% used [0x04cb0000, 0x04e2ba28, 0x050a0000)
to space 4032K, 0% used [0x048c0000, 0x048c0000, 0x04cb0000)
tenured generation total 483968K, used 7518K [0x07800000, 0x250a0000, 0x42940000)
the space 483968K, 1% used [0x07800000, 0x07f57958, 0x07f57a00, 0x250a0000)
compacting perm gen total 14080K, used 14016K [0x42940000, 0x43700000, 0x46940000)
the space 14080K, 99% used [0x42940000, 0x436f0320, 0x436f0400, 0x43700000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040f000 C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin\tomcat5.exe
0x7c800000 - 0x7c8c0000 C:\WINDOWS\system32\ntdll.dll
0x77e40000 - 0x77f42000 C:\WINDOWS\system32\kernel32.dll
0x77380000 - 0x77411000 C:\WINDOWS\system32\USER32.dll
0x77c00000 - 0x77c48000 C:\WINDOWS\system32\GDI32.dll
0x77f50000 - 0x77feb000 C:\WINDOWS\system32\ADVAPI32.dll
0x77c50000 - 0x77cef000 C:\WINDOWS\system32\RPCRT4.dll
0x76f50000 - 0x76f63000 C:\WINDOWS\system32\Secur32.dll
0x77ba0000 - 0x77bfa000 C:\WINDOWS\system32\MSVCRT.dll
0x7c8d0000 - 0x7d0cf000 C:\WINDOWS\system32\SHELL32.dll
0x77da0000 - 0x77df2000 C:\WINDOWS\system32\SHLWAPI.dll
0x76290000 - 0x762ad000 C:\WINDOWS\system32\IMM32.DLL
0x77420000 - 0x77523000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_D8713E55\comctl32.dll
0x6d7c0000 - 0x6da10000 C:\Program Files\Java\jre1.6.0_07\bin\client\jvm.dll
0x76aa0000 - 0x76acd000 C:\WINDOWS\system32\WINMM.dll
0x7c340000 - 0x7c396000 C:\WINDOWS\system32\MSVCR71.dll
0x6d270000 - 0x6d278000 C:\Program Files\Java\jre1.6.0_07\bin\hpi.dll
0x76b70000 - 0x76b7b000 C:\WINDOWS\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 C:\Program Files\Java\jre1.6.0_07\bin\verify.dll
0x6d310000 - 0x6d32f000 C:\Program Files\Java\jre1.6.0_07\bin\java.dll
0x6d7b0000 - 0x6d7bf000 C:\Program Files\Java\jre1.6.0_07\bin\zip.dll
0x6d570000 - 0x6d583000 C:\Program Files\Java\jre1.6.0_07\bin\net.dll
0x71c00000 - 0x71c17000 C:\WINDOWS\system32\WS2_32.dll
0x71bf0000 - 0x71bf8000 C:\WINDOWS\system32\WS2HELP.dll
0x71b20000 - 0x71b61000 C:\WINDOWS\system32\mswsock.dll
0x5f270000 - 0x5f2ca000 C:\WINDOWS\system32\hnetcfg.dll
0x71ae0000 - 0x71ae8000 C:\WINDOWS\System32\wshtcpip.dll
0x76ed0000 - 0x76efa000 C:\WINDOWS\system32\DNSAPI.dll
0x76f70000 - 0x76f77000 C:\WINDOWS\System32\winrnr.dll
0x76f10000 - 0x76f3e000 C:\WINDOWS\system32\WLDAP32.dll
0x76f80000 - 0x76f85000 C:\WINDOWS\system32\rasadhlp.dll
0x4a6a0000 - 0x4a6ac000 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\CustomerInfoProxy.dll
0x77670000 - 0x777a9000 C:\WINDOWS\system32\ole32.dll
0x77d00000 - 0x77d8b000 C:\WINDOWS\system32\OLEAUT32.dll
0x7c420000 - 0x7c4a7000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_E6967989\MSVCP80.dll
0x78130000 - 0x781cb000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_E6967989\MSVCR80.dll
0x777b0000 - 0x77833000 C:\WINDOWS\system32\CLBCatQ.DLL
0x77010000 - 0x770d6000 C:\WINDOWS\system32\COMRes.dll
0x77b90000 - 0x77b98000 C:\WINDOWS\system32\VERSION.dll
0x75da0000 - 0x75e5d000 C:\WINDOWS\system32\SXS.DLL
0x75e60000 - 0x75e87000 C:\WINDOWS\system32\apphelp.dll
0x4dc30000 - 0x4dc5e000 C:\WINDOWS\system32\msctfime.ime
0x4b0d0000 - 0x4b395000 C:\WINDOWS\system32\xpsp2res.dll
0x71bb0000 - 0x71bb9000 C:\WINDOWS\system32\WSOCK32.dll
0x4bbe0000 - 0x4bbea000 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\ClearTranProxy.dll
0x745e0000 - 0x7489e000 C:\WINDOWS\system32\msi.dll
0x71c40000 - 0x71c97000 C:\WINDOWS\system32\NETAPI32.dll
0x4bc50000 - 0x4bc6c000 C:\WINDOWS\system32\DBNETLIB.DLL
0x71f60000 - 0x71f64000 C:\WINDOWS\system32\security.dll
0x76c90000 - 0x76cb7000 C:\WINDOWS\system32\msv1_0.dll
0x76cf0000 - 0x76d0a000 C:\WINDOWS\system32\iphlpapi.dll
0x761b0000 - 0x76243000 C:\WINDOWS\system32\crypt32.dll
0x76190000 - 0x761a2000 C:\WINDOWS\system32\MSASN1.dll
0x4bcf0000 - 0x4bcff000 C:\Program Files\Common Files\System\Ole DB\SQLOLEDB.RLL
0x4a8a0000 - 0x4a8aa000 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\MIGI.DLL
0x73570000 - 0x736c2000 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\MSVBVM60.DLL
0x4a950000 - 0x4a9e2000 C:\Program Files\Common Files\System\ado\msado15.dll
0x74a50000 - 0x74a6a000 C:\WINDOWS\system32\MSDART.DLL
0x4c850000 - 0x4c8c9000 C:\Program Files\Common Files\System\Ole DB\oledb32.dll
0x4dbb0000 - 0x4dbc1000 C:\Program Files\Common Files\System\Ole DB\OLEDB32R.DLL
VM Arguments:
jvm_args: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 5.5 -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 5.5 -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\endorsed -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 5.5\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\logging.properties -Djava.library.path=C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib vfprintf -Xms512m -Xmx1024m
java_command: <unknown>
Launcher Type: generic
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07
[error occurred during error reporting (printing environment variables), id 0xc0000005]
--------------- S Y S T E M ---------------
OS: Windows Server 2003 family Build 3790 Service Pack 2
CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 7 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3
Memory: 4k page, physical 2097151k(2097151k free), swap 4194303k(4194303k free)
vm_info: Java HotSpot(TM) Client VM (10.0-b23) for windows-x86 JRE (1.6.0_07-b06), built on Jun 10 2008 01:14:11 by "java_re" with MS VC++ 7.1
time: Mon Dec 28 15:24:00 2009
elapsed time: 600 seconds
Maybe you are looking for
-
Problem with setCursor for JButton in cell on JTable
i have a problem with setCursor to JButton that is in a cell of the JTable} this is the code public class JButtonCellRenderer extends JButton implements TableCellRenderer { public JButtonCellRenderer() { setOpaque(true); public Component getTableCell
-
I just received my 5th Gen Ipod Nano 16gb yesterday and when trying to listen to it in my car using my iTrip, the sound is completely flat and non-bassy. I noticed that the problem was gone once and the sound was fine/full-sounding, but evidently whe
-
Bookmark bar - links disappear
Keeping having the problem that random links on the bar disappear and then I have to go and add them to the bar again. Running Mountain Lion and have all updates Any ideas how to fix ?
-
Javac error during compilation
I am using j2sdk1.4.2_08 with ant and get following error on solaris 8 (I have installed J2SE Solaris 8 Recommended Patch Cluster): An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 10 occurred at PC=0xFE7A2
-
Incremental extract design question
Hello Gurus, We have built a custom LKM that extracts data from a Java source(we have to use Java apis to pull from a LDAP source). It all works for the initial full-load data extact and the stage/target for this is the Oracle Database tables. Now si