JNI pthreads problem
Hi, I have a problem. I'm building a module for apache. apache doesn't like modules linked with libpthread.so. To use JNI in my application (Invocation API) I link it with libjvm.so and libhpi.so. With ldd I see that these libraries link with pthreads!!! This is a problem with apache. Someone has idea how to resolve this problem? Thanks Valerio Ferrucci P.S. I see tha there is a libhpi.so in a green_threads folder that doesn't link with pthread, but: can I use it? And for libjvm.so? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
Hi, I'm in trouble with thie JNI pthreads problem. Can someone help me on my JNI pthreads problem? Or perhaps can you point me to some other (more appropriate for this topic) mailing-list? Or some other source of support? Thanks > >Hi, > >I have a problem. > >I'm building a module for apache. apache doesn't like modules linked > >with libpthread.so. > > > >To use JNI in my application (Invocation API) I link it with libjvm.so > >and libhpi.so. > >With ldd I see that these libraries link with pthreads!!! > > > >This is a problem with apache. > > > >Someone has idea how to resolve this problem? > > > >Thanks > > > >Valerio Ferrucci > > > >P.S. > >I see tha there is a libhpi.so in a green_threads folder that doesn't > >link with pthread, but: can I use it? > >And for libjvm.so? > > > > > >-- > >To UNSUBSCRIBE, email to [EMAIL PROTECTED] > >with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
"Rousseau, John" wrote: > libhpi.so is the threading package. The one in native_threads is the > LinuxThreads version. The one in green_threads (amazingly enough) is > the Green (Sun's all-user-space package) threads version. Which one have I to use? native or green? Where are the API of these two documented? > Why does Apache "not like" modules using libpthreads.so? It probably > (very probably) uses it itself. I don't know why. If I link my module with pthreads, then Apache fails at startup time! > It's a very strange model in which Apache sends a request to your > module and you start up a VM to handle it. You probably should start > your VM as a seperate process and use a socket to communicate. > Do you think this is the only solution? Thanks > > -John > > > John Rousseau [EMAIL PROTECTED] > SilverStream Software Phone: +1 978 262 3564 > 2 Federal StreetFax: +1 978 262 3499 > Billerica, MA 01821 http://www.silverstream.com > -------- > > On Thursday Dec 14, 2000, Valerio Ferrucci wrote: > > > Hi, > > I'm in trouble with thie JNI pthreads problem. > > > > Can someone help me on my JNI pthreads problem? > > Or perhaps can you point me to some other (more appropriate for this topic) > > mailing-list? > > Or some other source of support? > > > > Thanks > > > > > >Hi, > > > >I have a problem. > > > >I'm building a module for apache. apache doesn't like modules linked > > > >with libpthread.so. > > > > > > > >To use JNI in my application (Invocation API) I link it with libjvm.so > > > >and libhpi.so. > > > >With ldd I see that these libraries link with pthreads!!! > > > > > > > >This is a problem with apache. > > > > > > > >Someone has idea how to resolve this problem? > > > > > > > >Thanks > > > > > > > >Valerio Ferrucci > > > > > > > >P.S. > > > >I see tha there is a libhpi.so in a green_threads folder that doesn't > > > >link with pthread, but: can I use it? > > > >And for libjvm.so? > > > > > > > > > > > >-- > > > >To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > > >with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > > > > > > > ====== > > Valerio FerrucciTabasoft Sas > > [EMAIL PROTECTED] http://tabasoft.ancitel.it > > [EMAIL PROTECTED] > > > > > > > > -- > > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
Hi John, ok, I have an application that uses invocation API. But there I have another problem. When I launch it I see the logs message [Dynamic-linking... [Dynamic-linking... ... [Dynamic-linking native method java/lang/Double.longBitsToDouble...JNI] SIGSEGV11* segmentation violation si_signo [0]: no signal If you want I can send you more. This happens if I link with green or native Thanks for help > > Do you think this is the only solution? > > No. What you need to do is have the threading model that Apache is > using schedule in your threads to it's run queue. I don't think this > is possible with the Java VM (it wants to have control). > > -John > > > John Rousseau [EMAIL PROTECTED] > SilverStream Software Phone: +1 978 262 3564 > 2 Federal StreetFax: +1 978 262 3499 > Billerica, MA 01821 http://www.silverstream.com > -- ====== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
Hi, thanks for your help. Generally I'm thinking that my code doesn't feel so comfortable in apache module. I already had a similar headache-problem with libmysqlclient.so (that linked against pthreads and made crash apache) and I think I will have more and more problems in the future if i don't separate my code from apache. I'm thinking now to split my code into two pieces: an apache module and a separate application (containing almost all of my code, including Invocation API calls). The ap module (the client) simply packs the request and "send" it to the application (the server). The application will processes data and send back the response to the ap module that returns it to apache. In this way (almost) all of my code lives in a separate process space and I'm free from apache constrains. What do you think of this solution? Which is, for you, the best way to communicate between the module and application? Do you think the overhead (for interprocess communication) will be inacceptable (I need speed!)? Paul Mclachlan wrote: > After all that, I'm still in agreement with you about the outcome - do it in a > seperate VM, not using the invocation API. How can I use JNI calls from my application without the Invocation API (my starting point is C (not java))?. Thanks ====== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
JNI and Threads
Hi, I'm building a mutli thread C application using JNI and Invocation API to load Java Virtual Machine and call Java code. To launch a new thread I used the call: pthread_create Now that I link JNI, whit which call have I to substitute "pthread_create"? That is, how can I launch a new thread with JNI? (I already substituted calls to pthread_mutex_lock and pthread_mutex_unlock with (*envP)->MonitorEnter and (*envP)->MonitorExit) Thanks for help ====== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
JNI and pthreads
Hi, I have a C application that uses Invocation API and JNI to load a JVM and call Java classes from C code. In my application I use posix threads calls (like pthread_lockmutex, pthread_create etc...). Since I know that is not good to mix native threads with pthreads, I link my app with $JAVAHOME/../nativethreads jvm hpi, and avoid to link it with libpthread.so. But: What happens if a lib of mine are linked with pthread? Example: I also link myApp with libmysqlclient.so (myApp connects to a mysql db): is a problem if libmysqlclient.so is built with libpthread.so? Is there a difference (regarding this problem) linking "libmysqlclient.so" statically or dinamically? Thanks for help ====== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Java & Multithread
Hi, I'm building a C application (MultiThreaded) using Java Invocation API to call Java from C. I use pthread_create to launch a thread and pthread_mutexlock and pthread_mutexunlock to syncronize them and link my app with "native threads". Then I splat my application launching multiple threads contemporaneously. If I don't call Java all is ok. If I call Java (my simple "Hello Word" Java class) the application exits with "segmentation fault" after some seconds of splatting. 1) Is there something I'm missing in this scenario? 2) Is there some useful documentation about using Java Invocation API in C pthreads? 3) Has the "Hello Word" class to be built in some particular way to live in a multithreaded system? Thanks for help ====== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Java Invocation API
Does anyone know if are there problems starting new threads from C (with pthread_create) and this thread calling Java classes (via Java invocation API)? I'm experimenting this problem: I launch my C server application and stress it with multiple contemporaneous requests: If I launch C app monothread all is ok If I launch C app multithread but doesn't make Java calls all is ok again If I launch C app multithread with Java calls the app crashes after some seconds Thanks for help -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
JNI and i386
Hi, I installed the jdk and jre 1.3.0 on a i386 (RedHat 7.0). The installation seems to be ok, I tried the "Hello" class example and all seems ok. I have some problem loading the JVM in my C app (jni). When I call dlopen on libjvm.so (in classic) I get an error: undefined symbol pthread_sig_mask. Calling ldd on libjvm.so I see that it doesn't link with pthreads. So I download the 1.2.2 of jdk, this time I see (with ldd) that libjvm.so links with pthread, so I try again, but I get a segmentation fault inside CreateJavaVM. The same C code works well on my ppc machine (with jdk 1.3) Any Idea? -- ======== Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://www.tabasoft.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
