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
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. Rashmi Rubdi-2 wrote: > > Please ignore my previous post. > > Sorry, when you mentioned context.xml I was thinking of the one > located under the project's META-INF folder. > > Chuck is right, there's no need to move the contents of the > conf/context.xml file anywhere. > > Whenever configuration gets messed up (happens very rarely), I > normally start with a fresh install of the zip version of Tomcat after > backing up the existing version. This process normally fixes my > problems quickly with little effort. > > -Regards > Rashmi > > On 4/29/07, sc <[EMAIL PROTECTED]> wrote: >> >> I tried as you suggested. But didn't work. I have cleaned up tomcat >> deployment directories and currently the configuration is very simple. >> >> Under $CATALINA_HOME/webapps, there is only one directory ROOT. >> Under $CATALINA_HOME/Catalina, there is only one directory "localhost", >> which in turn only contains 1 file trip.xml >> >> <?xml version='1.0' encoding='utf-8'?> >> <Context docBase="d:/dev/trip/main/build"> >> <Resource name="jdbc/trip" auth="Container" >> type="javax.sql.DataSource" >> username="sa" >> password="xxxxx" >> driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" >> url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=trip" >> maxActive="8" >> maxIdle="4"/> >> >> <WatchedResource>WEB-INF/web.xml</WatchedResource> >> <!-- Note: as suggested, I have moved the above entry from context.xml >> over >> here. --> >> <Logger className="org.apache.catalina.logger.FileLogger" >> prefix="local_cutetrip." suffix=".log" >> timestamp="true"/> >> >> </Context> >> >> $CATALINA_HOME/conf/server.xml is as following: >> >> <Server port="8005" shutdown="SHUTDOWN"> >> >> <Listener className="org.apache.catalina.core.AprLifecycleListener" /> >> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" >> /> >> <Listener >> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" >> /> >> <Listener >> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> >> >> <GlobalNamingResources> >> >> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> >> >> <Resource name="UserDatabase" auth="Container" >> type="org.apache.catalina.UserDatabase" >> description="User database that can be updated and saved" >> factory="org.apache.catalina.users.MemoryUserDatabaseFactory" >> pathname="conf/tomcat-users.xml" /> >> >> </GlobalNamingResources> >> >> <Service name="Catalina"> >> >> <Connector port="8080" maxHttpHeaderSize="8192" >> maxThreads="150" minSpareThreads="25" maxSpareThreads="75" >> enableLookups="false" redirectPort="8443" acceptCount="100" >> connectionTimeout="20000" disableUploadTimeout="true" /> >> >> <Connector port="8009" >> enableLookups="false" redirectPort="8443" >> protocol="AJP/1.3" >> /> >> >> <Engine name="Catalina" defaultHost="localhost"> >> >> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" >> resourceName="UserDatabase"/> >> >> >> <Host name="localhost" appBase="webapps" >> unpackWARs="true" autoDeploy="true" >> xmlValidation="false" xmlNamespaceAware="false"> >> >> </Host> >> >> </Engine> >> >> </Service> >> >> </Server> >> >> $CATALINA_HOME/conf/context.xml is: >> <Context> >> </Context> >> >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Context-started-twice-tf3664516.html#a10248444 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]