Java Tomcat 服务器未启动。在日食
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24748882/
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
Tomcat server not starting. in eclipse
提问by user3602193
I am trying to host my web app through Tomcat. I am using the Spring framework and have Tomcat set up. I have converted it to a Maven project and one a Maven file and moved the war file to correct webapps folder in the Tomcat installation folder. When I try to run, it gives the me the error:
我正在尝试通过 Tomcat 托管我的 Web 应用程序。我正在使用 Spring 框架并设置了 Tomcat。我已将其转换为一个 Maven 项目和一个 Maven 文件,并将 war 文件移动到 Tomcat 安装文件夹中的正确 webapps 文件夹中。当我尝试运行时,它给了我错误:
Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
In the console, I see that it gets stuck on
在控制台中,我看到它卡住了
Building JPA container EntityManagerFactory for persistence unit 'default'
I am using an MySQL database and in the MySQL workbench it says the server is running. I am really confused as to why this is happening. I have even tried the following:
我正在使用 MySQL 数据库,在 MySQL 工作台中它说服务器正在运行。我真的很困惑为什么会这样。我什至尝试过以下方法:
Click on Window > Show view > Server OR right click on the server in "Servers" view, select "Properties".
In the "General" panel, click on the "Switch Location" button.
The "Location: [workspace metadata]" should replace by something else.
Open the Overview screen for the server by double clicking it.
In the Server locations tab , select "Use Tomcat location".
Save the configurations and restart the Server.
Can someone tell me why this is happening? Thanks for any help
有人能告诉我为什么会这样吗?谢谢你的帮助
回答by Rcordoval
Open the Servers Tab from Windows>Show View>Servers menu.
Right click on the server and delete it.
Create a new server by going New>Server on Server Tab.
Click on “Configure runtime environments…” link.
Select the Apache Tomcat v7.0 server and remove it. This will remove the Tomcat server configuration. This is where many people do mistake – they remove the server but do not remove the Runtime environment.
Click on OK and exit the screen above now.
From the screen below, choose Apache Tomcat v7.0 server and click on next button.
Browse to Tomcat Installation Directory.
Click on Next and choose which project you would like to deploy.
Click on Finish after Adding your project.
Now launch your server. This will fix your Server timeout or any issues with old server configuration. This solution can also be used to fix “port update not being taking place” issues.
从 Windows>Show View>Servers 菜单打开 Servers 选项卡。
右键单击服务器并将其删除。
通过转到“服务器”选项卡上的“新建”>“服务器”来创建新服务器。
单击“配置运行时环境...”链接。
选择 Apache Tomcat v7.0 服务器并将其删除。这将删除 Tomcat 服务器配置。这就是很多人犯错的地方——他们删除了服务器,但没有删除运行时环境。
单击“确定”并立即退出上面的屏幕。
从下面的屏幕中,选择 Apache Tomcat v7.0 服务器并单击下一步按钮。
浏览到 Tomcat 安装目录。
单击下一步并选择您要部署的项目。
添加项目后单击完成。
现在启动您的服务器。这将修复您的服务器超时或旧服务器配置的任何问题。此解决方案还可用于修复“未进行端口更新”的问题。
Source: Fix Tomcat
来源:修复 Tomcat
回答by Rafik BELDI
the server requires more time to start but the default start time limit is 45 seconds
.
服务器需要更多时间启动,但默认启动时间限制为45 seconds
.
All you have to do is open the servers tab, right click on your server and click open , a menu will be opened in your editor , open submenu Timeouts
and change the value of Start (in seconds)
to a higher value for example 300 seconds. and start your server again.
您所要做的就是打开服务器选项卡,右键单击您的服务器并单击打开,将在您的编辑器中打开一个菜单,打开子菜单Timeouts
并将 的值更改Start (in seconds)
为更高的值,例如 300 秒。并再次启动您的服务器。
回答by Yannick
In my case, the problem came from an impossible loopback on localhost.
在我的情况下,问题来自本地主机上不可能的环回。
Tomcat effectively started (I could call "http://localhost:8080/myApp"), but Eclipse didn't get a response of that and it considered Tomcat keep on starting.
Tomcat 有效启动(我可以调用“ http://localhost:8080/myApp”),但 Eclipse 没有得到响应,它认为 Tomcat 继续启动。
A software called ZScaler (set by admin to protect the enterprise) on Windows 10 put loopback restrictions. Fortunately, an option existed to disable loopback restrictions on ZScaler.
Windows 10 上名为 ZScaler(由管理员设置以保护企业)的软件设置了环回限制。幸运的是,有一个选项可以禁用 ZScaler 上的环回限制。
A VPN may cause the same restrictions.
VPN 可能会导致相同的限制。
If you don't find which application cause the trouble, you can change "Host name" in Eclipse's Tomcat General Informations, from "localhost" to "yourIP" (ex : 179.25.14.178), BUT this trick won't allow DEBUG MODE.
如果您没有找到导致问题的应用程序,您可以在 Eclipse 的 Tomcat General Informations 中将“Host name”从“localhost”更改为“yourIP”(例如:179.25.14.178),但此技巧将不允许 DEBUG MODE .