-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Dear Baris,

I am providing a consolidated task list to run JNI
from Servlet:

Steps to follow: 
              
             1. Set the classpath properly. Set in
jserv.properties 
             file as wrapper.classpath.  Also set the
System level Classpath. 
            
wrapper.classpath=/usr/local/jdk117_v3/lib/classes.zip

             (JDK Stuff) 
            
wrapper.classpath=/usr/local/jserv/lib/ApacheJServ.jar

              (JSERV Stuff) 
            
wrapper.classpath=/usr/local/JSDK2.0/lib/jsdk.jar    
             (JSDK Stuff) 
            
wrapper.classpath=/ourhome/ourdir/allclasses (Our own 
   classpath to keep the Classes Servlet will access) 
              
             2. Set your system level (i.e. httpd.conf
file) to have a LD_LIBRARY_PATH.  For our case
LD_LIBRARY_PATH is /usr/lib. 
              
             3. Make your zone.property file properly,
so that the  path for keeping the servlets
(repository) is  different from the classpath 
             repositories=/ourhome/ourdir/servlets 
              
4.  CREATE A SEPARATE JNI CLASS FOR ACCESSING THE JNI
LIBRARY. DO NOT WRITE THE JNI LIBRARY ACCESS CODE IN
THE SERVLET CODE ITSELF.
             
5. Keep the Servlet in the repository path. 
              
6. Keep the JNI Classes in the ClassPath defined (the 
             last line in the wrapper.classpath). 
              
7. Make  the .so files with (for x.c to libx.so)
gcc -fPIC -c x.c -I/usr/local/jdk117_v3/include
-I/usr/local/jdk117_v3/include/genunix 
gcc -shared -WI, -soname, libx.so.1 -o libx.so.1.0 x.o
ln -s libx.so.1.0 libx.so.1
rm x.so
ln -s libx.so.1 libx.so

8. Keep the .so files in the LD_LIBRARY_PATH 
              
Hope this will help to run JNI from Servlets.   

Regards, 
              
Dipankar Chakrabarti 

>Subject: Problem:JNI &servlets
>From: "devrim baris acar"
<[EMAIL PROTECTED]>
>Date: Tue, 21 Sep 1999 14:05:16 +0100

>Hi,
>My apache server gives the following error when i try
a -native- call
>from a servlet.

>java.lang.UnsatisfiedLinkError: authenticate
  >      at
>org.apache.jserv.JServConnection.processRequest(JServConnection.java:341)
  >      at
>org.apache.jserv.JServConnection.run(JServConnection.java:197)
  >      at java.lang.Thread.run(Thread.java)
>This authenticate stuff is declared in a servlet. I
have made a javah
>-jni of this class and compiled the c code with these
entries:(redhat 6.0 with apache
1.3.9)
>gcc -fPIC -c -I/usr/local/java/include hello.c -o
hello.o
>and linked it with
>ld -shared hello.o -o libhello.so
>cp libhello.so /usr/lib
>cp libhello.so /lib (for grant)
>and finally
>ldconfig -n /usr/lib
> ldconfig -n /lib.

>This is all I know that's to be done in this subject.
Yet i get that
>error message.
>Baris Acar


__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to