Jason Jason - 6 months ago 1104
Java Question

Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules

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.3, 1.4, and Java EE 5 and 6 Web modules". I have already tried modifying my org.eclipse.wst.common.project.facet.core.xml as mentioned here file but that doesn't seem to fix the issue. I'm able to deploy just fine by using file->export->.war directly to my installed tomcat server. Any ideas?

Answer

Tomcat is not a Java EE compliant application server, so you won't have EJB or CDI out-of-the-box here. Instead, use JBoss Wildfly or TomEE which are built on top of tomcat. Or, change to a complete different Java EE implementation like GlassFish.

Another option may be if you deploy directly into Tomcat. Eclipse by default deploys on a different folder and use some kind of bypass to see it deployed on Tomcat. Follow these steps:

  1. In your Eclipse, go to the Servers view (if it's not visible in the IDE, go to Window/Show view/Servers), it will show you your tomcat server (and others), double click on it.
  2. In the Tomcat overview window, check the Server locations panel, expand it and check where the webapp is deployed.
  3. If selected option is Use Tomcat installation then the web app must be in <tomcat>/webapps. If not, make sure to select this option and the application will be directly deployed on Tomcat folder.