I’m using Eclipse Oxygen.2 (4.7.2) on Windows 10 with Java 8. I have a faceted project I run inside Eclipse using Tomcat. I had been using Tomcat 8.5, but on a new system I upgraded to Tomcat 9. Of course I removed the Tomcat 8.5 server and server runtime within Eclipse, and added back a Tomcat 9 server runtime.
Before adding the Tomcat 9 server within Eclipse I verified the Project Facets of my project. I saw that Dynamic Web Module was set to “3.1”, but that now “4.0” was available. I changed to “4.0”, figuring this would give me access to newer APIs.
I then tried to add the Tomcat 9 server. During the process, at “Add and Remove” it asks me which projects I want to add to be configured for the server. I selected my web project, but Eclipse said: “Tomcat version 9.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5, 6, 7, and 8 Web modules”.
Now as far as I know that’s exactly what I’m using. But the only thing I had changed was the Dynamic Web Module. So I went back to my project configuration and tried to change “Dynamic Web Module” back to “3.1”. Eclipse tells me:
Cannot change version of project facet Dynamic Web Module to 3.1.
Um… so I’ll just remove it. I unchecked the box next to “Dynamic Web Module”, and Eclipse tells me:
Dynamic Web Module 4.0 cannot be uninstalled.
Well that’s a fine kettle of fish. I can’t deploy my project to Tomcat, apparently because of the Dynamic Web Module. I can’t change the Dynamic Web Module back to what it was. What do I do? Where does the problem lie?
I opened Eclipse Bug 530844 to see if I can get some reasons for this behavior.
I reproduced the problem in the same environment as yours. When I tried to regress from 4.0 back to 3.1 I got the following error:
This blog provided the solution (which is a bit of a hack but it works):
- Edit the file org.eclipse.wst.common.project.facet.core.xml in the project’s .settings directory.
- For the line containing facet=”jst.web” version=”4.0″, change the version to 3.1.
Also see this SO question: Dynamic Web Module 3.0 — 3.1
A couple of related issues:
It looks like something else may not be quite right with your setup to be getting that error “Tomcat version 9.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5, 6, 7, and 8 Web modules”. Is your project configured to use Servlet 4.0? For my Maven project I had to add this dependency to the POM for Servlet 4.
Even after changing the Dynamic Web Module version to 3.1 my web app continued using version 4.0, so I’m not sure what that facet achieves.