Queries on Embedded Tomcat Server
Hi All, I need to run a Embedded Tomcat server in my application. For this, I checked the sample code and docs, and did the needful. My application's main class is ApplicationLoader.java, and in the main() method of my ApplicationLoader.java, I am doing a appLoader.startTomcat(). However, the server which comes up terminates once the main method is complete. How do I make the server run continously ? Any pointers into this ? Thanks, Rafi SM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
Mohamed Rafi S wrote: Hi All, I need to run a Embedded Tomcat server in my application. For this, I checked the sample code and docs, and did the needful. My application's main class is ApplicationLoader.java, and in the main() method of my ApplicationLoader.java, I am doing a appLoader.startTomcat(). However, the server which comes up terminates once the main method is complete. How do I make the server run continously ? Any pointers into this ? How do you start the Emnbedded Tomcat? Are you sure there is no swallowed exception? -- Jeanfrancois Thanks, Rafi SM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
Hi Jean, There is no exception getting thrown, verified this. Immediately after appLoader.startTomcat(), if I give a Thread.sleep(1), then till that duration, I am able to access http://localhost:8080/ successfully without any issue. So, any pointers on how to make this always available ? Thanks, Mohamed Rafi S Mohamed Rafi S wrote: Hi All, I need to run a Embedded Tomcat server in my application. For this, I checked the sample code and docs, and did the needful. My application's main class is ApplicationLoader.java, and in the main() method of my ApplicationLoader.java, I am doing a appLoader.startTomcat(). However, the server which comes up terminates once the main method is complete. How do I make the server run continously ? Any pointers into this ? How do you start the Emnbedded Tomcat? Are you sure there is no swallowed exception? -- Jeanfrancois Thanks, Rafi SM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
Hi, Just my silly guess, Did you do this: tomcat.startTomcat(); ... Thread.sleep(1); tomcat.stopTomcat(); That is you call stopTomcat() right after you "sleep" ? On Tue, 30 Nov 2004 17:47:26 -0800, Mohamed Rafi S <[EMAIL PROTECTED]> wrote: > > Hi Jean, > > There is no exception getting thrown, verified this. Immediately after > appLoader.startTomcat(), if I give a Thread.sleep(1), then till > that duration, I am able to access http://localhost:8080/ successfully > without any issue. > > So, any pointers on how to make this always available ? > > Thanks, > Mohamed Rafi S > > > > > > > > > Mohamed Rafi S wrote: > >> Hi All, > >> I need to run a Embedded Tomcat server in my application. For this, I > >> checked the sample code and docs, and did the needful. > >> My application's main class is ApplicationLoader.java, and in the > >> main() method of my ApplicationLoader.java, I am doing a > >> appLoader.startTomcat(). However, the server which comes up > >> terminates once the main method is complete. How do I make the server > >> run continously ? > >> Any pointers into this ? > > > > How do you start the Emnbedded Tomcat? Are you sure there is no > > swallowed exception? > > > > -- Jeanfrancois > > > > > >> Thanks, > >> Rafi SM > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Peik Feng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
Mohamed Rafi S wrote: Hi Jean, Jeanfrancois ;-) There is no exception getting thrown, verified this. Immediately after appLoader.startTomcat(), if I give a Thread.sleep(1), then till that duration, I am able to access http://localhost:8080/ successfully without any issue. So, any pointers on how to make this always available ? I recommend you start a Thread that start Tomcat and lock on an object. When you stop you app, just unlock thin thread. Hope that help -- Jeanfrancois Thanks, Mohamed Rafi S Mohamed Rafi S wrote: Hi All, I need to run a Embedded Tomcat server in my application. For this, I checked the sample code and docs, and did the needful. My application's main class is ApplicationLoader.java, and in the main() method of my ApplicationLoader.java, I am doing a appLoader.startTomcat(). However, the server which comes up terminates once the main method is complete. How do I make the server run continously ? Any pointers into this ? How do you start the Emnbedded Tomcat? Are you sure there is no swallowed exception? -- Jeanfrancois Thanks, Rafi SM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
Hi, Even when I dont do a appLoader.stopTomcat();, it goes down and is no longer accessible. Thanks, Mohamed Rafi S Hi, Just my silly guess, Did you do this: tomcat.startTomcat(); ... Thread.sleep(1); tomcat.stopTomcat(); That is you call stopTomcat() right after you "sleep" ? On Tue, 30 Nov 2004 17:47:26 -0800, Mohamed Rafi S <[EMAIL PROTECTED]> wrote: Hi Jean, There is no exception getting thrown, verified this. Immediately after appLoader.startTomcat(), if I give a Thread.sleep(1), then till that duration, I am able to access http://localhost:8080/ successfully without any issue. So, any pointers on how to make this always available ? Thanks, Mohamed Rafi S Mohamed Rafi S wrote: Hi All, I need to run a Embedded Tomcat server in my application. For this, I checked the sample code and docs, and did the needful. My application's main class is ApplicationLoader.java, and in the main() method of my ApplicationLoader.java, I am doing a appLoader.startTomcat(). However, the server which comes up terminates once the main method is complete. How do I make the server run continously ? Any pointers into this ? How do you start the Emnbedded Tomcat? Are you sure there is no swallowed exception? -- Jeanfrancois Thanks, Rafi SM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards, Peik Feng - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Queries on Embedded Tomcat Server
My guess is that when running Tomcat embedded within your application, Tomcat provides no non-daemon Threads. The JVM will shut down when the last non-daemon Thread exits, so when your Main method completes, the JVM shuts down. This makes sense, when you consider that embedding Tomcat in an application implies that the application is up and running also. If your simple class is only for testing purposes, then you may want to sleep long enough to do your testing, or read from the console, so it will be "alive" waiting on console input, until you respond, which puts the timeframe under your control. If this simple class is your whole application, then I'd suggest you run Tomcat standalone. Please respond to "Tomcat Users List" <[EMAIL PROTECTED]> To: Tomcat Users List <[EMAIL PROTECTED]> cc: Subject: Re: Queries on Embedded Tomcat Server Hi, Even when I dont do a appLoader.stopTomcat();, it goes down and is no longer accessible. Thanks, Mohamed Rafi S