SIGSEGV with JNI_CreateJavaVM
I use JDK1.2.2 RC2 on RedHat 6.1.
The following code gives a SIGSEGV on JNI_CreateJavaVM.
Could you tell me where is the problem.
#include
#include
#include
int main(int argc, char **argv)
{
JavaVM * jvm;
JNIEnv * env;
JavaVMInitArgs vm_args;
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs ( &vm_args );
jint res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
if (res < 0)
{
cerr << "JVM has not started" << endl;
exit(1);
}
cout << "JVM started" << endl;
jvm->DestroyJavaVM();
}
Pierre
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: SIGSEGV with JNI_CreateJavaVM
> Pierre Héroux writes:
Pierre> I use JDK1.2.2 RC2 on RedHat 6.1. The following code
Pierre> gives a SIGSEGV on JNI_CreateJavaVM. Could you tell me
Pierre> where is the problem.
Pierre> #include
Pierre> #include
Pierre> #include
Pierre> int main(int argc, char **argv)
Pierre> {
Pierre> JavaVM * jvm;
Pierre> JNIEnv * env;
Pierre> JavaVMInitArgs vm_args;
Make that 'JDK1_1InitArgs vm_args' or use the 1.2 way of creating a VM
(see
http://www.blackdown.org/java-linux/docs/support/faq-release/examples/invocation-in-C++/).
Pierre> vm_args.version = 0x00010001;
Pierre> JNI_GetDefaultJavaVMInitArgs ( &vm_args );
Pierre> jint res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
Pierre> if (res < 0)
Pierre> {
Pierre> cerr << "JVM has not started" << endl;
Pierre> exit(1);
Pierre> }
Pierre> cout << "JVM started" << endl;
Pierre> jvm-> DestroyJavaVM();
Pierre> }
Juergen
--
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux.html
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: SIGSEGV with JNI_CreateJavaVM
The example helloworld.cpp gives me the same error. Here is my makefile. What's wrong Pierre JDK = /usr/local/jdk1.2.2 REP_INC = -I$(JDK)/include \ -I$(JDK)/include/linux REP_LIB = -L$(JDK)/lib/i386 \ -L$(JDK)/jre/lib/i386 \ -L$(JDK)/jre/lib/i386/classic \ -L$(JDK)/jre/lib/i386/green_threads \ -L$(JDK)/jre/lib/i386/native_threads LIBS = -ljava all : Invoke Invoke : helloworld.o g++ -g $(REP_INC) $(REP_LIB) helloworld.o -o Invoke $(LIBS) helloworld.o : helloworld.cpp g++ -g -c $(REP_INC) helloworld.cpp clean : rm -f *.o core -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
BlackdownJDK1.2.2.RC3 crashes on SMP Kernels
I am sure this has been raised before, but just in case... BlackdownJDK1.2.2.RC3 crashes on SMP Kernels, in our case 2.2.5-22smp, glibc-2.1.1-6, RH 6.0 (Both IBMJDK1.1.8 and SunInproseJDK1.2.2RC1 run fine under SMP and non-SMP Kernels) Any chances this will be addressed some time (or has already been addressed in some way)? Regards, Wolfgang. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
SocketException on connect
I have a multi-threaded client. Each thread opens a socket
connection to a remote server. The connection is made in the
constructor to class Socket:
Socket mysock = new Socket(host, port);
... where 'host' is a String.
When several clients initialize (and connect their sockets) at
the same time, occasionally one will fail. The Socket constructor
will throw java.net.SocketException with the message:
errno: 4, error: Interrupted system call for fd:
I tried wrappering the call with a class-synchronized method, the
idea being to prevent 2 threads from attempting to connect sockets
at the same time:
private static synchronized Socket doConnect(String host, int port)
{
return new Socket host, port);
}
But it doesn't work. I still get the same SocketException.
Is this a bug in the implementation? I'm using the Sun Java JDK
RC2 on a Linux PC, which I understand is a derivative of the
blackdown port that uses green-threads.
I can't just catch SocketException and try again, because it might
also mean something non-recoverable like connection-refused, or
network-unreachable right? And parsing the string for the errno
value is obviously a no-no.
Why isn't it generating InterruptedIOException, or just plain
InterruptedException?
Any help is greatly appreciated.
--
Michael Maloney
Ilex Engineering, Inc.
Tel: 410.241.5248
Email: [EMAIL PROTECTED]
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: blackdown jdk version..libpthread.so
Hi Raj. I'm guessing that you have glibc-2.1.1 on your box, which is the version that is shipped with RedHat 6.0, and jdk1.2.2 RC3 needs glibc-2.1.2. JDK1.2pre-v2 needs glibc-2.1.1, which is why you didn't have any trouble with that. Hope this helps. jason Raj Patel wrote: > Hi everybody, > I had some problem with threading using JNI > application and i decided to try newer version of jdk. I downloaded > jdk1.2.2 for i386 rc3 version and file called > > jdk-1.2.2-RC3-linux-i386.tar.bz2 > > After i installed it when i tried to compile and run my application i > got following error! > > /usr/local/download/jdk1.2.2/bin/i386/native_threads/javac: error in > loading shared libraries: > /usr/local/download/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so: > symbol sem_init, version GLIBC_2.1 not defined in file libpthread.so.0 > with link time reference > /usr/local/download/jdk1.2.2/bin/i386/native_threads/javah: error in > loading shared libraries: > /usr/local/download/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so: > symbol sem_init, version GLIBC_2.1 not defined in file libpthread.so.0 > with link time reference > > When tried to run i got, > > /usr/local/download/jdk1.2.2/bin/i386/native_threads/java: error in > loading shared libraries: > /usr/local/download/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so: > symbol sem_init, version GLIBC_2.1 not defined in file libpthread.so.0 > with link time reference > > Can anyone tell what's going on. I have Linux2.2 (Redhat 6.0) as an > operating system. I am able to run older version jdk1.2pre-v2 without > trouble. > > -Raj > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: BlackdownJDK1.2.2.RC3 crashes on SMP Kernels
You need at least glibc 2.1.2 for Blackdown 1.2.2 RC3. See the status page: http://www.blackdown.org/java-linux/jdk1.2-status/jdk1.2-status.html It's very stable on my SMP machine (Debian, 2.3.39, glibc 2.1.2). -Peter http://armedbear.org Wolfgang Hoschek wrote: > > I am sure this has been raised before, but just in case... > > BlackdownJDK1.2.2.RC3 crashes on SMP Kernels, in our case 2.2.5-22smp, > glibc-2.1.1-6, RH 6.0 > (Both IBMJDK1.1.8 and SunInproseJDK1.2.2RC1 run fine under SMP and > non-SMP Kernels) > > Any chances this will be addressed some time (or has already been > addressed in some way)? > > Regards, > Wolfgang. > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
AttachCurrentThread()
Java Linux Buffs: I have a mutli-threaded application using pthreads, RedHat 6.1, gcc 2.91.66, libc 2.1.2. This is a standard RedHat 6.1 install with no patches or upgrades. I have searched through the www.blackdown.org faqs on using JNI and I did not find anything helpfull for this problem. I application spawns various threads to deal with client requests, like a web server would spawn threads to deal with http requests. The main process performs the JNI_CreateJavaVM() which succeeds. When a thread is started it issues an AttachCurrentThread and then proceeds with its work. I am finding that this method succeeds for 4 threads and then blocks for other threads. Its like AttachCurrentThread is hanging or blocked on mutex of some sort. The same code works under Solaris and NT. Is there a limit to the number of threads that can be attached to the VM? BTW: I believe I have everything setup so that the vm properly uses native_threads. Any suggestions? Thanks Mark DeLaFranier. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: HELP: jdk122rc2 swing stuff doesn't work
Ok, now at last I finally remember what _my_ problem was. Before I installed the JDK, I had just reinstalled Linux (Suse 6.3) from scratch, doing the install in German. At least I assumed it was only the installation proper. Instead, that also gave users a LANG=de entry in their environment, and _that_ caused the swing apps to fail. I can even reproduce it now, pj@pulsar:/opt/jdk/demo/jfc/SwingSet > (export LANG=de; java -jar SwingSet.jar) still causes a crash. This wouldn't happen for root, 'cause the variable is only put in normal users' environments... Regards, Peter -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
libioser12.so
Hi, A few days ago, a Linux version of libioser12.so (needed to run J2EE on Linux) was posted on this list. I saved it at the time but then deleted it by mistake. And I couldn't find the message in the mailing list archive (stringe!) so I don't have the exact email address of the poster. Could the original poster (or anyone who has saved the file) email me the file again? Thanks in advance. -- Weiqi Gao [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: AttachCurrentThread()
Hi, Mark, First, you might want to check out Sheng Liang's excellent book on JNI, titled "The Java Native Interface". Also, Nathan Meyers' book, "Java Programming on Linux" is an excellent resource for Linux-specific Java programming questions, and (I think) includes a chapter or two covering JNI and Linux-specific gotchas. Between the two of those, you should have just about all your JNI questions covered! :) --Jeff Mark Delafranier wrote: > > Java Linux Buffs: > > I have a mutli-threaded application using pthreads, RedHat 6.1, gcc 2.91.66, > libc 2.1.2. This is a standard RedHat 6.1 install with no patches or upgrades. > > I have searched through the www.blackdown.org faqs on using JNI and I did not > find anything helpfull for this problem. > > I application spawns various threads to deal with client requests, like a web > server would spawn threads to deal with http requests. The main process > performs the JNI_CreateJavaVM() which succeeds. > > When a thread is started it issues an AttachCurrentThread and then proceeds with > its work. I am finding that this method succeeds for 4 threads and then blocks > for other threads. > > Its like AttachCurrentThread is hanging or blocked on mutex of some sort. The > same code works under Solaris and NT. > > Is there a limit to the number of threads that can be attached to the VM? > > BTW: I believe I have everything setup so that the vm properly uses > native_threads. > > Any suggestions? > > Thanks > Mark DeLaFranier. > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- Jeff Galyan http://www.anamorphic.com http://www.sun.com jeffrey dot galyan at sun dot com talisman at anamorphic dot com Sun Certified Java(TM) Programmer == Linus Torvalds on Microsoft and software development: "... if it's a hobby for me and a job for you, why are you doing such a shoddy job of it?" The views expressed herein do not necessarily reflect those of my employer. Sun Microsystems, Inc., has no connection to my involvement with the Mozilla Organization. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Blackdown Webpage Update
Java-Linux Patriots, For those of you who haven't seen yet, blackdown has updated their website: 1) New JCK Status ( It seems ) 2) RC4 Is comming out this week 3) 1.2 Plugin will be available with next 1.2.2 ( RC4 ) Release 4) JDK 1.3 has been made available to blackdown and first pass port has been done to it. I believe there was more, but these were the biggies. Riyad Kalla General Partner, Multimedia & Design [EMAIL PROTECTED] http://www.transitivesys.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
