servlet load-on-startup/ causes TC 5.0.3 to hang on startup
Tomcat 5.0.3 on W2K hangs on startup whenever I deploy an app whose web.xml has a servlet definition that contains a load-on-startup element, either with or without a number. This happens consistently on my TC installation, which has unpackWARs set to true. Has anyone seen this behavior before? Thanks, Mike -- Mike Woinoski Pine Needle Consulting mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
servlet load-on-startup
Does load-on-startup still work for anyone under 4.1.18? Just wanted to check for now, I'm not sure if it's a problem with jk or with tomcat itself yet. -- Rasputin :: Jack of All Trades - Master of Nuns -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlet load-on-startup
Hi, Works for me. In the proper order too ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Rasputin [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 5:31 AM To: [EMAIL PROTECTED] Subject: servlet load-on-startup Does load-on-startup still work for anyone under 4.1.18? Just wanted to check for now, I'm not sure if it's a problem with jk or with tomcat itself yet. -- Rasputin :: Jack of All Trades - Master of Nuns -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlet load-on-startup
It still works for me, however it seems to work two well.. it seems to get called twice for the same servlet now. not sure why. -Rick -Original Message- From: Rasputin [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 2:31 AM To: [EMAIL PROTECTED] Subject: servlet load-on-startup Does load-on-startup still work for anyone under 4.1.18? Just wanted to check for now, I'm not sure if it's a problem with jk or with tomcat itself yet. -- Rasputin :: Jack of All Trades - Master of Nuns -- 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]
Tomcat 3.2.1 servlet load on startup problem
Hi, I have been following the instructions in the tomcat faq to start a servlet whenever tomcat starts, but with no luck, can someone give me a light? When-ever I start tomcat, the console should beam out a message which says "Servlet Loaded" and set a "appServerPath" variable, however, its just simply not load. I can run the servlet manually with no problem, the console will beam out the message, and set that variable here is the context path in the server.xml of tomcat: Context path="/myDir" docBase="C:\myDir" crossContext="true" debug="0" reloadable="true" trusted="false" /Context Here is the web.xml in the C:\myDir\WEB-INF\: which dezscribes the servlet to load: servlet servlet-nameservletInit_newsgroup/servlet-name servlet-classcom.myservlet.servletInit_newsgroup/servlet-class load-on-startup1/load-on-startup /servlet the servlet is located in C:\myDir\WEB-INF\classes\com\myservlet\ am I missing something? Thanks! servletInit_newsgroup.java
Re: Tomcat 3.2.1 servlet load on startup problem
"Sunny L.S.Chan" wrote: Hi, I have been following the instructions in the tomcat faq to start a servlet whenever tomcat starts, but with no luck, can someone give me a light? When-ever I start tomcat, the console should beam out a message which says "Servlet Loaded" and set a "appServerPath" variable, however, its just simply not load. I can run the servlet manually with no problem, the console will beam out the message, and set that variable here is the context path in the server.xml of tomcat: Context path="/myDir" docBase="C:\myDir" crossContext="true" debug="0" reloadable="true" trusted="false" /Context Here is the web.xml in the C:\myDir\WEB-INF\: which dezscribes the servlet to load: servlet servlet-nameservletInit_newsgroup/servlet-name servlet-classcom.myservlet.servletInit_newsgroup/servlet-class load-on-startup1/load-on-startup /servlet the servlet is located in C:\myDir\WEB-INF\classes\com\myservlet\ am I missing something? You've got all the configuration stuff right ... the problem is in your servlet. Your initialization message is generated in the doGet() method, which is only called when a request actually comes in. If you want to do things when the servlet is first loaded, place that code in the init() method instead. Note that init() does not receive a request object (because it is not called as the result of a request). Therefore, you will need to use some other technique to initialize your "appServerPath" context attribute. A common technique would be to use a servlet initialization parameter that is read in the init method: servlet servlet-nameservletInit_newsgroup/servlet-name servlet-classcom.myservlet.servletInit_newsgroup/servlet-class init-param param-nameserverPath/param-name param-valuehttp://www.mycompany.com:8080/param-value /init-param load-on-startup1/load-on-startup /servlet and then in your servlet: public void init() throws ServletException() { String path = getServletConfig().getInitParameter("serverPath"); getServletContext().setAttribute("appServerPath", path); System.out.println("Servlet loaded"); } Thanks! Craig McClanahan