i get
No data received
Unable to load the webpage because the server sent no data.
i have doubt here , Has tomcat been shutdown here ? because when again i issue http://localhost:8090/index.html i get the home .page.
i should not get home page here.
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2329
posted
0
It's not HTTP listening on that port; it's waiting for the string "SHUTDOWN". You can use a tool like nc (on Unix/Linux) to accomplish that, something like "nc -p 8005 SHUTDOWN" (I think, the syntax for piping the text may be off)). Or use the shutdown script that comes with Tomcat.
i found 2 jar file named as bootstrap.jar and tomcat-juli.jar .And 2 more exe file.inside \lib.when i execute bootstrap.jar, the tomcat shutdown itself.
i am working on a code to develop a servlet container. as a part o process i am leaning the inner mechanics of the Tomcat container.
I was just curious who issues that SHUTDOWN command and how.
Now it seems that the code for shutting down the Tomcat has been included in a script file.
but if Tomcat is listening on 8005 for SHUTDOWN command , shouldn't there be a way to get to the port 8005 and issue shut down command ?
I think you could telnet to localhost 8005 from command prompt, and type SHUTDOWN<ENTER>. Also, I think I remember that this worked only in the physical box. Somehow, it didn't respond when I tried telnet-ing from another m/c. But I am not sure if I remember correctly.
Accessing http://localhost:8005/SHUTDOWN may not be same as this. You are sending a HTTP request to fetch a URL, rather than sending a command at the port.
I am not sure of the details of how HTTP differs from telnet but I am sure it does. Can somebody post a proper explanation ?
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2329
posted
0
naveen yadav wrote:but if Tomcat is listening on 8005 for SHUTDOWN command , shouldn't there be a way to get to the port 8005 and issue shut down command ?
That is exactly what Bear and myself talked about. Did our replies make sense to you?
Saikat Roy Mahasay wrote:I think you could telnet to localhost 8005 from command prompt
Tomcat does not run a telnet server on the shutdown port, so that won't work.
Tomcat does not run a telnet server on the shutdown port, so that won't work.
I do not know what tomcat runs on shutdown port, but it used to be possible to telnet to it and type shutdown. In fact this page shows some nice screenshots to demonstrate a solution to this potential problem
Telnet is a "dumb terminal" program. When you connect to a server/port in telnet, what you type in goes straight to the other end, and any response from the other end goes straight to the console (or more accurately, stdout).
HTTP is a more complicated protocol. You can issue an HTTP GET via telnet, because the "GET" command itself is a single line of text. However, HTTP as practiced from a web browser includes not only the HTTP command, it also includes additional text lines such as the headers (which include the cookies), and in the case of POST, the form data. Since this constitutes multiple lines and the telnet command is normally expecting to initiate transmission when you hit the first end-of-line character, that makes using telnet as a "web browser" rather awkward. More so, even, because telnet stays connected continously, whereas HTTP connects and disconnects on a per-request basis.
Still, telnet is a useful way to test an HTTP or email server and even to do limited REST functions.
How well it can handle pushing a "SHUTDOWN" command to Tomcat, I don't know. A lot depends on how Tomcat handles that end-of-line character. However, as was mentioned, the "netcat" (nc) command can copy data byte-for-byte, so if telnet doesn't work, try it.
Another possibility is to employ one of the J2EE management protocols. JSR-88 defines a control and deployment protocol that can be used, for example. I think that there's a newer version, but I don't know what JSR number it is. Likewise, JSR-77 (?) defined a J2EE control standard.
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"