Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add a project to a Tomcat server in Eclipse

I cannot add my project to a server in Eclipse - why is that?

I installed all necessary tools (Web Dev, Java EE, Server Adapters, and Tomcat itself, everything)

I configured the runtime environments, adjusted all Java Versions to JDK 6 (because it should run on Tomcat 6), but still the left side of the dialogue where I could add resources is empty when creating a new server.

What else could I try?

PS: I am using Eclipse v4.2 (Juno) on Windows 7 Professional.

like image 455
F.P Avatar asked Mar 13 '13 08:03

F.P


People also ask

How do I add a project to apache tomcat?

Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.

How do I add a server to an existing project in eclipse?

Select File > New > Other…, then open the 'Server' folder and select 'Server' (Figure 4). Click 'Next'. In the next dialogue box (Figure 6) you are required to specify the path to the installed server and to select a Java Runtime Environment (JRE).

How do I import tomcat into eclipse?

Start the Eclipse WTP workbench. Open Window -> Preferences -> Server -> Installed Runtimes to create a Tomcat installed runtime. Click on Add... to open the New Server Runtime dialog, then select your runtime under Apache (Apache Tomcat v5. 0 in this example):

Why is my tomcat not working?

Most common issue with Tomcat note starting is that Java is not configured properly, user trying to start Tomcat does not have permissions to do so, or another program is using port 8080 on that server.


Video Answer


3 Answers

You didn't create your project as "Dynamic Web Project", so Eclipse doesn't recognize it like a web project. Create a new "Dynamic Web Project" or go to PropertiesProjects Facets and check Dynamic Web Module.

like image 102
partlov Avatar answered Oct 20 '22 14:10

partlov


  1. Right click on the project name in the Package Explorer view.
  2. Select Properties
  3. Select Project Facets
  4. Click on the Runtimes tab
  5. Check Server
  6. Click on OK

And now:

  1. Right click on the server name in the Servers view
  2. Click on Add and Remove...
  3. Move resources to the right column
like image 35
Banafshe Bamdad Avatar answered Oct 20 '22 13:10

Banafshe Bamdad


If you are able to see the project in Eclipse project explorer but unable to see the project while adding the project to the web server, follow project properties -> Project Facets, make sure Dynamic Web Module & Java were ticked.

like image 25
Charlie Avatar answered Oct 20 '22 13:10

Charlie