Tomcat version 7.0仅支持J2EE 1.2、1.3、1.4和Java EE 5和6 Web模块。

时间:2022-05-31 14:02:51

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?

我尝试在Eclipse J2EE透视图中使用Tomcat 7部署一个非常简单的HTTPServlet项目。我得到的错误是“Tomcat version 7.0仅支持J2EE 1.2、1.3、1.4和Java EE 5和6 Web模块”。我已经尝试修改了我的org.eclipse.wst.common.project.facet.core.xml,但这似乎并没有解决这个问题。我可以通过使用file->导出->来部署。war直接到我安装的tomcat服务器。什么好主意吗?

6 个解决方案

#1


7  

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.

Tomcat不是一个兼容Java EE的应用服务器,因此您不会在这里有EJB或CDI开箱即用。相反,可以使用JBoss Wildfly或TomEE,它是在tomcat之上构建的。或者,更改为完全不同的Java EE实现,如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:

另一个选项可能是直接部署到Tomcat。默认情况下,Eclipse将部署在不同的文件夹上,并使用某种旁路来查看它在Tomcat上的部署。遵循以下步骤:

  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. 在Eclipse中,转到Servers视图(如果它在IDE中不可见,则转到窗口/显示视图/服务器),它将显示您的tomcat服务器(以及其他服务器),双击它。
  3. In the Tomcat overview window, check the Server locations panel, expand it and check where the webapp is deployed.
  4. 在Tomcat overview窗口中,检查服务器位置面板,展开它并检查部署了webapp的位置。
  5. 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.
  6. 如果选择的选项是使用Tomcat安装,那么web应用程序必须在< Tomcat >/webapps中。如果没有,请确保选择此选项,并将应用程序直接部署到Tomcat文件夹。

#2


17  

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.

是的,使用Maven、Spring项目和Java EE遵从性,我们将与Tomcat一起面对这个问题。要解决这个问题,请执行命令列表,以使项目成为Java EE遵从性。

  1. $ mvn eclipse:clean - to clean the eclipse files like .project .classpath
  2. $ mvn eclipse:clean -来清除eclipse文件,比如.project .classpath。
  3. $ mvn eclipse:eclipse -Dwtpversion=2.0 to create the eclipse compatible with Java EE.
  4. $ mvn eclipse:eclipse -Dwtpversion=2.0,以创建与Java EE兼容的eclipse。

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.

最后在eclipse中打开项目,选择服务器tomcat现在在服务器上单击run (Alt+Shift+x,R)选择tomcat7.0运行。

#3


14  

Go to Project Properties -> Project Facets and change the version of Dynamic Web Module. If it is set to 3.1 then change it to 3.0. In case it does not allow you to change the version, uncheck it and press apply. Then you can select the version, check it and apply-OK. Worked for me!

转到项目属性->项目方面,并更改动态Web模块的版本。如果将其设置为3.1,则将其更改为3.0。如果不允许您更改版本,请取消检查并按下应用程序。然后您可以选择版本,检查它和应用程序。为我工作!

#4


5  

If you are getting "Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules" error when trying to add project to Tomcat 7. Simply,

如果您正在获得“Tomcat version 7.0仅支持J2EE 1.2、1.3、1.4和Java EE 5和6 Web模块”,那么尝试向Tomcat 7添加项目时出错。简单地说,

Right click on the project --> go to project facets --> uncheck the dymanic web module (which should be 3.1)--> apply --> then change the dynamic web module to 3.0 --> apply and then save.

右击项目——>转到项目方面——>取消了dymanic web模块(应该是3.1)——>应用——>然后将动态web模块更改为3.0——>应用,然后保存。

Try to add now and it should work.

现在尝试添加,它应该可以工作。

#5


3  

1)Go to your project on folder in eclipse workspace.
2)Open the .setting folder
3)Open the "org.eclipse.wst.common.project.facet.core" xml file
4)Update the version in last line as 2.4 or 2.5
5)Refresh the project and try to run on server

1)到eclipse工作区中的文件夹进行项目。2)打开。设置文件夹3)打开“org.eclipse.wst.common.project.facet.core”xml文件4)更新最后一行的版本为2.4或2.5)刷新项目并尝试在服务器上运行。

#6


2  

For Tomcat Version 6

对于Tomcat Version 6

In project, .settings folder OR Or CTRL+SHIFT+R : find this file

在项目中,.settings文件夹或CTRL+SHIFT+R:找到这个文件。

org.eclipse.wst.common.project.facet.core.xml

org.eclipse.wst.common.project.facet.core.xml

change the version of facet=jst.web to 2.4 or 2.5

更改facet=jst的版本。网络到2.4或2.5。

File : org.eclipse.wst.common.project.facet.core.xml

文件: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.

Tomcat 7需要facet=“jst”。在Tomcat 7上部署的web“version=”3.0“。

#1


7  

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.

Tomcat不是一个兼容Java EE的应用服务器,因此您不会在这里有EJB或CDI开箱即用。相反,可以使用JBoss Wildfly或TomEE,它是在tomcat之上构建的。或者,更改为完全不同的Java EE实现,如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:

另一个选项可能是直接部署到Tomcat。默认情况下,Eclipse将部署在不同的文件夹上,并使用某种旁路来查看它在Tomcat上的部署。遵循以下步骤:

  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. 在Eclipse中,转到Servers视图(如果它在IDE中不可见,则转到窗口/显示视图/服务器),它将显示您的tomcat服务器(以及其他服务器),双击它。
  3. In the Tomcat overview window, check the Server locations panel, expand it and check where the webapp is deployed.
  4. 在Tomcat overview窗口中,检查服务器位置面板,展开它并检查部署了webapp的位置。
  5. 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.
  6. 如果选择的选项是使用Tomcat安装,那么web应用程序必须在< Tomcat >/webapps中。如果没有,请确保选择此选项,并将应用程序直接部署到Tomcat文件夹。

#2


17  

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.

是的,使用Maven、Spring项目和Java EE遵从性,我们将与Tomcat一起面对这个问题。要解决这个问题,请执行命令列表,以使项目成为Java EE遵从性。

  1. $ mvn eclipse:clean - to clean the eclipse files like .project .classpath
  2. $ mvn eclipse:clean -来清除eclipse文件,比如.project .classpath。
  3. $ mvn eclipse:eclipse -Dwtpversion=2.0 to create the eclipse compatible with Java EE.
  4. $ mvn eclipse:eclipse -Dwtpversion=2.0,以创建与Java EE兼容的eclipse。

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.

最后在eclipse中打开项目,选择服务器tomcat现在在服务器上单击run (Alt+Shift+x,R)选择tomcat7.0运行。

#3


14  

Go to Project Properties -> Project Facets and change the version of Dynamic Web Module. If it is set to 3.1 then change it to 3.0. In case it does not allow you to change the version, uncheck it and press apply. Then you can select the version, check it and apply-OK. Worked for me!

转到项目属性->项目方面,并更改动态Web模块的版本。如果将其设置为3.1,则将其更改为3.0。如果不允许您更改版本,请取消检查并按下应用程序。然后您可以选择版本,检查它和应用程序。为我工作!

#4


5  

If you are getting "Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules" error when trying to add project to Tomcat 7. Simply,

如果您正在获得“Tomcat version 7.0仅支持J2EE 1.2、1.3、1.4和Java EE 5和6 Web模块”,那么尝试向Tomcat 7添加项目时出错。简单地说,

Right click on the project --> go to project facets --> uncheck the dymanic web module (which should be 3.1)--> apply --> then change the dynamic web module to 3.0 --> apply and then save.

右击项目——>转到项目方面——>取消了dymanic web模块(应该是3.1)——>应用——>然后将动态web模块更改为3.0——>应用,然后保存。

Try to add now and it should work.

现在尝试添加,它应该可以工作。

#5


3  

1)Go to your project on folder in eclipse workspace.
2)Open the .setting folder
3)Open the "org.eclipse.wst.common.project.facet.core" xml file
4)Update the version in last line as 2.4 or 2.5
5)Refresh the project and try to run on server

1)到eclipse工作区中的文件夹进行项目。2)打开。设置文件夹3)打开“org.eclipse.wst.common.project.facet.core”xml文件4)更新最后一行的版本为2.4或2.5)刷新项目并尝试在服务器上运行。

#6


2  

For Tomcat Version 6

对于Tomcat Version 6

In project, .settings folder OR Or CTRL+SHIFT+R : find this file

在项目中,.settings文件夹或CTRL+SHIFT+R:找到这个文件。

org.eclipse.wst.common.project.facet.core.xml

org.eclipse.wst.common.project.facet.core.xml

change the version of facet=jst.web to 2.4 or 2.5

更改facet=jst的版本。网络到2.4或2.5。

File : org.eclipse.wst.common.project.facet.core.xml

文件: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.

Tomcat 7需要facet=“jst”。在Tomcat 7上部署的web“version=”3.0“。