150

Both Google and Stackoverflow have shown me people with similar issues however this error is slightly different in that the IP address is suffixed with an asterisk:

NetBeans 8.0.1 is giving me the following error when trying to start Tomcat.

'127.0.0.1*' is not recognized as an internal or external command, operable program or batch file.

I've got both Tomcat 7.0.56 and Tomcat 8.0.14 installed, they both start OK from the command line (one at a time). I have them added to NetBeans' list of servers as Tomcat 7 and Tomcat 8.

I have a "Hello World" web app which I have configured:
Properties -> Run -> Server: tried both Tomcat 7 and Tomcat 8
Both give the same error.

If I try starting Tomcat using either:
Services -> Servers -> Tomcat 7 -> Start
Services -> Servers -> Tomcat 8 -> Start
I get the same error as when trying to start a web app:

'127.0.0.1*' is not recognized as an internal or external command, operable program or batch file.

Any ideas ?
Even if it's only what that asterisk is doing there ?

user835745
  • 1,974
  • 3
  • 17
  • 18
  • Possible duplicate of [Starting of Tomcat failed from Netbeans](http://stackoverflow.com/questions/22225764/starting-of-tomcat-failed-from-netbeans) – YoYo Sep 28 '16 at 00:59
  • If you want to read deeper analysis on this bug, see my stackoverflow answer from 2015 here https://stackoverflow.com/questions/30647156/tomee-starts-but-netbeans-gives-failed-to-start-error/30958401#30958401 It is for TomEE but it based on Tomcat so the same solution works here as well. Switching off the proxy settings in Netbeans also works of course as some others suggested. – Miklos Krivan Jan 26 '18 at 13:50

4 Answers4

380

Assuming you are on Windows (this bug is caused by the crappy bat files escaping), It is a bug introduced in the latest versions (7.0.56 and 8.0.14) to workaround another bug. Try to remove the " around the JAVA_OPTS declaration in catalina.bat. It fixed it for me with Tomcat 7.0.56 yesterday.

In 7.0.56 in bin/catalina.bat:179 and 184

:noJuliConfig
set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"

..

:noJuliManager
set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%"

to

:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

.. 

:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

For your asterisk, it might only be a configuration of yours somewhere that appends it to the host declaration.

I saw this on Tomcat's bugtracker yesterday but I can't find the link again. Edit Found it! https://issues.apache.org/bugzilla/show_bug.cgi?id=56895

I hope it fixes your problem.

Shashanth
  • 4,995
  • 7
  • 41
  • 51
Johnride
  • 8,476
  • 5
  • 29
  • 39
  • 1
    Worked for Tomcat 8.0.18 / Netbeans 8.0.2 - Thanks! – Predrag Stojadinović Feb 04 '15 at 12:29
  • Worked for me. I am using Tomcat 7.0.59, Thanks! – Sivakumar Feb 10 '15 at 08:55
  • Worked for me, but on different lines: 196 and 201. NetBeans 8.0.2 and Tomcat 8.0.21. Thanks. – zmirc Apr 11 '15 at 10:05
  • Yes this solution is correct. But my question is `why only problem in Netbeans? When I use same server in eclipse project it works but in netbeans does not work' – Yubaraj Apr 16 '15 at 09:44
  • @Yubaraj it is likely because Netbeans calls the catalina.bat script as a parameter of another command using quotes, something like `othercommand --run "catalina.bat"` which would cause an escaping problem further in the script. As stated in my answer, bat files escaping is horrid. This is only my guess though. – Johnride Apr 16 '15 at 13:29
  • Worked when I opened Notepad as an administrator. – Gyan Jul 10 '15 at 04:59
  • Thanks 8.0.24 have the same problem – HadesDX Jul 10 '15 at 06:13
  • nice one. much head-scratching saved here ! [Tomcat 8.0.15.0 on Windows 7] – monojohnny Oct 08 '15 at 16:06
  • Worked for me as well. I am using 7.0.64 – Mr. Port St Joe Oct 10 '15 at 02:13
  • One year later the problem still present in tomcat 8.0.28 on windows7 x64, java 1.8u60 – Alessandro Da Rugna Nov 24 '15 at 11:40
  • For Windows 10 and tomcat 6.0.53. I also had to remove the *DOUBLE QUOTES* for the following snippet: `:gotJsseOpts` `
    ` `set JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS%`
    – Sym-Sym Jun 11 '18 at 18:46
  • the double quotes when JSSE_OPTS get appended to JAVA_OPTS seem to be present also in tomcat 9.0.37 and seem to cause problem in Netbeans when startup.bat is chosen as a custom Catalina script to start up Tomcat (Tomcat server -> Properties -> Startup tab) https://stackoverflow.com/a/58180439/57033 – hello_earth Aug 18 '21 at 13:58
  • (BUT BEWARE: custom Catalina script didn't work anyway for what I wanted to do - it seems to break Netbeans' way of deploying the application that is being debugged) – hello_earth Aug 18 '21 at 14:05
58

After following the steps from @Johnride, I still got the same error.

This fixed the problem:

Tools-> Options-> Select no proxy

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

Sumama Waheed
  • 3,579
  • 3
  • 18
  • 32
  • I needed to use both solutions to solve it in my machine. – HadesDX Aug 31 '16 at 18:24
  • 4
    This actually fixes it for me for Tomcat 8.0.36, not removing the quotes on JAVA_OPTS. – John Mikic Sep 22 '16 at 18:52
  • 2
    Tools -> Options -> General -> Proxy Settings: No Proxy – gps Mar 02 '17 at 19:02
  • I could not find :noJuliConfig set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%" :noJuliManager set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%" in catalina.bat file but your solution Tools -> Options -> General -> Proxy Settings: No Proxy worked for me in Netbeans 8.0 and Tomcat 8.5.13 – Joseph Apr 24 '17 at 18:28
10

Tools-> Options-> Select no proxy is worked for me

sri
  • 121
  • 1
  • 3
0

I didnt try Sumama Waheed's answer but what worked for me was replacing the bin/catalina.jar with a working jar (I disposed of an older tomcat) and after adding in NetBeans, I put the original catalina.jar again.

EricG
  • 3,788
  • 1
  • 23
  • 34