File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How do you get Tomcat Console Messages in Linux - Resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How do you get Tomcat Console Messages in Linux - Resolved" Watch "How do you get Tomcat Console Messages in Linux - Resolved" New topic
Author

How do you get Tomcat Console Messages in Linux - Resolved

Alvin Watkins
Ranch Hand

Joined: May 25, 2011
Posts: 53
I am brand new to Linux. After my server died, my server admin brought a new one up for me. The last one was Windows. The new one is Umbutu. I'm happy to learn but, need to get back to deploying software as fast as possible - especially since this cost me a few days.

In windows, Tomcat was easy. Get a zip file, unzip it, migrate to unzipped dir (cd c:\tomcat_home\bin) and type "startup.bat" or "shutdown.bat" (assuming you've set Java_Home). Then I'd get a console where I can watch tomcat start and watch software deploy.

Now I have Linux. First thing I do is install Tomcat 7.0.29 from the command line to /usr/local/tomcat. After that, I go to the installation dir of Tomcat/bin and type ./shartup.sh. The console prints out some directories and that's it. Over time, I come to realize that Tomcat is already installed and running (Tomcat6). So, I dig around and find two more instances of Tomcat - both of them Tomcat6. One is at /usr/share/tomcat6. I browse to that dir and type ./shutdown.sh. The console starts printing and then fails with "no /conf directory found." So I find the /conf directory. It's at /var/lib/tomcat6/conf. However, there's no tomcat/bin folder in this directory and thus no startup.sh and shutdown.sh. Conf is also pointed to another directory, /etc/tomcat6. I go to etc/tomcat6 hoping I'll find a bin folder there. I don't. But I do find the tomcat-user.xml file so that's helpful. Eventually I find that the start / stop scripts are in one Tomcat6 shell script found at etc/inid.d/tomcat6... I try shutting down but can't seem to figure out the commands to make this shell do so.

I liked it better when Tomcat had one parent directory and everything was laid out in a directory structure I could see without linking all over the place. I get the sense that Linux has come pre-configured with Tomcat as a daemon which is doing me no favors. In any event, can someone tell me how to:

1. stop tomcat
2. restart tomcat with a console so I can see the log4j messages?
3. A good tutorial so that I can learn the relevant parts of Linux I need to be able to work with Tomcat?

Thanks for your help.
Alvin Watkins
Ranch Hand

Joined: May 25, 2011
Posts: 53
I finally did get Tomcat to stop. I kept trying to get it to stop by going to etc/init.d/sudo ./tomcat6 stop. The console would tell me that "sbin" is not in the environment variables. I could also still hit tomcat at my IP:8080. Finally, I tired etc/init.d/sudo ./tomcat6 start. That should have done nothing since Tomcat was already started. Instead it said, "starting Tomcat servlet engine". Odd. I hit it again from my IP:8080 and got the same page. This time when I typed etc/init.d/sudo ./tomcat6 stop, instead of telling me that sbin is not an environment var, this time it stopped Tomcat? I'm glad it did by why the error before? I hit from my IP 8080 and got no resource found.

This is some progress. Perhaps now I can get Tomcat 7 to come up. Assuming I make that happen (and get a console when I do), is there something I need to know about removing the other version of Tomcat which seems to be starting automatically with Linux?
Alvin Watkins
Ranch Hand

Joined: May 25, 2011
Posts: 53
I do now see the Tomcat7 welcome page at my ip:8080.

So, I got it started and got Tomcat6 to stop... but, I still have no console to speak of? I started Tomcat via the console but it just prints some directory info on startup. I am very accustomed to watching my log4j messages and fixing bugs when war's are deployed and trigger stack trace messages in the Tomcat console. I uploaded a war I knew would fail in order to see if I got my debug messages on in the gnome terminal window I started Tomcat 7 in. The Tomcat manager app reports the failed war deployment and I see the war in the webapps dir. But, the terminal is silent. Is there a way to get the output I'm used to on Linux?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

The output will be written to logs/catalina.out


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alvin Watkins
Ranch Hand

Joined: May 25, 2011
Posts: 53
I know it's in Catalina.out. What I want is to see catalina.out in real time, in a terminal, like I do when I run in Windows. I finally did find a solution.

cd ../tomcat/logs tail -f catalina.out

That causes the logs to print to the console in real time.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19

Alvin Watkins wrote:I know it's in Catalina.out. What I want is to see catalina.out in real time, in a terminal, like I do when I run in Windows. I finally did find a solution.

cd ../tomcat/logs tail -f catalina.out

That causes the logs to print to the console in real time.


Yup. I do it all the time. You don't actually have to "cd" to do it though, as long as you provide the path. The "tail -f" command is all sorts of useful.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you get Tomcat Console Messages in Linux - Resolved