Netbeans:Tomcat的启动失败

时间:2017-02-25 18:23:57

标签: tomcat netbeans

我使用了Murach的Java Servlets和JSP:3rd Ed中的说明。在我的Mac上设置Netbeans,Tomcat和MySQL的教科书。一切都有效,除了运行Tomcat。我已经尝试了所有可以找到的相关解决方案(更改端口号,检查localhost:8080,重新启动等),但我继续收到类似这样的错误消息(我将所有三个日志粘贴到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)

在下面的更新中编辑了第二个日志。

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

非常感谢任何帮助!

更新:我卸载了Tomcat,重新启动了我的电脑,重新安装了Tomcat,并尝试运行相同的程序。我知道问题出在我的设置上,因为该程序是从教科书出版商下载的一个例子。

当我尝试运行程序时,在我的浏览器中访问localhost:8080,所以我相信Tomcat实际上是在启动,因为某些原因没有使用Netbeans。

第一个错误目前是相同的,但第二个错误现在看起来像这样:

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

3 个答案:

答案 0 :(得分:1)

这个问题让我感到沮丧数周,但今天我终于开始工作了。据我所知,教科书说明不再适用于MacOS Sierra。如果其他人遇到类似的麻烦,以下是我使用的步骤:

  1. 已安装的NetBeans for Java EE (安装人员说"安装剩余时间:不到一分钟"多年。我只是把它放在一边,最终完成安装。)
  2. 下载并解压缩的Apache Tomcat 9(我最终把它放在我存储其他服务器文件夹的同一文件夹中,并没有像书中指示的那样重命名。)
  3. 主要按照本书的说明配置Tomcat服务器,但使用服务器端口8081,因为另一台服务器正在使用8080.再次使用默认名称。
  4. 按照书中的说明下载了Murach示例文件,但在三次注册后,该网站仍然无法识别我之前曾注册过的文件。
  5. 按照书中的说明打开第2章中的示例文件。
  6. 这是解决我的问题的主要部分:塞拉利昂的系统代理设置。感谢https://discussions.apple.com/message/30715103#30715103我终于解决了这个问题。以下是我使用的步骤:

    1. 在Mac上:系统偏好设置 - >网络 - >选择你的wifi连接 - >高级 - >代理 选择自动代理发现(该链接表示选择了几个选项,但这是唯一一个在我的系统上保留选定的选项,所以我不认为其他选项是必要的)
    2. 在Netbeans中:首选项 - >常规 - >选择"使用系统代理设置" - >点击重新加载 - >单击“测试连接”
    3. 在我获得Test Connection旁边的绿色复选标记后,我能够第2次运行第2章中的示例程序而没有问题。

      导入其他项目文件后仍有一些问题。到目前为止,有一个.jar文件需要手动链接,可能是因为我使用的是Tomcat 9而不是Tomcat 8?无论如何,轻松完成。另外,我收到一些警告说:

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

      右键单击项目,然后选择“属性”,将源/二进制格式从JDK 6更改为JDK 8解决了此警告。

      希望能帮到别人!

答案 1 :(得分:0)

我找到了一个解决方案,它不是一个正确的解决方案,但对我来说很好,我希望它对其他人有用。

在Netbeans IDE中,=>服务=>右键单击tomcat服务器=>选择属性。

在属性中,在平台上单击菜单,然后取消选中“使用ide代理设置”。

现在尝试运行该项目。我希望它可以正常运行。

我在下面提供了两个指向这些图像的链接,这些链接显示了上述步骤的图形表示。

执行上述任务的第1张图片。

enter image description here

上述任务的图片2

enter image description here

答案 2 :(得分:-1)

去吧 C:\apache-tomcat-8.0.36-windows-x64\apache-tomcat-8.0.36\bin然后在Notepad ++上打开catalina.bat并搜索集"JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"并设置" JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%"并删除双引号。

然后搜索set" JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS%"并从此处删除双引号。

希望它能运作