59

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
F.P
  • 17,421
  • 34
  • 123
  • 189

11 Answers11

113

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
partlov
  • 13,789
  • 6
  • 63
  • 82
  • 1
    Is there a way to just change the project? If not, how would I import the contents after creating a new, empty project? – F.P Mar 13 '13 at 08:29
  • 3
    or go to Properties -> Projects Facets and check Dynamic Web Module. – Qkyrie Mar 13 '13 at 08:30
  • In project Properties, you will see "Project Facet" section. In it check "Dynamic Web Module" (appropriate version), and additional technologies you are using (JSF or JSP...). – partlov Mar 13 '13 at 08:31
  • 1
    I also checked `Java` along with `Dynamic Web Module` and it works fine!! – Suresh Jun 07 '19 at 10:38
32
  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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Banafshe Bamdad
  • 509
  • 5
  • 5
  • 1
    Created my project as a Dynamic Web project, everything had the right check boxes, but had to back the version of the Dynamic Web off from 6.0 to 5.0 for use with Tomcat v10.1.5 (in Project Facets panel). Then I could add/remove my project. – dan Apr 20 '23 at 18:39
7

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.

Charlie
  • 639
  • 9
  • 19
4

I fixed this issue as adding Dynamic Web Module to Project Facets

  1. right click on project name in the Package Explorer view.
  2. select Properties
  3. Select Project Facets
  4. Activate Dynamic Web Module
  5. Click on OK
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adem
  • 9,402
  • 9
  • 43
  • 58
4
  1. Right-click on project
  2. Go to properties => project factes
  3. Click on runtime tab
  4. Check the box of the server
  5. Then ok

Close the eclipse and start the server you will able to see and run the project.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
4

Go to project properties -> Project Facets. Make sure the Dynamic Web Module and Java is checked.

Apart from it, "Cloud Foundry Standalone Application" needs to be un-checked, if it is already selected. By default, few IDEs preselect this option.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sireesh Yarlagadda
  • 12,978
  • 3
  • 74
  • 76
3

After following the steps suggested by previous posters, do the following steps:

  • Right click on the project
  • Click Maven, then Update Project
  • Tick the checkbox "Force Update of Snapshots/Releases", then click OK

You should be good to go now.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amit
  • 31
  • 1
2

In my case:

Project properties → Project Facets. Make sure "Dynamic Web Module" is checked. Finally, I enter the version number "2.3" instead of "3.0". After that, the Apache Tomcat 5.5 runtime is listed in the "Runtimes" tab.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eduardo Lopes
  • 161
  • 3
  • 11
1

Steps I used to resolve it:

  1. Double click on Tomcat Server in the Servers tab.
  2. In a dropdown next to Runtime Environment:, select Apache Tomcat your version
  3. Click on save.

Now, you should be able to add to server on right click "Add and Remove".

Note: Additionally, when on clear/run, you get an error for multiple instances, open server.xml and ensure that it contains a single instance of each application and not multiple.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

In my case, the .project file was read-only (it was pulled from the source code control system that way). Making it writable resolved the issue.

Eclipse v4.7 (Oxygen).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
-1

For me:

It was Eclipse v4.5 (Mars) which did not support Java SE 7, so I added Java SE 8. It worked.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user1214683
  • 9
  • 1
  • 1