Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check, TOMCAT is running as welcome page not coming

 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a query of how to check if TOMCAT is running. Can, it be checked from the back-end from the server like linux or from the front-end?

I hope, my question is clear.

Please, help in solving the doubt.

regards
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally I use the Tomcat management application to monitor my system, it tells you a LOT more than just that tomcat is running. You can spot all sorts of memory management and threading problems.

The management app is not part of the normal download as a security precaution.

Bill
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

thanks, for your answer. But, can you suggest any other way than management apps for my scenario?

Please, help.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to monitor your Tomcat server on an ongoing basis or are you trying to debug a new install where you think Tomcat is running but can't load the welcome page in a browser?
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

thanks, for your answer. I am not going to monitot tomcat server on an ongoing basis but am trying to debug a new install.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running Tomcat on a Linux server? Which distribution?
Are you running Tomcat as a service or at the command line?
Did you change the port Tomcat listens to? By default, Tomcat listens to port 8080, so the URL you use in a browser should be http://servername:8080

Try running Netstat to see if something is listening on the port.
Try running ps -a and see if there's a "java" or "jsvc" process running.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tomcat is running on linux. Linux is RHEL release 4. Tomcat seems to be 4.x as the base directory is jakarta-tomcat-4.1.24. Tomcat is run from a script, startup.sh in $TOMCAT_HOME/bin. I guess, tomcat is running on port 10080 as specified in server.xml. Port is specified in server.xml, am I right?
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
randhir sethi wrote:Port is specified in server.xml, am I right?


Yes. Did you check if the port is bound with Netstat?
Have you checked the server logs for errors?
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi,

Below is the output of the netsat command, netsat -anp | grep 10080
--------------------------------------------------------------------------------------------------
#netstat -anp | grep 10080
tcp 0 0 :::10080 :::* LISTEN 15192/java
--------------------------------------------------------------------------------------------------

Our application has the application URL, reports URL, Reseller URL etc. Is it possible that if one of the settings for the URL is not loaded properly, tomcat will not start.

Because, I saw a little of this in catalina.out like:-

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Starting service Tomcat-Standalone
Apache Tomcat/4.1.24
WebappClassLoader: validateJarFile(/opt/dpc/billing501/wars/corereports/reportstool/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
##### [WebReportsInitializationServlet]:Path of Configuration file :/opt/dpc/billing501/wars/corereports/reportstool/xml/DefaultSystemConf.xml
File can't be deleted
File can't be deleted
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I hope, my question is clear.

Please, help in solving the doubt.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


So your problem isn't that Tomcat isn't starting, your problem is your web application isn't being deployed. You need to remove servlet.jar from your WAR. Have a look at this post from yesterday.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, for the answer. In that case, is there is no problem in tomcat starting, can we check for tomcat starting. I am not a developer as such, I am a implementation guy. Where is the build.xml located? It is not in tomcat home.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said, your problem isn't with Tomcat. Your problem is the application you are trying to deploy. There's a servlet.jar file in the application that contains classes which conflict with the versions that Tomcat uses. The post I referred you to mentions build.xml because they use Ant to build their application.
You can either fix your build process to leave servlet.jar out or extract the WAR file, remove the servlet.jar file and rebuild the WAR.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does that mean that tomcat has a dependency to start? If there is a dependency, than both tomcat and deployment of the application have to happen together.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've closed your other topics because you're pretty much just going to go over the same ground we've covered here.

randhir sethi wrote:I guess, I will have to extract the WAR file, remove the servlet.jar file and rebuild the WAR.


A WAR file is just a Zip file that has a specific format see here.
If you are lucky enough to have WinZip, you can open the WAR with it, click on the offending file and press "delete".
If you don't have Winzip, the JDK comes with JAR, which can be used to extract and compress WAR, EAR and JAR files.
Put your WAR file in an empty directory and run JAR:

Remove the offending file and the original WAR, then run:


randhir sethi wrote: I need some good documentation on the working and architecture of TOMCAT.

Tomcat documentation is available at the Tomcat project home page.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I did was that I commented all the contexts like,

----------------------------------------------------------------------------------------------------------------
<!--
<Host name="radius.directonpc.com" debug="0" appBase="/opt/EliteJRadius5.1/web/elitejradiusgui"
unpackWARs="true" autoDeploy="true">

<Context path="" docBase="/opt/EliteJRadius5.1/web/elitejradiusgui" debug="0"
reloadable="false" crossContext="true" />
</Host>
<Host name="jisp.directonpc.com" debug="0" appBase="/opt/dpc/billing501/wars/operations-manager"
unpackWARs="true" autoDeploy="true">

<Context path="" docBase="/opt/dpc/billing501/wars/operations-manager" debug="0"
reloadable="false" crossContext="true" />
</Host>
-->
---------------------------------------------------------------------------------------------------------------

when I start tomcat, I see the following in catalina.out,

--------------------------------------------------------------------------------------------------------
an 30, 2009 4:04:13 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19 config=/opt/jakarta-tomcat-4.1.24/conf/jk2.properties
--------------------------------------------------------------------------------------------------------

But, http://serverip:10080 does not display welcome page.

I hope, my question is clear.

Please, help in solving the doubt.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did it ever display the welcome page?
Do you get an error or a blank page when you try to bring it up?
The reason I ask is that with Ubuntu, my chosen Linux distro, the welcome page is in a different package than the server. You may want to check your repository.
I am using Tomcat 5.5, but I think this still applies for 4: Check $TOMCAT_HOME/webapps for a directory named ROOT. If ROOT is missing, you will not get a welcome page.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, I copied it from the live server where it is working. It never displayed the welcome page on this server. The Page is like 'Internet Explorer cannot display the webpage'. I checked, ROOT directory is there.
 
Galen Palmer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option for a quick check. Under linux (or a mac) terminal:



should show a tomcat process running.



 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it shows,

ps -ef | grep tomcat
root 26047 1 0 17:59 pts/1 00:00:05 /opt/j2sdk1.4.2_06/bin/java -Xms512m -Xmx768m -XX:PermSize=164m -XX:MaxPermSize=768m -Djava.awt.headless=true -Djava.endorsed.dirs=/opt/jakarta-tomcat-4.1.24/common/endorsed -classpath /opt/j2sdk1.4.2_06/lib/tools.jar:/opt/jakarta-tomcat-4.1.24/bin/bootstrap.jar:/opt/jakarta-tomcat-4.1.24/lib/pja.jar:/opt/jakarta-tomcat-4.1.24/lib/bfograph.jar:/opt/jakarta-tomcat-4.1.24/lib/pjatools.jar -Dcatalina.base=/opt/jakarta-tomcat-4.1.24 -Dcatalina.home=/opt/jakarta-tomcat-4.1.24 -Djava.io.tmpdir=/opt/jakarta-tomcat-4.1.24/temp org.apache.catalina.startup.Bootstrap star

but, URL is not taking effect.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Delete the Tomcat you copied, download it and install it fresh. Don't change anything (unless there's already something on port 8080) and start it up.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded tomcat, intalled it but there is no file workers.properties in $TOMCAT_HOME/conf. The tomcat home is apache-tomcat-4.1.39-LE-jdk14, so the version seems to be 4.1.xx.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is no file workers.properties in $TOMCAT_HOME/conf


Is there supposed to be? I just downloaded the same version you did and ran it fine.
Are you getting an error or exception when you try to run it? If so, can you copy and paste the complete error with stack trace? By summarizing you are probably leaving out valuable information.
The version of Tomcat you downloaded is for JDK versions greater than 1.4. Which version of the JDK are you running? You can check with:


 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess, the JDK version was more than 1.4 in the one I downloaded. Doing javac -version gives like:-

-------------------------------------------------------------------------------

[root@jispnew logs]# javac -version
javac: invalid flag: -version
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages
--------------------------------------------------------------------------------

There is no error while running it. It gives in catalina.out like;-

--------------------------------------------------------------------------------------------------
INFO: Initializing Coyote HTTP/1.1 on http-8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.39-LE-jdk14
Feb 2, 2009 12:04:56 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 2, 2009 12:04:56 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 2, 2009 12:04:56 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/41 config=null
--------------------------------------------------------------------------------------------------

I manually copied workers.properties from the existing live environment and put it $TOMCAT_HOME/conf.

This whole thing is giving lot of problem.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
randhir sethi wrote:I guess, the JDK version was more than 1.4 in the one I downloaded. Doing javac -version gives like:-


Try "java -version". I didn't realize the -version switch only works with later compilers. What you got back from javac doesn't look like what I get back from javac.
randhir sethi wrote:
There is no error while running it. It gives in catalina.out like;-

So what do you see in a browser when you point it at "http://servername:8080"?
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the output of java -version has come, it is:-

--------------------------------------------------------------------------------------
java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
--------------------------------------------------------------------------------------

In browser, it gives the standard message of 'Internet Explorer cannot display the webpage'

 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you ping the server?
Can you telnet to port 8080 on the server?
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can ping the server. When I telnet, telnet 10.10.10.26 8080, it shows still connecting. That is not a problem as telnet uses port 23 which is not
enabled. Instead, port 22 is enabled for SSH on the server which we also use for FTP.

 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
randhir sethi wrote: When I telnet, telnet 10.10.10.26 8080, it shows still connecting.


It should connect. You can enter an HTTP command and get a page. Copy this and paste it into the command window after you open a telnet session and hit return twice:


When I do it, I see the source of the Tomcat home page.

 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not understand, what you mean by this. Telnet is not enabled on this server, we use SSH. Still, if you want me to check, can you please suggest the exact steps to do this.

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The telnet service may not be enabled on the server, but you can use the telnet client to open a socket connection and send data. In the example in my post above, you connect to Tomcat via port 8080 and send an HTTP GET request. You should get an HTML document in return.
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand, if telnet is not enabled, how to access using telnet. Can, you write the exact steps to do it as I do not understand the java kind of code.

regards
 
randhir sethi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a doubt in this that does it have anything to do with the httpd service is started or not on the linux server?

regards
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
randhir sethi wrote:I do not understand, if telnet is not enabled, how to access using telnet.


If you telnet to port 8080, you are actually connecting to Tomcat, not the Telnet service. See my post of Yesterday at 12:11:50 for instructions. There's really nothing more to it.
This has nothing to do with Java. Telnet is a standard network tool. See here for another example of using Telnet to interact with a web server.

I had a doubt in this that does it have anything to do with the httpd service is started or not on the linux server?


I don't think so. If httpd were using the same port you wanted, that would prevent Tomcat from binding to the port but you'd see an error in catalina.out.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic