On 4/30/07, sc <[EMAIL PROTECTED]> wrote:
As you suggested, I started from scratch. I downloaded tomcat 6 from apache.org. changed $catalina_home to point to the new directory. Under $catalina_home/webapps, I created a new folder, which only has one servlet TestServlet
Do a global search on your projects and also on C: or Home drive to see if this line of code is defined in an additional Servlet that is visible to the current installation of Tomcat: log.info("TestServlet init"); I know you mentioned that there's only one Servlet under webapps, but just in case... I also see super.init(config); but that shouldn't cause the TestServlet's init method to be called twice.
public class TestServlet extends HttpServlet { private Log log = LogFactory.getLog(this.getClass().getName()); //public void init() throws ServletException public void init(ServletConfig config) throws ServletException { super.init(config); log.info("TestServlet init"); } public void destroy() { log.info("TestServlet destroy"); } } My web.xml as following: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version="2.5"> <display-name>Hello, World Application</display-name> <description> This is a simple web application with a source code organization based on the recommendations of the Application Developer's Guide. </description> <servlet> <servlet-name>test</servlet-name> <servlet-class>com.trip.view.TestServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/test</url-pattern> </servlet-mapping> </web-app> I didn't do any changes to the new installation of tomcat. Then I started tomcat and shutdown it. The log showed the following entries: 2007-04-30 12:35:27,968 [main] INFO com.cutetrip.view.TestServlet - TestServlet init 2007-04-30 12:35:27,968 [main] INFO com.cutetrip.view.TestServlet - TestServlet init 2007-04-30 12:35:40,046 [main] INFO com.cutetrip.view.TestServlet - TestServlet destroy 2007-04-30 12:35:40,046 [main] INFO com.cutetrip.view.TestServlet - TestServlet destroy Since I just downloaded Tomcat, it is likely the double init is caused by my application or local environment setting. Anywhere I should look at? I am very puzzled. Thanks.
I will try to replicate this. Regards -Rashmi --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]