Search code examples
tomcatnetbeans

Netbeans: Starting of Tomcat failed


I'm using the instructions in Murach's Java Servlets and JSP: 3rd Ed. textbook to set up Netbeans, Tomcat, and MySQL on my Mac. Everything works except for running Tomcat. I've tried all the relevant solutions I could find (changing the port number, checking localhost:8080, restarting etc.), but I continue to get error messages like these (I'm pasting all three logs created by Netbeans):

Starting Tomcat process...
Waiting for Tomcat...
Starting of Tomcat failed.
/Users/username/Programming/murach/servlet_and_jsp/netbeans/book_apps/ch02email/nbproject/build-impl.xml:1045: Deployment error: Starting of Tomcat failed.
See the server log for details.
BUILD FAILED (total time: 5 seconds)

Second log edited in update below.


25-Feb-2017 10:52:01.036 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 10:52:01.039 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 10:56:20.738 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 10:56:20.739 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 10:56:21.153 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 10:56:21.154 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 10:56:57.631 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 10:56:57.633 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 10:56:58.028 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 10:56:58.029 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:03:33.511 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:03:33.512 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:03:33.954 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:03:33.954 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:04:55.741 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:04:55.742 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:04:56.266 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:04:56.267 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:07:47.921 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:07:47.921 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:07:48.269 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:07:48.270 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:10:47.597 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:10:47.597 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:10:47.938 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:10:47.938 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:26:32.913 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:26:32.914 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:26:33.299 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:26:33.300 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:33:02.424 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:33:02.425 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 11:33:02.830 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 11:33:02.830 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 11:37:40.206 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 11:37:40.206 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 12:00:38.512 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 12:00:38.512 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 12:00:38.911 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 12:00:38.912 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 12:02:02.486 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 12:02:02.486 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 12:02:02.900 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 12:02:02.901 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 12:15:11.097 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 12:15:11.097 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 12:55:27.480 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 12:55:27.480 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 12:55:27.850 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 12:55:27.850 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 12:55:43.461 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 12:55:43.461 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 12:55:43.768 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 12:55:43.768 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 12:59:14.284 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 12:59:14.284 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:06:51.106 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 13:06:51.106 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:06:51.393 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 13:06:51.395 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 13:06:54.234 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 13:06:54.234 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:06:54.480 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 13:06:54.481 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 13:07:27.585 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 13:07:27.586 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:07:27.852 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 13:07:27.853 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 13:07:56.290 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 13:07:56.290 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:07:56.581 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 13:07:56.581 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
25-Feb-2017 13:08:06.413 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
25-Feb-2017 13:08:06.413 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
25-Feb-2017 13:08:06.701 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
25-Feb-2017 13:08:06.701 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()

Any help would be very appreciated!

Update: I uninstalled Tomcat, restarted my computer, reinstalled Tomcat, and am attempting to run the same program. I know that the problem is with my setup since the program is an example downloaded from the textbook publisher.

Going to localhost:8080 in my browser works whenever I'm trying to run the program, so I believe Tomcat is actually starting, just not working with Netbeans for some reason.

The first error is currently the same, but the second one now looks like this:

25-Feb-2017 13:48:08.178 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.11
25-Feb-2017 13:48:08.181 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jan 10 2017 21:02:52 UTC
25-Feb-2017 13:48:08.181 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.11.0
25-Feb-2017 13:48:08.181 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.12.3
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          x86_64
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_121-b13
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/username/Applications/tomcat-8.0
25-Feb-2017 13:48:08.182 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /Users/username/Applications/tomcat-8.0
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/username/Applications/tomcat-8.0/conf/logging.properties
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|Users-Mac-mini.local
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/username/Applications/tomcat-8.0
25-Feb-2017 13:48:08.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/username/Applications/tomcat-8.0
25-Feb-2017 13:48:08.184 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/username/Applications/tomcat-8.0/temp
25-Feb-2017 13:48:08.184 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/username/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
25-Feb-2017 13:48:08.883 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
25-Feb-2017 13:48:08.953 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Feb-2017 13:48:08.959 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
25-Feb-2017 13:48:08.968 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Feb-2017 13:48:08.969 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1818 ms
25-Feb-2017 13:48:09.059 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
25-Feb-2017 13:48:09.059 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.11
25-Feb-2017 13:48:09.074 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/username/Applications/tomcat-8.0/webapps/docs
25-Feb-2017 13:48:09.602 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/username/Applications/tomcat-8.0/webapps/docs has finished in 527 ms
25-Feb-2017 13:48:09.603 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/username/Applications/tomcat-8.0/webapps/examples
25-Feb-2017 13:48:10.305 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/username/Applications/tomcat-8.0/webapps/examples has finished in 703 ms
25-Feb-2017 13:48:10.306 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/username/Applications/tomcat-8.0/webapps/host-manager
25-Feb-2017 13:48:10.358 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/username/Applications/tomcat-8.0/webapps/host-manager has finished in 52 ms
25-Feb-2017 13:48:10.359 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/username/Applications/tomcat-8.0/webapps/manager
25-Feb-2017 13:48:10.419 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/username/Applications/tomcat-8.0/webapps/manager has finished in 59 ms
25-Feb-2017 13:48:10.419 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/username/Applications/tomcat-8.0/webapps/ROOT
25-Feb-2017 13:48:10.469 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/username/Applications/tomcat-8.0/webapps/ROOT has finished in 50 ms
25-Feb-2017 13:48:10.473 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080]
25-Feb-2017 13:48:10.479 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009]
25-Feb-2017 13:48:10.480 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1510 ms

Solution

  • This problem has been frustrating me for weeks, but today I finally got it to work. From what I can tell, the textbook instructions no longer fully work for MacOS Sierra. In case anyone else is having similar trouble, here are the steps I used:

    1. Installed NetBeans for Java EE (The installer said "Install time remaining: Less than a minute" for ages. I just left it alone and it eventually finished installing.)
    2. Downloaded and unzipped Apache Tomcat 9 (I ultimately put this in the same folder where my other server's folders are stored and did not rename it as the book instructed.)
    3. Mostly followed book's instructions to configure Tomcat server, but used server port 8081 since another server is using 8080. Again used default names.
    4. Downloaded Murach example files as instructed in book, though after three registrations the site still won't recognize that I've ever registered before.
    5. Opened example file from chapter 2 as book instructs.

    This is the main part which fixed my problem: System proxy settings in Sierra. Thanks to https://discussions.apple.com/message/30715103#30715103 I finally got that fixed. Here are the steps I used:

    1. On Mac: System Preferences-->Network--> select your wifi connection -->Advanced-->Proxies Select Auto Proxy Discovery (the link said to select several options, but this was the only one which stayed selected on my system, so I don't think the others are necessary)
    2. In Netbeans: Preferences-->General--> select "Use System Proxy Settings"-->click Reload--> click Test Connection

    After I got the green checkmark next to Test Connection, I was able to run the example program from chapter 2 without issue for the very first time.

    There are still a few remaining issues after importing the other project files. So far, there's a .jar file which needed to be manually linked, possibly because I used Tomcat 9 instead of Tomcat 8? Regardless, easily done. Additionally, I get a warning for some examples that says:

    warning: [options] bootstrap class path not set in conjunction with -source 1.6
    1 warning
    

    Right-clicking on the project, then selecting Properties, and changing the Source/Binary Format from JDK 6 to JDK 8 resolved this warning.

    Hope that helps someone else!