Java 无法通过 Eclipse Kepler 启动 tomcatv7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23003617/
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
Trouble starting tomcatv7 via Eclipse Kepler
提问by Ian Riley
I see that problems like mine have been posted before, some of which posts were answered. I've attempted the fixes, which indeed seem like they should have worked, but I'm still running into the same problem:
我看到像我这样的问题之前已经发布过,其中一些帖子得到了回答。我已经尝试了修复,它们确实看起来应该有效,但我仍然遇到同样的问题:
I'm trying to run a dynamic web project in Eclipse Kepler (Java EE) via apache tomcat 7.0.53 on my localhost. I've created tomcat as a server in Eclipse, and copied the config files from /tomcat/7.0.53/libexec/conf into /workspace/Servers/Tomcat v7.0 Server at localhost-config, and changed the permissions on the files so that they are all readable and writeable.
我正在尝试通过本地主机上的 apache tomcat 7.0.53 在 Eclipse Kepler (Java EE) 中运行动态 Web 项目。我在 Eclipse 中创建了 tomcat 作为服务器,并将 /tomcat/7.0.53/libexec/conf 中的配置文件复制到 localhost-config 的 /workspace/Servers/Tomcat v7.0 Server 中,并更改了文件的权限这样它们都是可读和可写的。
However, when I try to start the tomcat server in eclipse, I get this error:
但是,当我尝试在 Eclipse 中启动 tomcat 服务器时,出现此错误:
Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete.
无法在 /Servers/Tomcat v7.0 Server at localhost-config 加载 Tomcat 服务器配置。配置可能已损坏或不完整。
In case it's helpful, it's all being run in mac osx 10.6.8, on a 64-bit machine.
如果它有帮助,它都在 64 位机器上的 mac osx 10.6.8 中运行。
Thanks in advance for your help.
在此先感谢您的帮助。
采纳答案by Ian Riley
Unfortunately, this is not much of an answer. I finally never got this working with eclipse Kepler. However, when I installed linux mint on my computer, and used its software installer to install linux 3.8 (indigo), added all the EE updates (all the web/xml additions via help-->install new software-->indigo update site), installed tomcat 7.0, I finally got eclipse to play nice with tomcat (that is, I can run the webapp on tomcat from eclipse, without copy/pasting all the requisite files into tomcat, which is saving me a boatload of time).
不幸的是,这不是一个很好的答案。我终于从来没有在 eclipse Kepler 上工作过。但是,当我在我的计算机上安装 linux mint 并使用其软件安装程序安装 linux 3.8 (indigo) 时,添加了所有 EE 更新(通过帮助添加的所有 web/xml--> 安装新软件-->indigo 更新站点),安装了 tomcat 7.0,我终于让 eclipse 与 tomcat 配合得很好(也就是说,我可以从 eclipse 在 tomcat 上运行 webapp,而无需将所有必需的文件复制/粘贴到 tomcat 中,这为我节省了大量时间)。
I'm sure there is a better way to do this - if anyone has any thoughts about what may have gone wrong in my initial environment, please advise - I'm curious why it didn't work. Here were the specs:
我确信有更好的方法来做到这一点 - 如果有人对我的初始环境中可能出现的问题有任何想法,请提出建议 - 我很好奇为什么它不起作用。以下是规格:
MacOS 10.6.8 Eclipse 4.3.2 Tomcat 7.0.54
MacOS 10.6.8 Eclipse 4.3.2 Tomcat 7.0.54
My apologies, Raju, for not responding sooner. Thanks for your post.
我很抱歉,拉朱,没有早点回应。谢谢你的帖子。
回答by Raju Sharma
This same problem happened to me before then i got solution for config load error:
同样的问题发生在我身上,然后我得到了配置加载错误的解决方案:
it can be solved Right click on Project-> Build Path-> Configure Build Path->go Library tab-> Add External Jar-> browse (Apache TomCat Folder->lib->and add servlet-api.jar) add click ok. it run fine for me.
可以解决右键项目->构建路径->配置构建路径->转到库选项卡->添加外部Jar->浏览(Apache TomCat文件夹->lib->并添加servlet-api.jar)添加点击确定. 它对我来说运行良好。
回答by Arpit kumar
How to solve:
怎么解决:
Close Eclipse Copy all files from TOMCAT_7_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server at localhost-config Start Eclipse Expand the Servers project, click on the Tomcat 7 project and hit F5 Start Tomcat from Eclipse
关闭 Eclipse 将所有文件从 TOMCAT_7_HOME/conf 复制到 WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server at localhost-config 启动 Eclipse 展开 Servers 项目,单击 Tomcat 7 项目并按 F5 从 Eclipse 启动 Tomcat
回答by Krishna
I am facing this issue. I have fixed as following way,
我正面临这个问题。我已按以下方式修复,
Step 1: Delete server at local host(Server tab)
步骤 1:删除本地主机上的服务器(服务器选项卡)
Step 2: Delete Servers folder in (navigator/project explorer)
第 2 步:删除(导航器/项目资源管理器)中的 Servers 文件夹
Step 3: After add New->server->Apache->choose path
第三步:添加后新建->服务器->Apache->选择路径
Step 4: start the server
第四步:启动服务器
After it will work......
之后就可以了......
回答by angelito
This is a permissions problem(I had the same issue in ubuntu 14.04, eclipse luna, tomcat7). The executable files are not marked as "executable" when tomcat is donwloaded from eclipse.
这是一个权限问题(我在 ubuntu 14.04、eclipse luna、tomcat7 中遇到了同样的问题)。从 Eclipse 下载 tomcat 时,可执行文件未标记为“可执行文件”。
Just go to your "[tomcat]/bin" directory in your file system and add execution permission (x) to all .sh files. Then go back to eclipse/servers tab, delete the tomcat7 entry an create again, finally start tomcat from eclipse.
只需转到文件系统中的“[tomcat]/bin”目录,并为所有 .sh 文件添加执行权限 (x)。然后回到 eclipse/servers 选项卡,删除 tomcat7 条目并再次创建,最后从 eclipse 启动 tomcat。
回答by Eric Majors
I found that this is a good old fashion directory naming convention problem. I'm running Linux Ubuntu and noticed that right under {your work space}/Servers there appeared a strange error type file when I opened it had all kinds of chunks of the crazy long directory name "Tomcat 7.0 Server... bla bla" So I deleted the Server, then made use of this little ditty cause my version also won't let me re-add the server again: 1. Close Eclipse 2. In {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings delete the following two files: org.eclipse.wst.server.core.prefs org.eclipse.jst.server.tomcat.core.prefs 3. Restart Eclipse
我发现这是一个很好的旧时尚目录命名约定问题。我正在运行 Linux Ubuntu 并注意到在 {your work space}/Servers 下,当我打开它时出现了一个奇怪的错误类型文件,其中包含各种疯狂的长目录名称“Tomcat 7.0 Server ... bla bla”所以我删除了服务器,然后利用了这个小曲子,因为我的版本也不会让我重新添加服务器: 1. 关闭 Eclipse 2. 在 {workspace-directory}/.metadata/.plugins/org 中。 eclipse.core.runtime/.settings 删除以下两个文件: org.eclipse.wst.server.core.prefs org.eclipse.jst.server.tomcat.core.prefs 3.重启Eclipse
Then I re-added the server using a friendlier server name without any crazy spaces or chars: Tomcat7ServerAtLocalHost
然后我使用更友好的服务器名称重新添加了服务器,没有任何疯狂的空格或字符:Tomcat7ServerAtLocalHost
The wella... it started with a brand new error for me to debug... which means I'm on the right track... BTW, the new error is: "Cannot publish to the server because it is missing its runtime environment."
Wella...它以一个全新的错误开始让我调试...这意味着我在正确的轨道上...顺便说一句,新错误是:“无法发布到服务器,因为它缺少运行时环境。”
So I'm off to debug that mess... Cheers!
所以我要去调试那个烂摊子……干杯!
回答by tonga
This problem is mostly associated with file permissions. So the best way to solve the problem is to install a local copy of Tomcat on your development machine instead of putting Tomcat in a system directory such as /usr/share/tomcat7
. This way all Tomcat conf files belong to the user and user group so that it can be run from Eclipse by the user. I normally place Tomcat at my local folder such as /home/abc/dev
and it works perfectly with Eclipse development environment.
这个问题主要与文件权限有关。所以解决这个问题最好的办法是在你的开发机器上安装一个本地的Tomcat副本,而不是把Tomcat放在/usr/share/tomcat7
. 这样所有 Tomcat conf 文件都属于用户和用户组,以便用户可以从 Eclipse 运行它。我通常将 Tomcat 放在我的本地文件夹中,例如/home/abc/dev
它可以与 Eclipse 开发环境完美配合。
回答by Pawan Kumar Baranwal
Go to Server --> Apache Tomcat v7.0 --> Add Select jre7 instead of Workbench default JRE Click on Finish Stop Server and then Start Server
转到服务器 --> Apache Tomcat v7.0 --> 添加 选择 jre7 而不是 Workbench 默认的 JRE 单击完成停止服务器然后启动服务器
回答by Satish Karuturi
How to solve:
怎么解决:
1.Close Eclipse
1.关闭Eclipse
2.Copy all files from TOMCAT_7_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v7.0.53 Server at localhost-config
2.将 TOMCAT_7_HOME/conf 中的所有文件复制到 WORKSPACE_FOLDER/Servers/Tomcat v7.0.53 Server at localhost-config
3.Start Eclipse
3.启动日食
4.Expand the Servers project, click on the Tomcat 7 project and hit F5
4.展开Servers项目,点击Tomcat 7项目,按F5
5.Start Tomcat from Eclipse
5.从Eclipse启动Tomcat
回答by Jachumbelechao Unto Mantekilla
For me the only solution that works is this solution suggested here: Could not load the Tomcat server configuration
对我来说,唯一有效的解决方案是这里建议的解决方案: Could not load the Tomcat server configuration
cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf conf
sudo ln -s /var/log/tomcat7 log
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo chmod -R a+rwx /usr/share/tomcat7/conf