将 Tomcat 服务器连接到 Eclipse
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6846191/
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
Connecting Tomcat server to Eclipse
提问by Michael Allen
I am trying to use Tomcat 6.0 as a web development server within SpringSource Tool Suite 2.7.1. I create a runtime, download tomcat, create a server, etc as per these instructions http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html#N10148
我正在尝试使用 Tomcat 6.0 作为 SpringSource Tool Suite 2.7.1 中的 Web 开发服务器。我按照这些说明创建运行时、下载 tomcat、创建服务器等http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html#N10148
When I try to run a web app on the server though I get the following error:
当我尝试在服务器上运行 Web 应用程序时,虽然出现以下错误:
The archive: /Servers/Tomcat/bin/bootstrap.jar which is referenced
by the classpath, does not exist.
I know this bootstrap.jar file does exist in the exact place it says it should be yet it still causes an error. Any ideas?
我知道这个 bootstrap.jar 文件确实存在于它所说的确切位置,但它仍然会导致错误。有任何想法吗?
采纳答案by Michael Allen
The trick here was that the location of the jar was inside the Eclipse/STS project directory. STS stores its server configurations inside the /Servers folder and I had decided to store the tomcat runtimes here as well for neatness. Placing the runtimes elsewhere and trying again solves this issue.
这里的技巧是 jar 的位置在 Eclipse/STS 项目目录中。STS 将其服务器配置存储在 /Servers 文件夹中,为了整洁,我决定将 tomcat 运行时也存储在这里。将运行时放在别处并再次尝试解决了这个问题。
回答by Marcin Wasiluk
You might want to check/manually edit your path by going into server properities:
您可能希望通过进入服务器属性来检查/手动编辑您的路径:
In Servers view,
在服务器视图中,
1) double-click on Tomcat server.
1)双击Tomcat服务器。
2) Then click on Overview of Tomcat settings appears.
2)然后点击Overview of Tomcat settings出现。
3) "Open launch configuration" then Classpath
3)“打开启动配置”然后类路径
4) Edit User Entries here
4) 在此处编辑用户条目
回答by Peiqin
Or you may delete the servers configuration, and configure the server again. This works when you may have changed the directory of the server.
或者您可以删除服务器配置,重新配置服务器。当您可能更改了服务器的目录时,这会起作用。
回答by Nobbynob Littlun
I googled my way here on the search terms, "the specified tomcat directory does not exist". (I had moved it from one directory to another.)
我在这里搜索了搜索词,“指定的 tomcat 目录不存在”。(我已经将它从一个目录移到了另一个目录。)
For others here for that reason, my solution was to go into Window -> Preferences -> Server -> Runtime Environments
and update it there. Then to update the JARs, as in Marcin Wasiluk's answer.
出于这个原因,对于这里的其他人,我的解决方案是在那里进行Window -> Preferences -> Server -> Runtime Environments
更新。然后更新 JAR,如 Marcin Wasiluk 的回答。
回答by learner
I was also facing same issue and solved it as follows : My conclusions : 1) In my case issue was coming as I shifted the location of the Tomcat. Solution : 2) double clicked on the server configured in the eclipse. 3) Click on Open Launch configuration. 4) Change the classpath under classpath tab to the new location.
我也遇到了同样的问题,并按如下方式解决了它:我的结论:1) 在我的情况下,随着我移动 Tomcat 的位置,问题出现了。解决方法:2)双击eclipse中配置的服务器。3) 单击打开启动配置。4) 将类路径选项卡下的类路径更改为新位置。
Hope this would help.
希望这会有所帮助。
回答by suji
I have faced the same problem.
我遇到了同样的问题。
Solution: In Project Explorer--> Servers(right click) --> Run As --> Run Configurations(click) --> (Select "Tomcat v7.0 Server at localhost") --> Arguments(tab) --> Working directory(bottom of window) --> others : (click workspace) --> select the "boostraps.jar" from -->Server.
解决方案:在项目资源管理器-->服务器(右键单击)-->运行方式-->运行配置(单击)-->(选择“Tomcat v7.0 Server at localhost”)-->参数(选项卡)- > 工作目录(窗口底部)--> 其他:(单击工作区)--> 从--> 服务器中选择“boostraps.jar”。
Eg., My workspace.MY path is:
例如,我的 workspace.MY 路径是:
Project Explorer --> Servers(right click) --> Run As --> Run Configurations(click) --> (Select "Tomcat v7.0 Server at localhost") --> Arguments(tab) --> Working directory(bottom of window) --> others : (click workspace) --> /home/ciprus//Servers --> click apply.
项目资源管理器--> 服务器(右键单击)--> 运行方式--> 运行配置(单击)-->(选择“Tomcat v7.0 Server at localhost”)--> 参数(选项卡)--> 工作目录(窗口底部)--> 其他:(单击工作区)--> /home/ciprus//Servers --> 单击应用。
回答by Witold Kaczurba
I had similar issue. This is what worked for me:
我有类似的问题。这对我有用:
- When the path begins with slash like: "/Servers/Tomcat/bin/bootstrap.jar" it means that the local project is refered. In the picture - I had 'pivotal-tc-server-developer-3.2.8.RELEASE' as the name of the project.
- 当路径以斜杠开头时,例如:“/Servers/Tomcat/bin/bootstrap.jar”,表示引用了本地项目。在图片中 - 我将“pivotal-tc-server-developer-3.2.8.RELEASE”作为项目名称。
Open the project ('Servers' in your case or 'pivotal-tc-server-developer-3.2.8.RELEASE') so it is accessible to Eclipse.
The jar should be now visible.
打开项目(在您的情况下为“服务器”或“pivotal-tc-server-developer-3.2.8.RELEASE”),以便 Eclipse 可以访问它。
现在应该可以看到罐子了。
Alternatively go into Run Configurations; delete jars, and add it as an external jar.
或者进入运行配置;删除罐子,并将其添加为外部罐子。
回答by Rajesh
same problem in my case also i solved::
在我的情况下,我也解决了同样的问题::
just remove your older tomacat server and add tomcat 8.0 version only
只需删除旧的 tomacat 服务器并仅添加 tomcat 8.0 版本
回答by Nikos Stais
If you have unzipped downloaded Tomcat archive into Eclipse Servers folder, User Entries in classpath have relative path (e.g. /Servers/....) of bootstrap.jar and tomcat-juli.jar which path I guess is not accessible as a relative path.
如果您已将下载的 Tomcat 存档解压缩到 Eclipse Servers 文件夹中,则类路径中的用户条目具有 bootstrap.jar 和 tomcat-juli.jar 的相对路径(例如 /Servers/....),我猜该路径无法作为相对路径访问.
Once I removed Tomcat installation directory (with files) outside Eclipse's Servers folder, delete the old configuration and re-add Tomcat, everything worked as expected.
一旦我删除了 Eclipse 的 Servers 文件夹外的 Tomcat 安装目录(包含文件),删除旧配置并重新添加 Tomcat,一切都按预期工作。
I hope this helps narrow down the cause.
我希望这有助于缩小原因。
回答by Seif Tamallah
this could happen if you probably used previous tomcat server in eclipse, so deleting server and its configuration and creating another one will make it work .
如果您可能在 Eclipse 中使用了以前的 tomcat 服务器,则可能会发生这种情况,因此删除服务器及其配置并创建另一个服务器将使其工作。