Re: Virtual hosting and mod_jk
Hi, Thank you for your help. Unfortunately I had already solved the problem myself. The only thing I did is uncomment the folowing line in the httpd.conf Include /usr/local/tomcat/conf/auto/mod_jk.conf and replace with the following block, so that the automatic configuration is disabled. IfModule mod_jk.c JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel error /IfModule Cheers Andreas - Original Message - From: Eric Ricker [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 3:40 PM Subject: Re: Virtual hosting and mod_jk Alias myapplications /your/path/here/tomcat/webapps/myapplications slap that in your httpd.conf and you should be happy. -- Eric Ricker [EMAIL PROTECTED] - Original Message - From: Andreas Hirner [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 5:43 AM Subject: Virtual hosting and mod_jk Hello, I have successfully integrated tomcat (4.0.6) with apache (1.3.26) on linux and I am able to access a single virtual host (e.g. myapplication) located in the tomcat/webapps/myapplication directory using a url like that: http://www.mydomain.com/myapplication/index.jsp However I would like to be able to access the files in that directory without using the path /myapplication, i.e. http://www.mydomain.com/index.jsp I have been playing around with the configuration files but I have not been able to alter the configuration according to my needs. Does anybody know if this is possible? Thanks in advance. Andreas PS: The relevant sections of httpd.conf and server.xml are listed below. http.conf # VirtualHost *:80 ServerName meinfotoalbum.com ServerAlias www.meinfotoalbum.com DocumentRoot /usr/local/tomcat/mywebapps/meinfoto Directory /usr/local/tomcat/mywebapps/meinfoto DirectoryIndex index.htm index.html Options Indexes FollowSymLinks /Directory #mod_jk link to tomcat JkMount / ajp13 JkMount /*jsp ajp13 #prohibit access of WEB-INF Location /WEB-INF/ AllowOverride None deny from all /Location #prohibit access of META-INF Location /META-INF/ AllowOverride None deny from all /Location /VirtualHost server.xml Host name=meinfotoalbum.com debug=0 appBase=mywebapps unpackWARs=true Aliaswww.meinfotoalbum.com/Alias Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=meinfotoalbum_log. suffix=.txt timestamp=true / Context path= docBase=meinfoto debug=0 reloadable=false/ Listener className=org.apache.ajp.tomcat4.config.ApacheConfig append=true / /Host -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Virtual hosting and mod_jk
Hi, That may have solved the problem, but now you are limited to serving that application on that domain, only. If you add anything more (another domain name, another application, etc) you will want to understand how to use virtual hosts and the JkMount statement in httpd.conf. John I guess John is right. The whole thing does not make any sense without the entry in the virtual host section of httpd.conf. I simply forgot to include it as well. Here it is. # #mod_jk link to tomcat # JkMount /*.jsp ajp13 JkMount /app/* ajp13 #JkMount /servlet/* ajp13 #prohibit access of WEB-INF # Location /WEB-INF/ AllowOverride None deny from all /Location #prohibit access of META-INF # Location /META-INF/ AllowOverride None deny from all /Location -Original Message- From: Andreas Hirner [mailto:[EMAIL PROTECTED]] Sent: Friday, January 10, 2003 4:26 AM To: Tomcat Users List Subject: Re: Virtual hosting and mod_jk Hi, Thank you for your help. Unfortunately I had already solved the problem myself. The only thing I did is uncomment the folowing line in the httpd.conf Include /usr/local/tomcat/conf/auto/mod_jk.conf and replace with the following block, so that the automatic configuration is disabled. IfModule mod_jk.c JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel error /IfModule Cheers Andreas - Original Message - From: Eric Ricker [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 3:40 PM Subject: Re: Virtual hosting and mod_jk Alias myapplications /your/path/here/tomcat/webapps/myapplications slap that in your httpd.conf and you should be happy. -- Eric Ricker [EMAIL PROTECTED] - Original Message - From: Andreas Hirner [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 5:43 AM Subject: Virtual hosting and mod_jk Hello, I have successfully integrated tomcat (4.0.6) with apache (1.3.26) on linux and I am able to access a single virtual host (e.g. myapplication) located in the tomcat/webapps/myapplication directory using a url like that: http://www.mydomain.com/myapplication/index.jsp However I would like to be able to access the files in that directory without using the path /myapplication, i.e. http://www.mydomain.com/index.jsp I have been playing around with the configuration files but I have not been able to alter the configuration according to my needs. Does anybody know if this is possible? Thanks in advance. Andreas PS: The relevant sections of httpd.conf and server.xml are listed below. http.conf # VirtualHost *:80 ServerName meinfotoalbum.com ServerAlias www.meinfotoalbum.com DocumentRoot /usr/local/tomcat/mywebapps/meinfoto Directory /usr/local/tomcat/mywebapps/meinfoto DirectoryIndex index.htm index.html Options Indexes FollowSymLinks /Directory #mod_jk link to tomcat JkMount / ajp13 JkMount /*jsp ajp13 #prohibit access of WEB-INF Location /WEB-INF/ AllowOverride None deny from all /Location #prohibit access of META-INF Location /META-INF/ AllowOverride None deny from all /Location /VirtualHost server.xml Host name=meinfotoalbum.com debug=0 appBase=mywebapps unpackWARs=true Aliaswww.meinfotoalbum.com/Alias Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=meinfotoalbum_log. suffix=.txt timestamp=true / Context path= docBase=meinfoto debug=0 reloadable=false/ Listener className=org.apache.ajp.tomcat4.config.ApacheConfig append=true / /Host -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Virtual hosting and mod_jk
Hello, I have successfully integrated tomcat (4.0.6) with apache (1.3.26) on linux and I am able to access a single virtual host (e.g. myapplication) located in the tomcat/webapps/myapplication directory using a url like that: http://www.mydomain.com/myapplication/index.jsp However I would like to be able to access the files in that directory without using the path /myapplication, i.e. http://www.mydomain.com/index.jsp I have been playing around with the configuration files but I have not been able to alter the configuration according to my needs. Does anybody know if this is possible? Thanks in advance. Andreas PS: The relevant sections of httpd.conf and server.xml are listed below. http.conf # VirtualHost *:80 ServerName meinfotoalbum.com ServerAlias www.meinfotoalbum.com DocumentRoot /usr/local/tomcat/mywebapps/meinfoto Directory /usr/local/tomcat/mywebapps/meinfoto DirectoryIndex index.htm index.html Options Indexes FollowSymLinks /Directory #mod_jk link to tomcat JkMount / ajp13 JkMount /*jsp ajp13 #prohibit access of WEB-INF Location /WEB-INF/ AllowOverride None deny from all /Location #prohibit access of META-INF Location /META-INF/ AllowOverride None deny from all /Location /VirtualHost server.xml Host name=meinfotoalbum.com debug=0 appBase=mywebapps unpackWARs=true Aliaswww.meinfotoalbum.com/Alias Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=meinfotoalbum_log. suffix=.txt timestamp=true / Context path= docBase=meinfoto debug=0 reloadable=false/ Listener className=org.apache.ajp.tomcat4.config.ApacheConfig append=true / /Host -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
mod_jk configuration
Hello, I have successfully integrated tomcat (4.0.6) with apache (1.3.26) on linux and I am able to access a single virtual host (e.g. myapplication) located in the tomcat/webapps/myapplication directory using a url like that: http://www.mydomain.com/myapplication/index.jsp However I would like to be able to access the files in that directory without using the path /myapplication. I have been playing around with the configuration files but I have not been able to alter the configuration according to my needs. Does anybody know if this is possible? Thanks in advance. Andreas PS: The relevant sections of httpd.conf and server.xml are listed below. http.conf # VirtualHost *:80 ServerName meinfotoalbum. ServerAlias www.meinfotoalbum.com DocumentRoot /usr/local/tomcat/mywebapps/meinfoto Directory /usr/local/tomcat/mywebapps/meinfoto/ DirectoryIndex index.htm index.html Options Indexes FollowSymLinks /Directory #mod_jk link to tomcat JkMount / ajp13 JkMount /* ajp13 #prohibit access of WEB-INF Location /WEB-INF/ AllowOverride None deny from all /Location #prohibit access of META-INF Location /META-INF/ AllowOverride None deny from all /Location /VirtualHost server.xml Host name=meinfotoalbum.com debug=0 appBase=mywebapps unpackWARs=true Aliaswww.meinfotoalbum.com/Alias Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=meinfotoalbum_log. suffix=.txt timestamp=true / Context path= docBase=meinfoto debug=0 reloadable=false/ Listener className=org.apache.ajp.tomcat4.config.ApacheConfig append=true / /Host -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
taglibs and application context
Hello, I have set an attribute like this: request.setAttribute(Constants.VARIABLE_KEY, variable); now I would like retreive that variable in a taglib. But if call it via variable = (String)pageContext.getServletContext().getAttribute(Constants.VARIABL E_KEY); the variable is null Waht's wrong? Thanks Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
Hi Andy, I am working on Linux. I used your advice and copied the native library in the /usr/java/jre/lib/i386/client/ directory and still got the same problem. Do you know where I can set the properties for the library path? Thanks Andreas Andreasm, By the way, the java library path is completely different from the system library path. I've got mine in /usr/j2sdk1.4.0/jre/lib/i386/client/myLibrary.so , which is a default library location for java (obviously you may have to amend the start of the path slightly for your installation). I guess the same path offset will apply under windows - I disn't see which platform you're using. Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 24 June 2002 11:33 To: [EMAIL PROTECTED] Subject: SV: Native library cannot be loaded twice Hi Yes. But have you ensured that your native library and its dependends are in the java.library.path ? Hermod -Opprinnelig melding- Fra: Andreas Hirner [mailto:[EMAIL PROTECTED]] Sendt: 24. juni 2002 12:33 Til: Tomcat Users List Kopi: [EMAIL PROTECTED] Emne: SV: Native library cannot be loaded twice Hi, Usatisfied link error means that it is not finding it or something it relies on. Hermod Ok. But in order to make sure I loaded the native library successfully, would you agree with me that I took the right steps? I am not that familiar with tomcat and appreciate any hint. Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
Hallo Franz, Concerning the JDK documentation a native lib should be loaded in a static scope. Static resources are processed differently, because the runtime systems has to initialize all static resources at the beginning. After that the runtime system tries to initialize objects and these objects can - of course - use all static resources. A look into your code (InitMapserver) shows, that the runtime system cannot initialize the static resource in the common way, because it first must generate an object and this object contains code for doing some static stuff. Maybe this is the reason for the strange behavior. I am sorry, but I am not a skilled Java Programmer and I don't quite understand what you mean. Can you try to explain it more explicitly or give some examples. I hope I am not asking to much Thanks Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
Hi, A bit off-topic (this goes into native programming), but there is something whirling through my head: Static classes/members are instantiated once. But what happens if multiple classloaders are used? Such as you have this one class static but use it in several web applications? Seems like it MUST reside in common/lib instead of webapp/*/web-inf/lib? Hiran This is where my problem is. I was developing a servlet, which loaded a native library and subsequently called some native functions. Everything was working fine, but whenever I made changes to the servlet and reloaded the application with the manager/relaod call the native library was instanciated a second time and crashed. I had to stop and restart tomcat in order to see any changes made to the servlet. 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); } } Unfortunately this does not work. Any suggestions??? Thanks Andreas Concerning the JDK documentation a native lib should be loaded in a static scope. Static resources are processed differently, because the runtime systems has to initialize all static resources at the beginning. After that the runtime system tries to initialize objects and these objects can - of course - use all static resources. A look into your code (InitMapserver) shows, that the runtime system cannot initialize the static resource in the common way, because it first must generate an object and this object contains code for doing some static stuff. Maybe this is the reason for the strange behavior. I am sorry, but I am not a skilled Java Programmer and I don't quite understand what you mean. Can you try to explain it more explicitly or give some examples. I hope I am not asking to much -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
Hi Hermod Again, as I said earlier - Have you checked that the java.library.path has is pointing to where your native library is. The reason you are seeing this, is that when loading through common/classes it is the system classloader (different from the application classloader) that loads it. Try altering the startupfile for catalina adding : -Djava.library.path=.. I got some advice earlier saying that the default directory for the java.library.path is /usr/java/jre/lib/i386/client. I copied the library into that directory and gave it another try. It didn't work. Now I added the following line in the start block in catalina.sh -Djava.library.path=/usr/local/mapserver \ (that's where the library is) restartet tomcat and still no success. Andreas A bit off-topic (this goes into native programming), but there is something whirling through my head: Static classes/members are instantiated once. But what happens if multiple classloaders are used? Such as you have this one class static but use it in several web applications? Seems like it MUST reside in common/lib instead of webapp/*/web-inf/lib? Hiran This is where my problem is. I was developing a servlet, which loaded a native library and subsequently called some native functions. Everything was working fine, but whenever I made changes to the servlet and reloaded the application with the manager/relaod call the native library was instanciated a second time and crashed. I had to stop and restart tomcat in order to see any changes made to the servlet. 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); } } Unfortunately this does not work. Any suggestions??? Thanks Andreas Concerning the JDK documentation a native lib should be loaded in a static scope. Static resources are processed differently, because the runtime systems has to initialize all static resources at the beginning. After that the runtime system tries to initialize objects and these objects can - of course - use all static resources. A look into your code (InitMapserver) shows, that the runtime system cannot initialize the static resource in the common way, because it first must generate an object and this object contains code for doing some static stuff. Maybe this is the reason for the strange behavior. I am sorry, but I am not a skilled Java Programmer and I don't quite understand what you mean. Can you try to explain it more explicitly or give some examples. I hope I am not asking to much -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that DnB cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
Hi Charlie, did you restart tomcat since your class is in common/classes? Yes, I did. you may want to wrap the loadlibrary() in a singleton. I'm not sure that you can use Class.forName on a class with no methods or fields. You may also want to see if the native functions are available even if the Class.forName is throwing an error. The static block should be run automatically by the classloader, but I'm not sure if it does this when the class is loaded, or when it is first called. you do want your class in /common/classes so that it can only be loaded once. This is very important because I would like to access the library from several different applications. I have my library on the system path(win2k) and it works fine. If you had it working before(if only the first time), then the library was in the right place. This is the part that's giving me a headache. I don't know why it makes a difference if initialise it in static block in a servlet or my InitMapserver class. Andreas -Original Message- From: Andreas Hirner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 7:41 AM To: Tomcat Users List Cc: [EMAIL PROTECTED] Subject: Re: Native library cannot be loaded twice Hi, A bit off-topic (this goes into native programming), but there is something whirling through my head: Static classes/members are instantiated once. But what happens if multiple classloaders are used? Such as you have this one class static but use it in several web applications? Seems like it MUST reside in common/lib instead of webapp/*/web-inf/lib? Hiran This is where my problem is. I was developing a servlet, which loaded a native library and subsequently called some native functions. Everything was working fine, but whenever I made changes to the servlet and reloaded the application with the manager/relaod call the native library was instanciated a second time and crashed. I had to stop and restart tomcat in order to see any changes made to the servlet. 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); } } Unfortunately this does not work. Any suggestions??? Thanks Andreas Concerning the JDK documentation a native lib should be loaded in a static scope. Static resources are processed differently, because the runtime systems has to initialize all static resources at the beginning. After that the runtime system tries to initialize objects and these objects can - of course - use all static resources. A look into your code (InitMapserver) shows, that the runtime system cannot initialize the static resource in the common way, because it first must generate an object and this object contains code for doing some static stuff. Maybe this is the reason for the strange behavior. I am sorry, but I am not a skilled Java Programmer and I don't quite understand what you mean. Can you try to explain it more explicitly or give some examples. I hope I am not asking to much -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Native library cannot be loaded twice
Hello, I have a problem calling a native library within a servlet. The library is initialised like that: static { try { System.loadLibrary(mapscript); System.err.println(libmapscript.so loaded); } catch (UnsatisfiedLinkError e) { System.err.println(libmapscript.so not loaded: + e); } } Everything works fine. However, if I make changes to the servlet and reload it via the http://localhost:8080/manager/reload?path=/application call, and ececute the servlet doing http://localhost:8080/application/servlet/servletname I get the following error message listed below. I have to restart Tomcat in order to check any changes made to the servlet. Does anybody know how to solve this problem? Thank you in advance Andy Error Message exception javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli cationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi lterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa lve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa lve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2 344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja va:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher Valve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja va:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:4 62) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv e.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor .java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.jav a:1106) at java.lang.Thread.run(Thread.java:484) root cause java.lang.UnsatisfiedLinkError: get_FTString at edu.umn.gis.mapscript.mapscript.get_FTString(Native Method) at edu.umn.gis.mapscript.mapscript.(mapscript.java:767) at edu.umn.gis.mapscript.mapObj.(mapObj.java:227) at demo.doGet(demo.java:75) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli cationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi lterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa lve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa lve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2 344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja va:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher Valve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja va:170) at
RE: Native library cannot be loaded twice
Hi, 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); } } But I still get the same error message (see below). Thanx Andreas Error Message javax.servlet.ServletException: Invoker service() exception at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServle t.java:504) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java: 180) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli cationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi lterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa lve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa lve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2 344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja va:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher Valve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja va:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:4 62) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv e.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor .java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.jav a:1106) at java.lang.Thread.run(Thread.java:484) - Root Cause - java.lang.UnsatisfiedLinkError: get_FTString at edu.umn.gis.mapscript.mapscript.get_FTString(Native Method) at edu.umn.gis.mapscript.mapscript.clinit(mapscript.java:767) at edu.umn.gis.mapscript.mapObj.init(mapObj.java:227) at TestLoadLib.doGet(TestLoadLib.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServle t.java:446) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java: 180) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli cationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi lterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa lve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline. java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa lve.java:201)
SV: Native library cannot be loaded twice
Hi, Usatisfied link error means that it is not finding it or something it relies on. Hermod Ok. But in order to make sure I loaded the native library successfully, would you agree with me that I took the right steps? I am not that familiar with tomcat and appreciate any hint. Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Native library cannot be loaded twice
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:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: Native library cannot be loaded twice
Hi, What kind of native library are you loading ? (Sorry, I don't know the former emails!) I am working on Linux and set the path to the shared C library using the LD_LIBRARY_PATH. If you working on Unix and you are loading a shared lib you must ensure that the path to the lib is know to the tomcat process. Either you configure the tomcate environment (catalina) or use the LD_LIBRARY_PATH environment variable. Manipulating an environment variable is not the best idea because it effects the whole system - and this is neither allowed nor requested. This should also work for Windows where the path to the dll must be provided either in the catalina.bat file or by modifying the system wide path. The problem is, that I can load the library in the servlet and make it work. However if I change the servlet and reload the application via manager/reload command, the library is loaded a second time and thus causes a conflict. I have to start the application to view any changes, which is rather cumbersome if you are still developing. That's why I wrote the InitMapserver class and called it from the servlet in the Class.forName() method. Looking at your second mail: A look into your code (InitMapserver) shows, that the runtime system cannot initialize the static resource in the common way, because it first must generate an object and this object contains code for doing some static stuff. Maybe this is the reason for the strange behavior How do I go about this. Do I have use a constructor? Thanx Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
how do I load a native library?
Hi, I would like to load a native library for all applications in the common/lib directory. So I wrote the following code: 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); } } } then I created a jar file and copied it into the common/lib directory. After restarting tomcat, I called the class in a servlet using the Class.forName method. Unfortunately this does not work. What did I wrong? Thanks Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: how do I load a native library?
Hi Unless I am missing something, it looks like it should work. is mapscript the name of your dll? I am working on Linux, so the shared library is called libmapscript.so Is mapscript.dll in your PATH? as far as I am concerned the path to shared libraries is set in the LD_LIBRARY_PATH variable and this is what I did. If I inculde the static block listed in script below in a servlet and call the native methods it works. That's why I think that the mistake has something to do with way I call library in the InetMapserver class. Thanks Andreas Hi, I would like to load a native library for all applications in the common/lib directory. So I wrote the following code: 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); } } } then I created a jar file and copied it into the common/lib directory. After restarting tomcat, I called the class in a servlet using the Class.forName method. Unfortunately this does not work. What did I wrong? Thanks Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: how do I load a native library?
Hi Robert, Well, I am running on W2k box. We also call System.loadLibrary in our code, and we don't have any problem. Our classes are in common\lib also: static { System.loadLibrary(STR_LIBRARY); isLoaded = true; } Also, I believe that even if you do call System.loadLibrary in multiple places, the subsequent calls will be ignored. That''s the problem. If I include the static block in a servlet and exute it, everything works fine. But if I make changes to the servlet and reload it using the manager/reload function and call the servlet again it crashes. Thats why I am trying to put the the loadLibrary call further up in the hierarchy. Could be that weird Tomcat Classloader/Library issue. You could try sticking you InitMapServer.class (or jar) in the common/lib AND any class that needs to call it, also stick that in common/lib (or class, whatever the case may be). The point being that any class that uses it (InitMapServer) is being loaded by the same classloader. This is the piece of code I used in the servlet instead of the static block to load InitMapscript public void init(ServletConfig config) throws ServletException { try { Class.forName(InitMapserver); } catch (ClassNotFoundException ex) { throw new ServletException(ex.getMessage() + Class InitMapserver not found); file://System.err.println(ex.getMessage() + Class InitMapserver not found); } } and I think this call does not load the native library correctly because I get a UnsatisfiedLinkError exception after calling the first native method. Cheers Andy -Original Message- From: Andreas Hirner [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 1:33 PM To: Tomcat Users List Cc: [EMAIL PROTECTED] Subject: Re: how do I load a native library? Hi Unless I am missing something, it looks like it should work. is mapscript the name of your dll? I am working on Linux, so the shared library is called libmapscript.so Is mapscript.dll in your PATH? as far as I am concerned the path to shared libraries is set in the LD_LIBRARY_PATH variable and this is what I did. If I inculde the static block listed in script below in a servlet and call the native methods it works. That's why I think that the mistake has something to do with way I call library in the InetMapserver class. Thanks Andreas Hi, I would like to load a native library for all applications in the common/lib directory. So I wrote the following code: 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); } } } then I created a jar file and copied it into the common/lib directory. After restarting tomcat, I called the class in a servlet using the Class.forName method. Unfortunately this does not work. What did I wrong? Thanks Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]