Eclipse 中缺少服务器配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2175709/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:09:26  来源:igfitidea点击:

Server configuration is missing in Eclipse

eclipsetomcat

提问by John

Im using Eclipse Galileo, and have configured it for Apache Tomcat . I have added Apache Tomcat 6.0 to Windows->Server->Runtime Environments, with the following settings:

我使用 Eclipse Galileo,并为 Apache Tomcat 配置了它。我已将 Apache Tomcat 6.0 添加到 Windows->Server->Runtime Environments,并使用以下设置:

Tomcat Installation Directory - C:\apache-tomcat-6.0.24\apache-tomcat-6.0.24
JRE - Workbench Default JRE (This points to C:\Program Files\Java\jre6)

Now, I create a Dynamic Web Project, and add a JSP file to it. But, when I run the project I get the following error:

现在,我创建了一个动态 Web 项目,并向其中添加了一个 JSP 文件。但是,当我运行该项目时,出现以下错误:

The Tomcat server configuration at \Servers\Tomcat v6.0 Server at localhost-config is missing. Check the server for errors.

Any way to fix this?

有任何解决这个问题的方法吗?

回答by Linh Lino

Probably, you have some problems with your server's configuration. Follow these steps to remove and create a new one, it might help you.

可能您的服务器配置有问题。按照以下步骤删除并创建一个新的,它可能对您有所帮助。

In Eclipse
1. Window -> Show view -> Servers (If you cannot see it, you might need to choose Others -> Server)
2. From Server view -> Delete the server which has problems.
3. Right click -> New -> Server : to create a new one

在 Eclipse 中
1. 窗口 -> 显示视图 -> 服务器(如果看不到,可能需要选择其他 -> 服务器)
2. 从服务器视图 -> 删除有问题的服务器。
3.右键->新建->服务器:新建一个

In my case, after new server was created, I get rid of this "localhost-config is missing"

就我而言,在创建新服务器后,我摆脱了这个“缺少 localhost-config”

回答by isuru chathuranga

I faced the same problem once. THe reason for this is that even though the server is available, the config files are missing. You can see the server at Windows -> Show view -> Servers. Their configuration files can be seen at Project Explorer -> Servers. For some reason this second mentioned config files were missing.

我曾经遇到过同样的问题。原因是即使服务器可用,配置文件也丢失了。您可以在Windows -> Show view -> Servers 看到服务器。他们的配置文件可以在Project Explorer -> Servers 中看到。出于某种原因,第二个提到的配置文件丢失了。

I simply deleted the existing server and created a new one with this the config files were also created and the problem was solved!

我只是删除了现有服务器并创建了一个新服务器,同时还创建了配置文件并解决了问题!

Similar solution is given at here by Emertana EM java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

Emertana EM java.lang.NoClassDefFoundError在此处给出了类似的解决方案 :org/apache/juli/logging/LogFactory

回答by G.Noulas

In Eclipse Neo
1. Window -> Show view -> Servers
2. Right click on server -> choose Properties
3. From General Tab -> Switch Location

在 Eclipse Neo
1. 窗口 -> 显示视图 -> 服务器
2. 右键单击​​服务器 -> 选择属性
3. 从常规选项卡 -> 切换位置

回答by Feras

From project explorer ,just make sure that Servers is not closed enter image description here

从项目资源管理器中,只需确保服务器未关闭 在此处输入图片说明

回答by plain_text

As Yoni already mentioned, you probably deleted the project named "Servers" from your Project Explorer. If config files for the server still present on a file system, the quickest way to restore it will be Right Click in Project Explorer->Import->General->Existing Projects into Workspace, then select the root dir where Servers dir located, set checkbox near "Servers" and finally click Finish. If everything works as expected, you should see the 'Servers' project added to the Project Explorer view and your old config files will be there. Finally, save the tomcat configuration which you had open. You can startup your Tomcat server without errors now.

正如 Yoni 已经提到的,您可能从 Project Explorer 中删除了名为“Servers”的项目。如果服务器的配置文件仍然存在于文件系统上,恢复它的最快方法是在项目资源管理器中右键单击->导入->常规->现有项目到工作区,然后选择服务器目录所在的根目录,设置“服务器”附近的复选框,最后单击“完成”。如果一切正常,您应该会看到“服务器”项目已添加到项目资源管理器视图中,并且您的旧配置文件将在那里。最后,保存您打开的 tomcat 配置。您现在可以毫无错误地启动 Tomcat 服务器。

回答by BalusC

You need to define the server instance in the Serversview.

您需要在Servers视图中定义服务器实例。

In the box at the right bottom, press the Serverstab and add the server there. You by the way don't necessarily need to add it through global IDE preferences. It will be automagically added when you define it in Serversview. The preference you've modified just defines default locations, not the whole server instance itself. If you for instance upgrade/move the server, you can change the physical location there.

在右下角的框中,按Servers选项卡并在那里添加服务器。顺便说一下,您不一定需要通过全局 IDE 首选项添加它。当您在服务器视图中定义它时,它将自动添加。您修改的首选项只定义了默认位置,而不是整个服务器实例本身。例如,如果您升级/移动服务器,您可以更改那里的物理位置。

Once defining the server in the Serversview, you need to add the newly created server instance to the project through its Serverand Targeted runtimepreference.

服务器视图中定义服务器后,您需要通过其服务器目标运行时首选项将新创建的服务器实例添加到项目中。

回答by Nathan Adams

If you're not too attached to your current workspace you can create a new workspace, follow BalusC's steps for server creation, and recreate your project in the new workspace.

如果您不太喜欢当前工作区,您可以创建一个新工作区,按照 BalusC 的步骤创建服务器,然后在新工作区中重新创建您的项目。

I got the same error after installing Eclipse Java EE IDE for Web Developers(Juno) but using the workspace of a much older Eclipse installation. When I created a new workspace I was able to get my Tomcat server running without this error.

在为 Web Developers(Juno) 安装 Eclipse Java EE IDE 后,我遇到了同样的错误,但使用了更旧的 Eclipse 安装的工作区。当我创建一个新的工作区时,我能够让我的 Tomcat 服务器运行而不会出现此错误。

回答by Yoni

Did you, by any chance, deleted stuff from your workspace, or moved it around?

你有没有从你的工作区中删除过一些东西,或者移动过它?

When you create a server for the first time, either globally or through the project's "run on server" settings, Eclipse creates a project in the Servers view, as BalusC pointed out. Eclipse stores this server inside your workspace, in a project called Servers. The project needs to be open for tomcat to run.

正如 BalusC 指出的那样,当您第一次创建服务器时,无论是全局还是通过项目的“在服务器上运行”设置,Eclipse 都会在服务器视图中创建一个项目。Eclipse 将此服务器存储在您的工作区中,名为 Servers 的项目中。项目需要打开才能运行tomcat。

(If you want, you can store the server settings elsewher. You can right click and open the server instance from the Servers view and configure various parameters and locations)

(如果需要,您可以将服务器设置存储在其他地方。您可以右键单击并从“服务器”视图中打开服务器实例并配置各种参数和位置)

回答by Billy

This happens when Eclipse shuts down incorrectly - delete the server and then re-create it again.

当 Eclipse 错误关闭时会发生这种情况 - 删除服务器然后重新创建它。

回答by Onur

Remove the server from IDE and install again to it.

从 IDE 中删除服务器并重新安装。