This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How do you get Tomcat Console Messages in Linux - Resolved

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67752
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
The output will be written to logs/catalina.out
 
Alvin Watkins
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 28320
210
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

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.
 
I am displeased. You are no longer allowed to read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic