• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1111
  • Last Modified:

Restart Tomcat Manually

I'm getting the following error when I try to run a servlet on Eclipse.  Starting Tomcat v6.0 Server at LocalHost has encountered a problem.  

Serveral Ports (8080, 8009) required by tomcat ... are already in use.  The server may already be running in another process...

Basically, I'm pretty sure it didn't shut down properly.  I'd love to try to shut it down manually through the terminal (on a mac) but not sure how.  

Any ideas?

  • 3
1 Solution
Deepak KosarajuDevOps EngineerCommented:
You can say following command, enter root user passwd when prompted.
To Stop
sudo /Library/StartupItems/Tomcat/Tomcat stop
To Start
sudo /Library/StartupItems/Tomcat/Tomcat start

Open in new window

Deepak KosarajuDevOps EngineerCommented:
Another method of doing it is discuss here
Starting and Stopping Tomcat
Tomcat expects certain environment variables to be defined before it starts. In order to simplify the startup and shutdown processes, you can create re-usable scripts. I usually store scripts like these in a directory called bin under my home directory. (Thats pretty standard in the Unix world.)

liz@localhost:~> mkdir bin
liz@localhost:~> cd bin
Now you can create a file (using your favorite text editor, must be saved with unix line endings) called ~/bin/start_tomcat with the following contents:

export CATALINA_HOME=/usr/local/jakarta-tomcat-4.0.1
export JAVA_HOME=/usr
And a file called ~/bin/stop_tomcat with these contents:

export CATALINA_HOME=/usr/local/jakarta-tomcat-4.0.1
export JAVA_HOME=/usr
Finally, you must make these files executable:

liz@localhost:bin> chmod ug+x start_tomcat stop_tomcat

Reference Link:http://developer.apple.com/internet/java/tomcat1.html
b_rad_wrightAuthor Commented:
So this obviously displays that I am a novice, but can you give me a little more beginning info on your first solution?  Specifically, what is sudo?  Is this done in the Terminal?  if so, what directory do I need to be in?

The second solution is way over my head.   Sorry for the inconvenience
Deepak KosarajuDevOps EngineerCommented:
Yes sudo is done in terminal, sudo is used to access r run any command as root privileges as rollbased user. you can be in any directory to issue that sudo command because we are pointing the absolute path to sudo.
but before running the above sudo make sure you have the /Library/StartupItems/Tomcat/ following dir and binaries inside it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now