41

When I run the application and build it. It doesn't show any error but when I access my application the following error comes in the console.

Description Resource Path Location Type Target runtime Apache Tomcat v7.0 is not defined. MyProject Unknown Faceted Project Problem

Can someone help me with this.

user2015827
  • 413
  • 1
  • 4
  • 4
  • 4
    Do you have Tomcat 7 in your targeted runtimes? (Project>Properties>Targeted Runtimes) – Areca Jun 08 '16 at 09:52
  • check here http://stackoverflow.com/questions/37298416/cant-use-tomcat-server-in-eclipse/37299264#37299264 – bananas Jun 08 '16 at 09:56
  • [https://stackoverflow.com/questions/22756153/the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build](https://stackoverflow.com/questions/22756153/the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build) – asifaftab87 Aug 04 '20 at 13:09

7 Answers7

89

The targeted runtime version must be updated. Suppose you are using Tomcat Version 8.0 but in the targeted runtime it shows 7.0 selected.

You need to right click on your project > Properties > Targeted Runtime > Click the version required 8.0 I guess. Hope it helps.

Vibhu Dadhichi
  • 1,099
  • 16
  • 21
6

It might be that the org.eclipse.wst.common.project.facet.core.xml file in the .settings of your project have changed (e.g. if a colleague checks in their settings and then you pull their changes). In that case the Project > Properties > Targeted Runtime will be there and even checked (your original will be unchecked) but you will still have a problem.

You need to rename your runtime...

Window > Preferences > Server > Runtime Environments 

select yours > Edit

Change the name so that it is the same as your colleagues.

When you come to using your server that will also need to be updated...

double click on the server > General Information > Runtime Environment 

use the dropdown to select the new name

Michael Shaw
  • 143
  • 1
  • 6
  • Good Thanks,Actually This is problem with me.Properties > Targeted Runtime were selected but Server > Runtime Environments was not. –  Feb 27 '17 at 19:30
4

Add your Tomcat 7 installation to your targeted runtimes. You can do it under menu Project > Properties > Targeted Runtimes

Select your desired runtime and provide the path where it is installed.

Areca
  • 1,292
  • 4
  • 11
  • 21
3

Eclipse Version: OXYGEN, 2017

  1. From the Project Explorer, right-click on your project > Properties > Project Facets
  2. On the left-hand panel, click on Runtimes tab.
  3. Select the Runtime (Apache Tomcat vX.0) you wish to implement.
  4. Click Apply and Close.

You should see this specific error go away. Regards.

kuzevni
  • 103
  • 2
  • Thanks, but **Runtimes** tab cannot found. Enabling **Project Facets** the **Targete Runtime** got back in properties list. – Bhaskar Das Jan 12 '18 at 18:24
1

This error might also cause when tomcat 7.0 directory is not added in preference.You might have installed other version (ex:tomcat 8.0) and pointing 7.0 version which is not available

You can change the version in properties >> project facets

In runtime tab change the version.

enter image description here

Bùi Đức Khánh
  • 3,975
  • 6
  • 27
  • 43
0

Go to Window/Preferences then Server/Runtime Environments and add the missing Runtime Environment here.

PowerStat
  • 3,757
  • 8
  • 32
  • 57
0

There is probably a simpler way, but installing the J2EE version of Eclipse solved this for me. I had projects set up in an older version of Eclipse, but after upgrading to a newer, standard, version my tomcat project quit working even after installing the Web Tools Platform SDK. So reinstalling with the J2EE version was the easiest thing that worked for me after trying several of the other solutions.

Amber
  • 2,413
  • 1
  • 15
  • 20