I\'m trying to deploy a very simple HTTPServlet project using Tomcat 7 in my Eclipse J2EE perspective. I am getting the error \"Tomcat version 7.0 only supports J2EE 1.2, 1.
This problem can be resolved by by changing the Dynamic Web Module version to 3.0. This can be done in 2 ways.
Goto project properties and click on project facets, now you see the option Dynamic Web Module
, change it to 3.0
For those who can't change the version in the above step, open org.eclipse.wst.common.project.facet.core.xml
and change the version here to something like <installed facet="jst.web" version="3.0"/>
Now go to project facets and see the Dynamic Web Module
version changed to 3.0
Yes, using Maven, Spring project with Java EE compliance we face this issue with Tomcat. To fix this problem please execute the list of commands to make the project as Java EE compliance.
$ mvn eclipse:clean
- to clean the eclipse files like .project .classpath$ mvn eclipse:eclipse -Dwtpversion=2.0
to create the eclipse compatible with Java EE.At last open the project in eclipse select the server tomcat now click run on servers(Alt+Shift+x,R) select tomcat7.0 to run.
For Tomcat Version 6
In project, .settings folder OR Or CTRL+SHIFT+R : find this file
org.eclipse.wst.common.project.facet.core.xml
change the version of facet=jst.web to 2.4 or 2.5
File : org.eclipse.wst.common.project.facet.core.xml
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.java"/>
<fixed facet="jst.web"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="jst.java" version="6.0"/>
</faceted-project>
Tomcat 7 You need facet="jst.web" version="3.0" to deploy on Tomcat 7.
I thought I'd add something to this question as I tried all of the above and ended up doing something different to fix my issue of:
Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules
which then also led to
Cannot change version of project facet Dynamic Web Module to version 3.0
In our project we are using Maven to build a Java 1.8 / Tomcat 8.5 application (which only supports Dynamic Web Module Version 3.0 - not 4.0)
Someone in our team made the following change in our parent pom.xml
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
The version had been moved from 3.0.1 to 4.0.0 and no-matter how many times I tried to manually overwrite org.eclipse.wst.common.project.facet.core.xml
with the right version <installed facet="jst.web" version="3.0"/>
a Maven update re-over-wrote it with 4.0.
I set the version back to 3.0.1 as shown below and since then my Project Facets are showing the correct version, my apps are deploying to my internal Tomcat Server and to to this day, no-one is owning up to making the update to version 4.0.0 :)
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
To Solve this Issue
You will have to update your Dynamic Web Module
version from 3.1 to 3.0
.
Eclipse dosen't allow these updation directly via Build Path-->Configure Build Path-->Project Facets
.
Follow these steps
Open file : YourPrjectFolder/.setting/org.eclipse.wst.common.project.facet.core
org.eclipse.wst.common.project.facet.core
XML document.<installed facet="jst.web" version="3.1"/>
to <installed facet="jst.web" version="3.0"/>
You will be able to publish the your project now on Tomcat 7.
For Tomcat 8.5 if you are facing this issue, change your facet setting to 3.1
Open file : {project_Folder}/.setting/org.eclipse.wst.common.project.facet.core
Open org.eclipse.wst.common.project.facet.core XML file. Change to version as 3.1 Save and refresh the project you will find it you can add the resource to tomcat.
This worked for me.. Thanks