Java TomEE 启动但 Netbeans 出现“无法启动”错误

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

TomEE starts but Netbeans gives "Failed to start" error

javatomcatnetbeanstomee

提问by Mugi4ok

I'm using NetBeans 8.0.2 (also, tried it in the latest nightly build) and trying to start TomEE Plume server on port 8084 (tried it on different port too). Server starts and works fine, but NetBeans thinks it is not started and after approximately 2 minutes of waiting ("Waiting for Tomcat") throws an error window "Tomcat failed to start" or something like that.

我正在使用 NetBeans 8.0.2(也在最新的每晚版本中尝试过)并尝试在端口 8084 上启动 TomEE Plume 服务器(也在不同的端口上尝试过)。服务器启动并工作正常,但 NetBeans 认为它​​没有启动,等待大约 2 分钟后(“等待 Tomcat”)抛出一个错误窗口“Tomcat 无法启动”或类似的东西。

There are questions similar to mine with the difference that I have totally no errors, only "Tomcat failed to start" window, so I can't even put the log here as it says nothing useful. Also, available solutions are not working for me.

有一些与我类似的问题,不同之处在于我完全没有错误,只有“Tomcat 无法启动”窗口,所以我什至不能把日志放在这里,因为它没有任何用处。此外,可用的解决方案对我不起作用。

I believe that there's some communication problems between NetBeans and TomEE, also I'm almost sure the problem is in NetBeans because TomEE works well and starts as it should, localhost:8084 gives me Tomcat page though NetBeans think it failed to start. There's some small chance that for some reason TomEE is not sending confirmation to NetBeans after starting, but I really have no ideas how to check that.

我相信 NetBeans 和 TomEE 之间存在一些通信问题,而且我几乎可以肯定问题出在 NetBeans 中,因为 TomEE 运行良好并按预期启动,localhost:8084 为我提供了 Tomcat 页面,尽管 NetBeans 认为它​​无法启动。由于某种原因,TomEE 在启​​动后没有向 NetBeans 发送确认的可能性很小,但我真的不知道如何检查。

I've looked into the same issues, two most common problems are "'127.0.0.1*' is not recognized as an internal or external command" and the very same I have. Solution suggested was to choose "No proxy" in the Tools-Options, still it didn't help me.

我研究过同样的问题,两个最常见的问题是“'127.0.0.1*' 未被识别为内部或外部命令”,我也遇到过同样的问题。建议的解决方案是在工具选项中选择“无代理”,但它仍然没有帮助我。

Also, just to be sure, I've edited catalina.batfile and checked my user permissions that are roles="admin-gui,manager-gui,admin,manager-script".

另外,可以肯定的是,我已经编辑了catalina.bat文件并检查了我的用户权限roles="admin-gui,manager-gui,admin,manager-script".

I hope someone faced the same issue. Also, I'd like to know is this problem even solvable. Thanks.

我希望有人面临同样的问题。另外,我想知道这个问题是否可以解决。谢谢。

采纳答案by Steve F.

In server.xml, remove the xpoweredBy and server attributes from the connector:

在 server.xml 中,从连接器中删除 xpoweredBy 和 server 属性:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" xpoweredBy="false"
           server="Apache TomEE" />

回答by Howard

NetBeans 8.0.2was working well with TomEE+ 1.7.1, but then I upgraded from TomEE+ 1.7.1 to 1.7.2, added TomEE+ 1.7.2 in Services> Serversin NetBeans 8.0.2, and that's when I experienced the 'Failed to start' error while running latest-and-patched NetBeans 8.0.2 and TomEE+ 1.7.2.

NetBeans 8.0.2TomEE+ 1.7.1运行良好,但后来我从 TomEE+ 1.7.1 升级到1.7.2,在 NetBeans 8.0.2中的服务>服务器中添加了 TomEE+ 1.7.2 ,这就是我遇到“失败”的时候在运行最新和打补丁的 NetBeans 8.0.2 和 TomEE+ 1.7.2 时启动'错误。

In server.xml, I had the following:

在 server.xml 中,我有以下内容:

<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" connectionTimeout="20000" acceptorThreadCount="2"
           redirectPort="8443" socket.directBuffer="false"/>

I attempted to modify the Connector, but that did not fix the issue.

我试图修改Connector,但这并没有解决问题。

The fix for me was to uncheck the Use IDE Proxy Settingscheckbox on the Platformtab of the Server properties of Apache TomEE+ 1.7.2. See below.

我的解决方法是取消选中Apache TomEE+ 1.7.2 的服务器属性的平台选项卡上的使用 IDE 代理设置复选框。见下文。

enter image description here

在此处输入图片说明

回答by Miklos Krivan

Today I have met with the same situation when I wanted to upgrade from TomEE1.7.0to 1.7.2and based on Mugi4ok's question and Howard's and Steve's answers (because all of you are right but the root of the problem remains in the system) I did some deeper analysis on the mentioned situation and finally I have found the root of it.

今天我遇到了同样的情况,当我想从TomEE 1.7.0升级到1.7.2并基于Mugi4ok的问题以及HowardSteve的回答(因为你们所有人都是对的,但是问题仍然存在于系统中)我对上述情况进行了更深入的分析,最后我找到了它的根源。

There are two different issuesin the new TomEE release (1.7.2)

新的 TomEE 版本 (1.7.2) 中有两个不同的问题

  • One raises when you start the debug or run session in NetBeans and you get immediately the message: The given name (127.0.0.1*) could not be recognized by the system as command ...
  • The other raises at the end of the deployment process which generates the long running situation
  • 当您在 NetBeans 中启动调试或运行会话时,您会立即收到以下消息:系统无法将给定的名称 (127.0.0.1*) 识别为命令...
  • 另一个在部署过程结束时引发,这会产生长时间运行的情况

Let's see the first case. Because it is generated at the very beginning of the run/debug process I have checked first the catalina.bat script because it is called first. I have compared the both version coming from TomEE 1.7.0 and 1.7.2. And the problem was almost trivial.

我们来看第一种情况。因为它是在运行/调试过程开始时生成的,所以我首先检查了 catalina.bat 脚本,因为它首先被调用。我比较了来自 TomEE 1.7.0 和 1.7.2 的两个版本。这个问题几乎是微不足道的。

TomEE changed two lines in the script:

TomEE 在脚本中更改了两行:

in 1.7.0 it was this:

在 1.7.0 中是这样的:

set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

but in 1.7.2 they put quotes around it:

但在 1.7.2 中,他们在其周围加上了引号:

set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"

And that is a big change if the JAVA_OPTS environment variable contains quote as well. And if use NetBeans and we use nonProxyHosts setup and we have switched on the "Use IDE Proxy settings" checkbox at the platform setup of the TomEE server we will have something like this in JAVA_OPTS (I have just extracted the relevant value for our case of course we have many other parameters as well):

如果 JAVA_OPTS 环境变量也包含引用,那将是一个很大的变化。如果使用 NetBeans 并且我们使用 nonProxyHosts 设置并且我们在 TomEE 服务器的平台设置中打开了“使用 IDE 代理设置”复选框,我们将在 JAVA_OPTS 中有类似的内容(我刚刚为我们的案例提取了相关值当然,我们还有许多其他参数):

 -Dhttp.nonProxyHosts="localhost*|127.0.0.1*|10.*"

If you look carefully on the first quote and you look at the first pipe character you already know what happens :-)

如果您仔细查看第一个引号并查看第一个管道字符,您就已经知道会发生什么:-)

Just write this command into the shell and try to execute:

只需将此命令写入shell并尝试执行:

set "JAVA_OPTS=-Dhttp.nonProxyHosts="localhost*|127.0.0.1*|10*"

The first pipe character will act as is so the command shell will try to interpret the following string as a command but 127.0.0.1* is not a command.

第一个管道字符将按原样运行,因此命令外壳将尝试将以下字符串解释为命令,但 127.0.0.1* 不是命令。

So my suggested solution is delete the extra quotes in the the new release as it was in the previous release. They are in the 179 and 184 rows and the problem simple will be disappeared and you need not to eliminate the proxy settings at all, you can use them as you need. In this case you need not to switch off the Proxy settings switch as well. If you want to rely on the NetBeans proxy settings you can do with this small modification.

所以我建议的解决方案是删除新版本中的额外引号,就像在以前的版本中一样。它们在 179 和 184 行,简单的问题就会消失,您根本不需要取消代理设置,您可以根据需要使用它们。在这种情况下,您也不需要关闭代理设置开关。如果您想依赖 NetBeans 代理设置,您可以通过这个小的修改来完成。

The second situation which generates timeout in deploymentit was extremely strange for me and only the Steve's answer helped meso thanks for it.

在部署中产生超时的第二种情况对我来说非常奇怪,只有史蒂夫的回答帮助了我,所以感谢它。

Summary if you see some bugs in a new release of any open source system first check the modification and try to find which back step by step. In this case this solved everything.

总结 如果您在任何开源系统的新版本中看到一些错误,请首先检查修改并尝试逐步找到哪个回退。在这种情况下,这解决了一切。

I hope that TomEE will also recognize this and repair them soon in the next release or they create a patch for it.

我希望 TomEE 也能认识到这一点并在下一个版本中尽快修复它们,或者他们为它创建一个补丁。

回答by diego matos - keke

if you have an only message "Failed to Start" when add a new server in Netbeans 8.X -> Go to

如果在 Netbeans 8.X 中添加新服务器时只有一条消息“无法启动”-> 转到

Servers> (select your server added) > plataform > "used ide proxy settings"

服务器>(选择您添加的服务器)>平台>“使用的IDE代理设置”

Unckeck "used ide proxy settings"

取消选中“使用的 ide 代理设置”

回答by Michael Stokes

I'd check the proxy settings in netbeans under preferences to be "No Proxy" rather than "Use System Proxy Settings".

我会在首选项下检查 netbeans 中的代理设置为“无代理”而不是“使用系统代理设置”。

Worked for me.

为我工作。

Source: https://www.youtube.com/watch?v=uI1j-8F8eN4

来源:https: //www.youtube.com/watch?v=uI1j-8F8eN4

回答by Guilherme

In tomcat 8.5.11 with Netbeans 8.1 I had to change this:

在带有 Netbeans 8.1 的 tomcat 8.5.11 中,我不得不改变这个:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000" 
           redirectPort="8443" />

for this:

为了这:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000" xpoweredBy="false" server="Apache-Coyote/1.1"
           redirectPort="8443" />

In server.xml file.

在 server.xml 文件中。