tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Hirner" <andr...@projektinter.net>
Subject Re: Native library cannot be loaded twice
Date Mon, 24 Jun 2002 11:42:50 GMT


Hi

> Yes. But have you ensured that your native library and its
dependends
> are in the java.library.path ?
>
> Hermod

Tomcat runs on linux and the path of the native library is set via the
LD_LIBRARY_PATH variable. If I load the native library in the servlet,
the library is accessed correctly and does what it is supposed to do.
However, when I initialise the library in the InitMapserver class and
call it in the servlet via the class.forName method (see below) the
servlet does not work properly.

Andreas

############################################

> ok, I realised that I cannot load a native library twice. So I wrote
> and compiled a class called InitMapserver, which looks like that:
>
>
>  public class InitMapserver
>  {
>
>   static {
>    try {
>       System.loadLibrary("mapscript");
>       System.err.println("libmapscript.so loaded");
>    } catch (UnsatisfiedLinkError e) {
>       System.err.println("libmapscript.so not loaded: " + e);
>    }
>   }
>
>  }
>
> and put it into the common/classes directory. Then I try to load
this
> class in a servlet
> doing:
>
>  public void init(ServletConfig config) throws ServletException
>  {
>
>   try
>   {
>      Class.forName("InitMapserver");
>   } catch (ClassNotFoundException ex) {
>      file://throw new ServletException(ex.getMessage() + "Class
> InitMapserver not     found");
>      System.err.println(ex.getMessage() + "Class InitMapserver not
> found");
>   }
>  }




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message