Phil--

I caught your messages, both here and in the Advanced-Java list; while I
haven't done JNI in a servlet before, I've done JNI (from all three
directions) before, and I'll give what help I can.

1) JDK 1.2 changed some of the rules regarding native libs and ClassLoaders,
and many, if not most, servlet engines are going to use explicit management
of ClassLoader instances in order to manage the namespace of classes within
the engine. Which JDK are you using?
2) The property "java.library.path" is what the JDk uses to look up and find
the native libraries; can you verify that your native lib is on the
"java.library.path" given within the servlet? (The servlet engine may be
changing this value to something other than what you expect.)
3) The usual "make sure your lib works outside of the servlet" advice, but
you mentioned that this was the case in your adv-java posting.
4) I've never experienced explicit problems with multiple calls into a JNI
method; my only guess is that the stack, on return, is getting screwed up
somehow. Are you sure you've exported the methods using the JNIEXPORT macro
(critical under Win32, a no-op under anything else)?
5) Um.... I'm running out of ideas here. Maybe the first 4 will help? :)

Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
 "I don't even speak for myself; my wife won't let me." --Me

-----Original Message-----
From: Phil Lewis <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, September 07, 1999 1:37 AM
Subject: JNI from servlet - please...


>I have posted a couple of messages about problems using JNI from a servlet,
>and had no response. Has anyone experience of using JNI from a servlet?
>
>I am having problems (not related to COM as I thought at one time) on
>calling a JNI method more than once.
>
>I have a JNI method that returns a long, which should always have the value
>one. The first time it is called, 1 is returned, but the next time, the
>value returned is a some large and seemingly random number.
>
>If anyone has any experience with servlets and JNI, I would be very
grateful
>to hear about it, otherwise, I'll have to abandon the idea of using
>servlets.
>
>Thanks
>
>Phil Lewis
>Technical Architect
>Neural Response Limited
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to