Alexey Zvolinskiy

About Alexey Zvolinskiy

Alexey is a test developer with solid experience in automation of web-applications using Java, TestNG and Selenium. He is so much into QA that even after work he provides training courses for junior QA engineers.

Tomcat in Eclipse: 6 popular “how to” questions

Learning a new technology is always a hard process. This process becomes even more difficult when you are trying to learn two technologies which are going to interact with each other. Tomcat and Eclipse are ones of the most popular pre-requirements in the Java EE development. Therefore to be a professional developer you need to know how to perform the most required actions with this pair and how to make some configurations.

1. How to add Tomcat in Eclipse?

The simplest way is to download Eclipse IDE for Java EE Developers. There if you create a new Dynamic Web Project, Eclipse will download and install Tomcat
 
automatically. But what if you want to do this by yourself?

  1. Firstly you need to download the latest version of Tomcat and install it on your computer. Don’t forget the directory of the newly installed Tomcat
  2. Then open Eclipse and on the main menu choose Window -> Preferences.
  3. In the “Preferences” window select Server -> Runtime Environments from the left panel.
  4. Click on the “Add..” button, after that select the version of Tomcat you have already installed.
  5. Click on the “Next” button, specify the path to the installed Tomcat and press the “Finish” button.

That’s it. Now you can find the server in the “Server” view in your Eclipse.

2. Where is Eclipse-Tomcat working directory?

It’s seems ridiculous when you are working with Tomcat in Eclipse and you don’t know where your server is. In order to find this out, you need to make several simple steps:

  1. Open the “Server” view in Eclipse.
  2. Select the server the location of which you want to know.
  3. Double click on the server.
  4. In the opened window select the “Server location” section.
  5. Take notice of the “Server path” field.

Usually this path looks like this: %eclipse_work_space%\.metadata\.plugins\org.eclipse.wst.server.core\tmp0

3. Where is a log file in Tomcat?

The location of the logs directory in Tomcat (integrated with Eclipse): %eclipse_work_space%\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\logs

4. How to change Tomcat port in Eclipse?

The first way:

To change the HTTP port you should to repeat the first three steps from paragraph #2, then open the “Port” section and set the value for “HTTP/1.1? field (by default value is 8080) to that you want to use.

The second way:

Navigate to %eclipse_work_space%\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf
Open server.xml and find the following string:

<connector connectiontimeout="20000" port="8080" protocol="HTTP/1.1" redirectport="8443">
</connector>

Modify the value of the “port” attribute in order to specify the port you need to use.

5. Where to put WAR file in Tomcat?

  • If you integrate Tomcat with Eclipse: %eclipse_work_space%\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
  • If you want to deploy WAR file in standalone Tomcat: %server_location%\webapps

6. Tomcat debug mode in Eclipse

In order to launch Tomcat in debug mode from Eclipse, click on the button with bug icon in the “Server” view (view the image below for more details).

Eclipse Tomcat Debug Mode

 

Reference: Tomcat in Eclipse: 6 popular “how to” questions from our JCG partner Alex Fruzenshtein at the Fruzenshtein’s notes blog.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


− five = 2



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close