TomEE starts but Netbeans gives "Failed to start" error

28,947

Solution 1

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

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

Solution 2

NetBeans 8.0.2 was 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 > Servers in 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.

In server.xml, I had the following:

<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.

The fix for me was to uncheck the Use IDE Proxy Settings checkbox on the Platform tab of the Server properties of Apache TomEE+ 1.7.2. See below.

enter image description here

Solution 3

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

Worked for me.

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

Solution 4

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

<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.

Solution 5

Today I have met with the same situation when I wanted to upgrade from TomEE 1.7.0 to 1.7.2 and 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.

There are two different issues in the new TomEE release (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

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.

TomEE changed two lines in the script:

in 1.7.0 it was this:

set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

but in 1.7.2 they put quotes around it:

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):

 -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:

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.

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.

The second situation which generates timeout in deployment it was extremely strange for me and only the Steve's answer helped me so 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.

Share:
28,947
Mugi4ok
Author by

Mugi4ok

SOreadytohelp

Updated on March 06, 2020

Comments

  • Mugi4ok
    Mugi4ok about 4 years

    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.

    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.

    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.

    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.

    Also, just to be sure, I've edited catalina.bat file and checked my user permissions that are 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.

  • Mugi4ok
    Mugi4ok almost 9 years
    Never seen this solution before, but that did it, thank you, @Steve! Also, have no idea why those two attributes influence NetBeans in that kind of way.
  • Mugi4ok
    Mugi4ok almost 9 years
    Thank you for the answer! I believe your method can work as well as editing server.xml, I will try that a bit later. Also, giving you imaginary upvote because can't give you the real one.
  • Miklos Krivan
    Miklos Krivan almost 9 years
    Working solution but I would suggest to repair the catalina.bat file instead. The new version contains quotes in two places around SET JAVA_OPTS which has interference with Netbeans nonProxyHost value. The previous version had no quotes. See my detailed answer below.
  • Miklos Krivan
    Miklos Krivan almost 9 years
    This was the only solution for me to eliminate the long running situation at the and of deployment. Unfortunately I did not get the exact explanation of this situation. But your workaround is good. Thx :-)
  • Howard
    Howard almost 9 years
    Excellent analysis and answer! Thanks.
  • andbi
    andbi almost 9 years
    lol, it works! would like the author to elaborate a bit more on the solution, too.
  • OndroMih
    OndroMih over 8 years
    It seems that removing only server attribute is enough. It was sufficient for me to fix the issue. xpoweredBy seems to be unrelated to the problem..
  • LyK
    LyK over 8 years
    Have the same issue, but none of the mentioned solutions worked :/ If it makes any diff, I am in OS X
  • LyK
    LyK over 8 years
    Finally! Removing the server attribute worked for me! I also removed the quotes " as mentioned in the other answer, but without removing the server it did not work
  • Eymen
    Eymen over 8 years
    Great. Thanks. This did it after spending 2 hours to find the solution.
  • Suresh Atta
    Suresh Atta over 6 years
    Superb guy. Worked. This shoule be the accepted answer.
  • MrSalesi
    MrSalesi over 5 years
    For me, This solution was effective for tomcat 7,8
  • nonabhai
    nonabhai almost 5 years
    This worked in my case too. Netbeans 8.0.2, Tomcat 7
  • Adindu Stevens
    Adindu Stevens over 4 years
    It is strange how this is the exact opposite of the marked answer yet it solved my problem. In any case, thank you.
  • user390525
    user390525 over 4 years
    Thanks :) This helped me too; I have TomEE plume 1.7.4/NetBeans 8.0.1/Linux; But can you give more details why the server.xml needs this modification in case of NetBeans cause I have it working fine with my Eclipse?