Showing posts with label servlets. Show all posts
Showing posts with label servlets. Show all posts

Tuesday, April 13, 2010

Servlet load sequence

The  load-on-startup sub-element indicates the order in which each servlet should be loaded. Lower positive values are loaded first. If the value is negative or unspecified, then the container can load the servlet at anytime during startup.
Which is kinda cool, I can give 1 for one servlet which will initialize logging, and a higher number for other servlets which also must be autostarted.


Via http://www.javabeat.net/tips/166-load-on-startup-element-in-webxml.html

Sunday, January 3, 2010

Servlets cannot look into their own install directory? Solution.

This applies to a Tomcat 5.5 installation running on a Ubuntu 8.04 server (and, all Ubuntu versions I know).

If you write a servlet that needs to read a file which is in the servlet's WEB-INF directory, for instance, a config.xml, Tomcat, or more precisely, the Java Security Manager will not let you.

(Interestingly, Tomcat that comes with CentOS, will do. Hmm.)

What I did is turning off the security manager in the /etc/init.d/tomcat5.5 file.

Task for the rest of the week: find out how to enable the required thing without turning off the Security Manager.