Starting of Tomcat failed from Netbeans

139,929

Solution 1

It affects at least NetBeans versions 7.4 through 8.0.2. It was first reported from version 8.0 and fixed in NetBeans 8.1. It would have had the problem for any tomcat version (confirmed for versions 7.0.56 through 8.0.28).

Specifics are described as Netbeans bug #248182.

This problem is also related to postings mentioning the following error output:

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

For a tomcat installed from the zip file, I fixed it by changing the catalina.bat file in the tomcat bin directory.

Find the bellow configuration in your catalina.bat file.

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

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

And change it as in below by removing the double quotes:

:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

Now save your changes, and start your tomcat from within NetBeans.

Solution 2

This affects:

  • All versions of Tomcat starting from 8.5.3 onwards.
  • All versions of Netbeans up to 8.1 (It is fixed in Netbeans 8.2).

This is because Netbeans does not 'see' that tomcat is started, although it started just fine.

I have filed Bug #262749 with NetBeans.

Workaround

In the server.xml file, in the Connector element for HTTP/1.1, add the following attribute: server="Apache-Coyote/1.1".

Example:

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

Cause

The reason for that is that prior to 8.5.3, the default was to set the server header as Apache-Coyote/1.1, while since 8.5.3 this default has now been changed to blank. Apparently Netbeans checks on this header.

Maybe in the future we can expect a fix in netbeans addressing this issue.

I was able to trace it back to a change in documentation.

Tomcat 8.5:

"Overrides the Server header for the http response. If set, the value for this attribute overrides any Server header set by a web application. If not set, any value specified by the application is used. If the application does not specify a value then no Server header is set."

Tomcat 8.0:

"Overrides the Server header for the http response. If set, the value for this attribute overrides the Tomcat default and any Server header set by a web application. If not set, any value specified by the application is used. If the application does not specify a value then Apache-Coyote/1.1 is used. Unless you are paranoid, you won't need this feature."

That explains the need for explicitly adding the server attribute since version 8.5.3.

Solution 3

Also, it is very likely, that problem with proxy settings.

Any who didn't overcome Tomact starting problrem, - try in NetBeans choose No Proxy in the Tools -> Options -> General tab.

It helped me.

Solution 4

None of the answers here solved my issue (as at February 2020), so I raised an issue at https://issues.apache.org/jira/browse/NETBEANS-3903 and Netbeans fixed the issue!

They're working on a pull request so the fix will be in a future .dmg installer soon, but in the meantime you can copy a file referenced in the bug and replace one in your netbeans modules folder.

Tip - if you right click on Applications > Netbeans and choose Show Package Contents Show Package Contents then you can find and replace the file org-netbeans-modules-tomcat5.jar that they refer to in your Netbeans folder, e.g. within /Applications/NetBeans/Apache NetBeans 11.2.app/Contents/Resources/NetBeans/netbeans/enterprise/modules

Solution 5

I had the same problem but none of the answers above worked. The solution for me was to restore the Manager web application that is bundled with Tomcat.

Share:
139,929
liquide
Author by

liquide

I like stackoverflow ;)

Updated on March 17, 2020

Comments

  • liquide
    liquide about 4 years

    I have problem with starting Apache Tomcat 6 from Netbeans IDE 7.4 (on 7.3 version I had the same troubles. Other people mentioned that this problem exist also in other versions, like 8.0 etc).

    What did I do:

    • remove installed Tomcat 7 (without removing it, I had the same difficulties)
    • add new server, downloaded from Apache Tomcat website (version apache-tomcat-6.0.39, with other version I had the same problems)
    • my server location: D:\apache-tomcat-netbeans
    • system variable CATALINA_HOME: D:\apache-tomcat-netbeans
    • system variable JAVA HOME: C:\Program Files\Java\jdk1.7.0_51\
    • tomcat user: I let netbeans creating new user, called tomcat with password tomcat. When I open {tomcat}\conf\tomcat-users.xml file after adding server, there is info about my user:

      < user password="tomcat" roles="manager,admin" username="tomcat"/ >

    When I now click "start", I got "Starting of Tomcat failed".

    My suspicions:

    • I'm working on Windows 7 as administrator, so I think this is not a problem with privileges to files.
    • Disabling proxy didn't helps.
    • Logs: There is only one log file created: localhost.2014-03-06.log and it is totally empty.
    • Starting Netbeans "as administrator" didn't helps.
    • From command line everything is all right, I have no problems with starting in normal or debug mode (catalina.bat jpda start or startup.bat)
  • liquide
    liquide about 10 years
    Unfortunately it didn't helps. Nothing changes. My tomcat-users.xml is now: <?xml version="1.0" encoding="UTF-8"?> <tomcat-users> <role rolename="tomcat"/> <role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="admin"/> <user password="tomcat" roles="tomcat, manager-gui,manager,manager-script,admin" username="tomcat"/> </tomcat-users>
  • liquide
    liquide about 10 years
    When I removed Root folder from tomcat and start it from Netbeans, tomcat log files had properly created, with error: SEVERE: Error starting static Resources. java.lang.IllegalArgumentException: Document base C:\Tomcat\webapps\ROOT does not exist or is not a readable directory
  • Katana24
    Katana24 over 9 years
    Worked for Tomcat 7.0.56 running on Netbeans 8.0.1
  • BIU
    BIU over 9 years
    didn't help me - netbeans 8.0.2, tomcat 8.0.15
  • Admin
    Admin about 9 years
    Worked with NetBeans 8.0.2 and Tomcat 8.0.15 on Windows! Any idea what the problem is exactly? I don't understand what difference the quotes make.
  • Gyan
    Gyan almost 9 years
    On Windows 8 I had to open notepad as an administrator to get this done.
  • jawath
    jawath almost 9 years
    thanks , this solution worked for tomcat 8.0.23 also
  • Kumar
    Kumar over 8 years
    Perfect solution!! Works for tomcat 8.0.28. Thanks!!
  • Admin
    Admin over 8 years
    Thank, It worked for me. Netbeans8.0.2 and tomcat 7.0.67
  • Black Swan
    Black Swan about 8 years
    Not work for me netbeans 8.1. tomcat 8, and windows 8
  • YoYo
    YoYo almost 8 years
    @BlackSwan see my answer specific for tomcat 8.5.3 onward and at least up-to netbeans 8.1.
  • xathien
    xathien almost 8 years
    This was the exact solution for the brew installed version, as well!
  • reden
    reden over 7 years
    I had to apply both the accepted answer and this for it to work properly
  • YoYo
    YoYo about 7 years
    In a corporate environment, a proxy might be required for the rest of your integrations to work, including receiving netbeans updates, and git access to external repositories including github. A better alternative to keep your proxy is to set a localhost exception on your proxy.
  • Yan Pak
    Yan Pak about 7 years
    Yeah, you are absolutely right. My case applying to situatuion when your network uses no proxy.
  • S.P Singh
    S.P Singh almost 7 years
    I did this configuration for making work of following combination NetBeans IDE 8.1 and apache-tomcat-8.5.6. Thanks.
  • taringamberini
    taringamberini about 6 years
    This workaround works with Apache Tomcat/8.5.28 NetBeans IDE 8.1 too.
  • Tarek
    Tarek over 5 years
    This is working yet doesn't make any sense! Nice work I guess but really, how, and why ?
  • hello_earth
    hello_earth over 5 years
    oh unexpectedly enough this worked for me, after changing server.xml as suggested above (which still had the same problem) : Netbeans 8.1 + TomEE 7.1.0 (tar.gz version)
  • Gunnar
    Gunnar almost 5 years
    Workaround works with NB 11.1 and Tomcat 9.0.6 on Windows 10, thanks.
  • RobbiewOnline
    RobbiewOnline over 4 years
    None of the solutions here helped me, but the Netbeans guys provided me with a file that got this working Netbeans 10.2 and Tomcat 8.x and 9.x on Mac Catalina - please see my answer stackoverflow.com/a/60385013/583616
  • RobbiewOnline
    RobbiewOnline over 4 years
    None of the solutions here helped me, but the Netbeans guys provided me with a file that got this working Netbeans 10.2 and Tomcat 8.x and 9.x on Mac Catalina - please see my answer stackoverflow.com/a/60385013/583616
  • RobbiewOnline
    RobbiewOnline over 4 years
    None of the solutions here helped me, but the Netbeans guys provided me with a file that got this working Netbeans 10.2 and Tomcat 8.x and 9.x on Mac Catalina - please see my answer stackoverflow.com/a/60385013/583616
  • Hasan Ammori
    Hasan Ammori about 4 years
    That's awesome! Thank you for contacting devs and helping them to fix this issue
  • Super Symmetry
    Super Symmetry over 3 years
    This worked for me, thank you. I am using Netbeans 11.3, Tomcat 9.0.39 running on macOS High Sierra.
  • jla
    jla over 2 years
    This work-around was needed to use Tomcat 9.0.54 with NetBeans 8.2 and 12 on Windows.