java 尝试通过 Intellij IDEA 部署 tomcat 服务器并得到一个奇怪的缺少 server.xml 错误

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

Trying to deploy tomcat server through Intellij IDEA and getting a weird missing server.xml error

javaspringtomcatmavenintellij-idea

提问by Anthony

I'll start with the error I'm receiving, and then explain what I have done so far.

我将从我收到的错误开始,然后解释我到目前为止所做的事情。

Error running Guestbook: Cannot load /home/anthony/.IntelliJIdea11/system/tomcat/Unnamed_guestbook-spring/conf/server.xml

Using Intellij IDEA 11 Ultimate Edition:

使用 Intellij IDEA 11 终极版:

I've added the tomcat6 server in the settings -> application servers menu of Intellij IDEA by adding the directory where tomcat is installed, then I went to edit configurations in the run drop-down box, and added the tomcat server local defaults. Under the deployment tab, I clicked + -> Artifacts... and selected the ProjectName:war file artifact.

我在Intellij IDEA的设置->应用服务器菜单中添加tomcat6服务器,添加tomcat安装目录,然后在运行下拉框中编辑配置,添加tomcat服务器本地默认值。在部署选项卡下,我单击 + -> Artifacts... 并选择了 ProjectName:war 文件工件。

Now, when I ran it the first time, it gave me some error like

现在,当我第一次运行它时,它给了我一些错误,例如

no conf folder found in /home/anthony/.IntelliJIdea11/system/tomcat/Unnamed_guestbook-spring/

In a moment of desperation I just made a directory called conf there and the error message, sure enough, changed to:

在绝望的时刻,我只是在那里创建了一个名为 conf 的目录,并且错误消息果然更改为:

Cannot load /home/anthony/.IntelliJIdea11/system/tomcat/Unnamed_guestbook-spring/conf/server.xml

I have no idea where this file should be found, what should be in it, why it's not being created, or most of all - how to get it in the right place. Any help on this one would be greatly appreciated!!

我不知道应该在哪里找到这个文件,里面应该有什么,为什么没有创建它,或者最重要的是 - 如何将它放在正确的位置。对此的任何帮助将不胜感激!!

采纳答案by Anthony

Thanks to CrazyCoder for the tip - I downloaded a vanilla Tomcat 7 installation and added that one in the Application Servers menu, then changed the run configuration to use this instead, and it started right up.

感谢 CrazyCoder 的提示 - 我下载了一个 vanilla Tomcat 7 安装并在 Application Servers 菜单中添加了该安装,然后更改了运行配置以使用它,并且它立即启动。

Appreciate the help!

感谢帮助!

回答by radek1st

It happened to me too. I found out that I accidentally edited server.xml file and it was no longer a valid xml. As it couldn't be parsed properly, it wasn't loaded in. Fixing server.xml resolved the issue.

它也发生在我身上。我发现我不小心编辑了 server.xml 文件,它不再是有效的 xml。由于无法正确解析,因此未加载。修复 server.xml 解决了该问题。