I compiled the code with
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
And restart apache. And as I try to run the servlet i get the error messages
down there.
they mention a LD_LIBRARY_PATH environment variable which i think that not
used in redhat 6.0. Instead
i have seen a /etc/ld.so.conf where library paths are defined.
Should I use a this environment variable? Or any other suggestions to
overcome this problem.
By the way except this servlet I made the tutorial example from Sun's Java
Tutorial work.
Source code: (Only the part that causes the error is here, The code without
that "static" part used to work)
------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.....
.............
....;
public class saved2 extends HttpServlet
{
Connection con;
int mu;
public native int authenticate();
static {
try
{
System.loadLibrary("hello");
}
catch (Exception E)
{
}
}
Output of jserv.log:
--------------------
[20/09/1999 12:10:33:723] (ERROR) ajp11: Servlet Error:
java.lang.UnsatisfiedLinkError: authenticate: authenticate
[20/09/1999 12:10:33:723] (ERROR) an error returned handling request via
protocol "ajpv11"
And this is the output of Apache error log:
-------------------------------------------
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)
Baris