posted 13 years ago
If nothing is actively listening on port 8080 (or whatever port you've assigned to Tomcat), there's no way to startup Tomcat just because a request has been directed to that port. In order for a request to be processed, it needs to be routed to an app by the OS network stack.
There are actually 2 ways of doing that.
The first way is for an application to already be listening and waiting for incoming traffic.
The second way is to delegate the listening job to a dispatcher app. This app does the listening for you, then launches the target server app and routes the request to the launched app. This approach is known as the "super-server" approach, and on Unix/Linux, is handled by a daemon known as inetd (or xinetd in newer versions).
The super-server approach isn't viable for Tomcat, since it would require launching Tomcat on every incoming request, and even a simple app in a minimal Tomcat requires a LOT of overhead to setup and start. The hits on the hardware would be major and the delays would be intolerable. The super-server isn't used that much these days since the discrepancy between launching apps versus having them listen is now significant and the need to spare memory by not running listeners full-time is minimal. The super-server was never intended to manage heavy-duty apps, anyway. It's best for lightweight infrequent processes.
So, to summarize, you do need a Tomcat up and running!
When you start talking about closing windows and having Tomcat shutdown, you're pretty much admitting that you're running Tomcat under Microsoft Windows. There are ways in Windows to run Tomcat without the need to keep it in an open Window. Several of them, in fact, including options on the START command.
The most popular way, however, is to run Tomcat as a Windows Service. The additions required to run Tomcat as a Windows Service are packaged with the Windows version of Tomcat. Using that feature, you can start Tomcat automatically when the machine starts up. Or manually from the Windows service manager, if you prefer.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.