• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

shutdown command

 
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ranchers,

MY tomcat default home page is at : http://localhost:8090/index.html

since Server is listening the SHUTDOWN COMMAND ON 8005 port , i issue COMMAND like this http://localhost:8005/SHUTDOWN

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.








 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:It's not HTTP listening on that port; it's waiting for the string "SHUTDOWN".



Is it waiting the SHUTDOWN command from Tomcat not from user ?
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone/anything that can get to port 8005 can issue the shutdown request.
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how can one get to 8005 port ?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why aren;'t you just using the scripts included in the bin folder?
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?


 
Greenhorn
Posts: 10
Opera VI Editor Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Saikat Roy Mahasay
Greenhorn
Posts: 10
Opera VI Editor Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

http://www.avajava.com/tutorials/lessons/how-do-i-prevent-people-from-shutting-down-my-tomcat.html
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, in that case I stand corrected. On Unix/Linux it's still fewer keystrokes to use nc, though.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic