Java 无法加载 Tomcat 服务器配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30962732/
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
Could not load the Tomcat server configuration
提问by insanely_sin
I have installed apache tomcat7 using sudo apt get in ubuntu. I have added apache tomcat 7 to eclipse using Windows > Preferences > Server > Runtime Environment.But when I'm starting the server from server view by right clicking the shown Tomcat v7.0 Server at localhost [Stopped,Republish]It says:
我已经在 ubuntu 中使用 sudo apt get 安装了 apache tomcat7。我已经使用 Windows > Preferences > Server > Runtime Environment 将 apache tomcat 7 添加到 Eclipse。但是当我通过右键单击显示的Tomcat v7.0 Server at localhost [Stopped,Republish]从服务器视图启动服务器时,它说:
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 服务器配置。配置可能已损坏或不完整。
The path to tomcat7 that I've provided is /usr/share/tomcat7
我提供的 tomcat7 的路径是/usr/share/tomcat7
回答by metropolision
You can install tomcat7 in ~/tomcat7
instead of /usr/share/tomcat7
.
您可以安装 tomcat7~/tomcat7
而不是/usr/share/tomcat7
.
- Close Eclipse.
- Delete
org.eclipse.wst.server.core.prefs
andorg.eclipse.jst.server.tomcat.core.prefs
in{workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
. - Launch Eclipse.
- Go to Window->Show View->Other... and choose the Servers.
- Select Tomcat v7.0 Server from the server type and press Next.
- Enter
/home/user/tomcat7
(not/usr/share/tomcat7
) into the "Tomcat installation directory" and press Download. - Wait a few minutes and press Finish.
- 关闭日食。
- 删除
org.eclipse.wst.server.core.prefs
并org.eclipse.jst.server.tomcat.core.prefs
在{workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
. - 启动 Eclipse。
- 转到窗口->显示视图->其他...并选择服务器。
- 从服务器类型中选择 Tomcat v7.0 Server,然后按下一步。
- 在“Tomcat安装目录”中输入
/home/user/tomcat7
(not/usr/share/tomcat7
)并按下载。 - 等待几分钟,然后按完成。
tomcat7 worked correctly with Eclipse 4.4 on my Ubuntu 15.04 in this way.
tomcat7 以这种方式在我的 Ubuntu 15.04 上与 Eclipse 4.4 一起正常工作。
回答by Tianhao Luan
The application is trying to load /usr/share/tomcat7/conf/
which doesn't exist. Eclipse assumes conf
is in the same directory as bin
应用程序正在尝试加载/usr/share/tomcat7/conf/
不存在的内容。Eclipse 假定conf
与bin
In Ubuntu, conf is placed in /etc/tomcat7/
and there is a symbolic link in /var/lib/tomcat7/
.
在 Ubuntu 中,conf 被放置/etc/tomcat7/
在/var/lib/tomcat7/
.
To solve this, you can either
要解决此问题,您可以
- Download package from Apache Tomcat, and place them in a specific directory, say
/opt/
or - Create a symbolic link in
/usr/share/tomcat7/
pointing to/etc/tomcat7/conf
- 从Apache Tomcat下载包,并将它们放在特定目录中,例如
/opt/
或 - 创建
/usr/share/tomcat7/
指向的符号链接/etc/tomcat7/conf
回答by Andy
I've just been encountering a very similar issue in Ubuntu while trying to get Eclipse Mars and Tomcat7 integrated because Eclipse was expecting the tomcat configuration files etc to be all in the same location, and with the necessary permissions to be able to change those files.
我刚刚在尝试将 Eclipse Mars 和 Tomcat7 集成时在 Ubuntu 中遇到了一个非常相似的问题,因为 Eclipse 期望 tomcat 配置文件等都在同一位置,并且具有能够更改这些文件的必要权限.
The following instructions from this blog articlehelped me in the end:
这篇博客文章中的以下说明最终帮助了我:
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
回答by Computer Science Student
I've just solved this exact problem on my Ubuntu 14.04 with Eclipse Mars 2.
我刚刚使用 Eclipse Mars 2 在我的 Ubuntu 14.04 上解决了这个确切的问题。
This could happen when Eclipse is not finding Tomcat's configuration files where they are expected to be. This place is in
当 Eclipse 未在预期位置找到 Tomcat 的配置文件时,可能会发生这种情况。这个地方在
$eclipse_workspace_folder/$version_of_your_tomcat_server_at_localhost/
$eclipse_workspace_folder/$version_of_your_tomcat_server_at_localhost/
(by default if you didn't changed server's name). So you have to copy all the files under your $tomcat_installation_folder/conf/*to the workspace server's folder.
(默认情况下,如果您没有更改服务器的名称)。因此,您必须将$tomcat_installation_folder/conf/*下的所有文件复制到工作区服务器的文件夹中。
But it was easier to just remove the server from your server list and add it again. Eclipse will automatically recreate all these files again into the proper folders. Like in the picture below:
但是从服务器列表中删除服务器并重新添加它会更容易。Eclipse 会自动将所有这些文件重新创建到正确的文件夹中。如下图所示:
In my case I've downloaded tomcat-8.0.35 from the website, so the configuration files needed are in /opt/apache-tomcat-8.0.35/conf/ filesystem.
就我而言,我已经从网站下载了 tomcat-8.0.35,因此所需的配置文件在 /opt/apache-tomcat-8.0.35/conf/ 文件系统中。
Just delete the desired server from the Servers view (Window -> Show View -> Servers) and then go to Window -> Preferences -> Server -> Runtime Environment -> Addand add the server again.
只需从 Servers 视图(Window -> Show View -> Servers)中删除所需的服务器,然后转到Window -> Preferences -> Server -> Runtime Environment -> Add并再次添加服务器。
回答by ru51an
I have Windows 8.1, Eclipse Neon, Tomcat 8.
我有 Windows 8.1、Eclipse Neon、Tomcat 8。
The solution is to copy all the files from folder ".../Tomcatxxx/conf"
to the ".../Workspace_directory/Servers"
and try to launch server again.
解决方案是将文件夹".../Tomcatxxx/conf"
中的所有文件复制到".../Workspace_directory/Servers"
并尝试再次启动服务器。
回答by Dev M
You tried to start Tomcat and got the following error:
您尝试启动 Tomcat 并收到以下错误:
Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete
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
- 关闭日食
- 将 TOMCAT_7_HOME/conf 中的所有文件复制到 localhost-config 的 WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server
- 启动日食
- 展开 Servers 项目,单击 Tomcat 7 项目并按 F5
- 从 Eclipse 启动 Tomcat
回答by theRiley
on Centos 7, this will do it, for Tomcat 7 : (my tomcat install dir: opt/apache-tomcat-7.0.79)
在 Centos 7 上,这将做到,对于 Tomcat 7 :(我的 tomcat 安装目录:opt/apache-tomcat-7.0.79)
- mkdir /var/lib/tomcat7
- cd /var/lib/tomcat7
- sudo ln -s /opt/apache-tomcat-7.0.79/conf conf
- mkdir /var/log/tomcat7
- cd /var/log/tomcat7
- sudo ln -s /opt/apache-tomcat-7.0.79/logs log
- mkdir /var/lib/tomcat7
- cd /var/lib/tomcat7
- 须藤 ln -s /opt/apache-tomcat-7.0.79/conf conf
- mkdir /var/log/tomcat7
- cd /var/log/tomcat7
- 须藤 ln -s /opt/apache-tomcat-7.0.79/logs 日志
not sure the log link is necessary, the configuration is the critical one.
不确定日志链接是否必要,配置是关键之一。
:
:
回答by Moika Turns
Had the same issue with Kepler (after trying to add a Tomcat 7 server).
与 Kepler 有同样的问题(在尝试添加 Tomcat 7 服务器之后)。
Whilst adding the server I opted to install the Tomcat binary using the download/install feature inside Eclipse. I added the server without adding any apps. After the install I tried adding an app and got the error.
在添加服务器时,我选择使用 Eclipse 中的下载/安装功能安装 Tomcat 二进制文件。我在没有添加任何应用程序的情况下添加了服务器。安装后,我尝试添加一个应用程序并收到错误消息。
I immediately deleted the Tomcat 7 server from Eclipse then repeated the same steps to add Tomcat 7 back in (obviously skipping the download/install step as the binary was downloaded first time around).
我立即从 Eclipse 中删除了 Tomcat 7 服务器,然后重复相同的步骤将 Tomcat 7 添加回(显然跳过下载/安装步骤,因为第一次下载二进制文件)。
After adding Tomcat 7 a second time I tried adding / publishing an app and it worked fine. Didn't bother with any further RCA, it started working and that was good enough for me.
第二次添加 Tomcat 7 后,我尝试添加/发布一个应用程序,它运行良好。没有打扰任何进一步的 RCA,它开始工作,这对我来说已经足够了。
回答by bibekaa
I had the same problem in Eclipse Oxygen with Tomcat 8 in ubuntu 16.04 LTS.
我在 Ubuntu 16.04 LTS 中使用 Tomcat 8 的 Eclipse Oxygen 中遇到了同样的问题。
Solution: 1. Give permission to entire tomcat folder (chmod 777 -R /Tomcat) 2. Delete and re-add the server in eclipse 3. Restart eclipse 4. Start the tomcat server. It will work..........
解决方法: 1.给整个tomcat文件夹权限(chmod 777 -R /Tomcat) 2.在eclipse中删除并重新添加服务器3.重启eclipse 4.启动tomcat服务器。它会工作......
回答by xcomp
I know it's been a while since this question was posted, but I was just getting this exact error, and I have a really simple solution that MIGHT work for some. All I did was double click on the folder 'Servers', which then allowed me to start the server with no error message. Sometimes the solution is right in front of your eyes. This might work for some people like me who go straight to google without trying fix the issue themselves!
我知道这个问题发布已经有一段时间了,但我刚刚收到这个确切的错误,我有一个非常简单的解决方案,可能对某些人有用。我所做的只是双击文件夹“服务器”,然后我就可以启动服务器而没有错误消息。有时,解决方案就在您的眼前。这可能适用于像我这样直接去谷歌而不尝试自己解决问题的人!