如何在 Eclipse 中使用 Tomcat 8.5.x 和 TomEE 7.x?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37024876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Tomcat 8.5.x and TomEE 7.x with Eclipse?
提问by dexter meyers
I need to setup a Tomcat 8.5.xserver version in Eclipse. When I try to create a server using Eclipse GUI, I get in Eclipse Luna as choice the latest version "Apache Tomcat v8.0". When I select it and I browse to my Tomcat 8.5.x server, I get this blocking error message:
我需要在 Eclipse 中设置一个 Tomcat 8.5.x服务器版本。当我尝试使用 Eclipse GUI 创建服务器时,我在 Eclipse Luna 中选择了最新版本“ Apache Tomcat v8.0”。当我选择它并浏览到我的 Tomcat 8.5.x 服务器时,我收到以下阻塞错误消息:
The Apache Tomcat installation at this directory is version 8.5.0. A Tomcat 8.0 installation is expected.
此目录中的 Apache Tomcat 安装版本为 8.5.0。需要安装 Tomcat 8.0。
The same error appears when trying TomEE 7.x, which is internally based on Tomcat 8.5.
尝试内部基于 Tomcat 8.5 的 TomEE 7.x 时出现相同的错误。
In Eclipse Neonthe latest version as choice is "Apache Tomcat v9.0" and it gives the same error. There isn't even a "Apache Tomcat v8.5" option.
在Eclipse Neon中,选择的最新版本是“ Apache Tomcat v9.0”,它给出了相同的错误。甚至没有“ Apache Tomcat v8.5”选项。
Is there a way to use Tomcat 8.5and TomEE 7.x in Eclipse? How?
有没有办法在 Eclipse 中使用 Tomcat 8.5和 TomEE 7.x?如何?
回答by dexter meyers
You have to patch catalina.jar
, as this is version number the WTP adapter looks at. It's a quite useless check, and the adapter should allow you to start the server anyway, but nobody has though of that yet.
您必须修补catalina.jar
,因为这是 WTP 适配器查看的版本号。这是一个非常无用的检查,并且适配器应该允许您无论如何启动服务器,但是还没有人想到这一点。
For years and with every version of Tomcat this is always a problem.
多年来,对于 Tomcat 的每个版本,这始终是一个问题。
To patch you can do the following:
要修补,您可以执行以下操作:
cd [tomcat or tomee home]/lib
mkdir catalina
cd catalina/
unzip ../catalina.jar
vim org/apache/catalina/util/ServerInfo.properties
cd [tomcat or tomee home]/lib
mkdir catalina
cd catalina/
unzip ../catalina.jar
vim org/apache/catalina/util/ServerInfo.properties
Make sure it looks like the following (the version numbers all need to start with 8.0):
确保它看起来像下面这样(版本号都需要以 8.0 开头):
server.info=Apache Tomcat/8.0.0
server.number=8.0.0
server.built=May 11 2016 21:49:07 UTC
Then:
然后:
jar uf ../catalina.jar org/apache/catalina/util/ServerInfo.properties
cd ..
rm -rf catalina
jar uf ../catalina.jar org/apache/catalina/util/ServerInfo.properties
cd ..
rm -rf catalina
回答by FkJ
There is a patch for Eclipse:
https://bugs.eclipse.org/bugs/attachment.cgi?id=262418&action=edit
Eclipse 有一个补丁:https:
//bugs.eclipse.org/bugs/attachment.cgi?id=262418&action=edit
Download this patch and put it to the pluginsdirectory of your Eclipse installation. It will replace the default "org.eclipse.jst.server.tomcat.core_1.1.800.v201602282129.jar".
下载此补丁并将其放在Eclipse 安装的plugins目录中。它将替换默认的“ org.eclipse.jst.server.tomcat.core_1.1.800.v201602282129.jar”。
NOTE
After you add this patch you must choose "Apache Tomcat v9.0" when adding a server runtime environment in the Eclipse (Preferences > Server > Runtime Environments).
I.e. this patch allows you to select either Tomcat version 9.x or Tomcat version 8.5.x when adding Apache Tomcat v.9.0 runtime environment.
注意
添加此补丁后,在 Eclipse 中添加服务器运行环境时必须选择“ Apache Tomcat v9.0”(Preferences > Server > Runtime Environments)。
即此补丁允许您在添加 Apache Tomcat v.9.0 运行时环境时选择 Tomcat 9.x 版或 Tomcat 8.5.x 版。
More details on can be found on the related bug report page: https://bugs.eclipse.org/bugs/show_bug.cgi?id=494936
可以在相关的错误报告页面上找到更多详细信息:https: //bugs.eclipse.org/bugs/show_bug.cgi?id=494936
回答by Vinoth Vino
For Tomcat 8.5.xusers
对于Tomcat 8.5.x用户
You've to changethe ServerInfo.properties
file of Tomcat's /lib/catalina.jar
file.
您对更改的ServerInfo.properties
Tomcat的文件/lib/catalina.jar
的文件。
ServerInfo.properties
file contains the following code
ServerInfo.properties
文件包含以下代码
server.info=Apache Tomcat/8.5.4
server.number=8.5.4.0
server.built=Jul 6 2016 08:43:30 UTC
Just open the ServerInfo.properties
file by opening the catalina.jar
with winrarfrom your Tomcat's libfolder
只需ServerInfo.properties
通过从Tomcat 的 lib文件夹中打开catalina.jar
with winrar来打开文件
ServerInfo.properties
file location in catalina.jar
is /org/apache/catalina/util/ServerInfo.properties
ServerInfo.properties
文件位置catalina.jar
是/org/apache/catalina/util/ServerInfo.properties
Notice :shutdown
the Tomcat server(if it's already opened by cmd) before doing these things otherwise your file doesn't change and your winrarshows error.
注意:shutdown
在做这些事情之前Tomcat服务器(如果它已经被cmd打开)否则你的文件不会改变并且你的winrar显示错误。
Then change the following code in ServerInfo.properties
然后将下面的代码改成 ServerInfo.properties
server.info=Apache Tomcat/8.0.8.5.4
server.number=8.5.4.0
server.built=Jul 6 2016 08:43:30 UTC
Restart your eclipse(if opened). Now it'll work...
重新启动您的日食(如果已打开)。现在它会工作...
回答by Cryptor
回答by Vikd
This workaround worked for me. I edited the serverInfo.propertiesfile as given below:
这个解决方法对我有用。我编辑了serverInfo.properties文件,如下所示:
server.info=Apache Tomcat/8.0.0
server.number=8.0.0.0
server.built=Oct 6 2016 20:15:31 UTC
回答by Sandipan
Install the latest version of eclipse(). It would have the option to add Tomcat 8.5.
安装最新版本的 eclipse()。它可以选择添加 Tomcat 8.5。
回答by divya_uk
I had similar issues with Eclipse Kepler v3.8 I had tomcat v8.5.37 installed. I couldn't see Apache v8.5 as an option. By skimming through StackOverflow I found Apache v9.0 is available on Eclipse Neon. Cool thing is you don't have to change your eclipse version. In your current Eclipse. Download WTP(Web Tools Package) by following the steps:
我在安装了 tomcat v8.5.37 的 Eclipse Kepler v3.8 上遇到了类似的问题。我看不到 Apache v8.5 作为一个选项。通过浏览 StackOverflow,我发现 Apache v9.0 在 Eclipse Neon 上可用。很酷的事情是你不必改变你的 eclipse 版本。在您当前的 Eclipse 中。按照以下步骤下载 WTP(Web Tools Package):
Step 1: Help >>> Install New Software. Copy this link in the Work with: http://download.eclipse.org/webtools/repository/neon
步骤 1:帮助 >>> 安装新软件。在 Work with 中复制此链接:http: //download.eclipse.org/webtools/repository/neon
Step 2: Select JST Server Adaptersand JST Server Adapters Extensionsfrom the first package you see. Install those.
步骤 2:从您看到的第一个包中选择JST Server Adapters和JST Server Adapters Extensions。安装那些。
Step 3: Windows >>> Preferences >>> Server >>> Runtime Environments >>> Add..
第 3 步:Windows >>> Preferences >>> Server >>> Runtime Environments >>> Add..
You'll see Apache v9.0 there! It works!
您将在那里看到 Apache v9.0!有用!
回答by Sanjay
Go to the preview version of tomcat e.g. : tomcat 8.3 and copy catalina.jar file and paste into the existing tomcat which you have facing the issue
转到 tomcat 的预览版本,例如:tomcat 8.3 并复制 catalina.jar 文件并粘贴到您遇到问题的现有 tomcat 中
回答by parlad
Forgive me for invoking old problem. But it is like legendary, always happen for new users. The reason I am here is I want to purpose different answer. Rather simple. Please fo to windows->preference->Runtime Environment->searchand select the folder where you download the server. It will automatically detect the server and you are good to go.
请原谅我援引老问题。但它就像传奇一样,总是发生在新用户身上。我在这里的原因是我想要不同的答案。相当简单。请到windows->preference->Runtime Environment->search并选择下载服务器的文件夹。它会自动检测服务器,你很高兴。
回答by Youssef El-kantri
I'm guessing that you are running Eclipse Mars, or an even earlier release. You need to upgrade to Eclipse Neon or later
我猜您正在运行 Eclipse Mars,或者更早的版本。您需要升级到 Eclipse Neon 或更高版本