OK, I caught an Error on statement
out.println(nativeHelloMethod()); ]
it is
java.lang.UnsatisfiedLinkError: nativeHelloMethod
at NativeHelloWorldServlet.service(NativeHelloWorldServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:611)
at com.livesoftware.jrun.JRun.runServlet(Compiled Code)
at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java)
at
com.livesoftware.jrun.JRunGeneric.handleProxyConnection(JRunGeneric.java)
at
com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(JRunProxyServiceHandler.java)
at com.livesoftware.jrun.service.ThreadConfigHandler.run(Compiled Code)
I think the OS running JRun cannot find the proper DLL to locate the
nativeHelloMethod(). But I've put the DLL into the include in the System
and User environment. Can anyone help?
Thank you!
"P.Yesudason" wrote:
>
> Why dont you catch the exception and send to us ..
> Then let us start to Investigate
>
> Yesudas
>
> Xizhen Wang wrote:
>
> > Hi! I let my servlet call a C function with JNI. Below is my code:
> >
> > //////////////////////////////////////////////////////////////////////
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > public
> > class NativeHelloWorldServlet extends HttpServlet
> > {
> > public void init(ServletConfig servletConfig) throws
> > ServletException
> > {
> > super.init(servletConfig);
> > try {
> > System.loadLibrary("NativeHelloWorld");
> >
> > } catch(Exception e) {
> > System.err.println("error1");
> > return;
> >
> > } catch(Throwable e) {
> > System.err.println("error2");
> > return;
> > }
> >
> > System.err.println("Successfully loaded DLL");
> > }
> >
> > public native String nativeHelloMethod();
> >
> > public void service(HttpServletRequest req, HttpServletResponse res)
> > throws ServletException, IOException
> > {
> > res.setContentType("text/html");
> > ServletOutputStream out = res.getOutputStream();
> >
> > System.err.println("Still working");
> > out.println(nativeHelloMethod()); //call the native method
> > System.err.println("Finished");
> > }
> > }
> > //////////////////////////////////////////////////////////////////////
> >
> > In the log file, it can print out:
> > "Successfully loaded DLL
> > Still working"
> >
> > But it cannot print out "Finished" and the servlet be loaded in a
> > browser.
> >
> > That means out.println(nativeHelloMethod()) terminate the code
> > abnormally. Actually, if I use usual java code instead of servlet, to
> > call the C function, everything works. So can anyone help me?
> >
> > Thank you!
> >
> > --
> > Xizhen
> >
> > https://www.alladvantage.com/home.asp?refid=ANI887
> > https://secure.paypal.com/refer/pal=delate%40hotmail.com
> >
> > ___________________________________________________________________________
> > 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
>
> --
> I am free and have a destination too far,
> .... I will keep flying.
--
Xizhen
https://www.alladvantage.com/home.asp?refid=ANI887
https://secure.paypal.com/refer/pal=delate%40hotmail.com
___________________________________________________________________________
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