Mac OSX 10.9.5 / Tomcat 7.0.62/ java version "1.8.0_45"/ IDEA 14.1.3
我在将IDEA设置为本地Tomcat服务器配置时,遇到了一些奇怪的问题。
单独运行Tomcat脚本(例如startup.sh
或catalina.sh start | run
),Tomcat会立即启动,并且web应用程序可以从浏览器中访问。在IDEA中运行命令行应用程序也能够立即运行。问题只在我尝试从IDEA中运行Web应用程序并将其部署到Tomcat本地时出现。更改配置中的浏览器无效。
当我点击“运行”按钮时,在大约5分钟内输出窗口中没有任何信息。之后,Web应用程序实际上开始运行,并且以下输出显示在IDEA输出窗口中:
/usr/local/tomcat7/bin/catalina.sh run
[2015-06-05 09:35:24,040] Artifact thought_test:war exploded: Server is not connected. Deploy is not available.
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.62
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 7 2015 17:14:55 UTC
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.62.0
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.9.5
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_45-b14
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/magneto/Library/Caches/IntelliJIdea14/tomcat/Unnamed_thought_test
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/local/tomcat7
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/Users/magneto/Library/Caches/IntelliJIdea14/tomcat/Unnamed_thought_test/conf/logging.properties
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote=
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.port=1099
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/magneto/Library/Caches/IntelliJIdea14/tomcat/Unnamed_thought_test
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/local/tomcat7
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/usr/local/tomcat7/temp
Jun 05, 2015 9:35:25 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/magneto/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Jun 05, 2015 9:35:25 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 05, 2015 9:35:25 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 836 ms
Jun 05, 2015 9:35:25 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 05, 2015 9:35:25 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.62
Jun 05, 2015 9:35:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 05, 2015 9:35:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 05, 2015 9:35:25 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 118 ms
Connected to server
[2015-06-05 09:35:25,673] Artifact thought_test:war exploded: Artifact is being deployed, please wait...
[2015-06-05 09:35:26,203] Artifact thought_test:war exploded: Artifact is deployed successfully
[2015-06-05 09:35:26,204] Artifact thought_test:war exploded: Deploy took 531 milliseconds
Jun 05, 2015 9:35:35 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat7/webapps/manager
Jun 05, 2015 9:35:35 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat7/webapps/manager has finished in 104 ms
关于这一行的内容已经有了一些帖子:
Artifact thought_test:war exploded: Server is not connected. Deploy is not available.
但是所有给出的解决方案都不起作用。我看不到任何使用大量资源的活动,会导致延迟。这真的很奇怪,因为在延迟之后,与服务器的连接可以正常工作,即使最初无法连接。
更新:
我追踪到了防火墙。在“安全性与隐私”->“防火墙” -> “防火墙选项……”中,我取消了“启用隐身模式”的选择。之后,在IDEA和浏览器(Chrome)中启动应用程序。请注意,我首先将IDEA和Chrome添加到防火墙的“允许传入连接”的应用程序列表中,但那并不重要。
我会将其标记为解决方案,但我更想知道为什么Mac OS防火墙中有一些东西将IDEA到Tomcat的连接视为Ping或ICMP,并在几分钟内阻止它。
构建/重建项目
只需要不到一秒钟的时间。对于构建/构建工件/thought_test:war exploded/重建
,则只需 92 毫秒。 - Hal50000make
和构建工件
大约需要两秒钟。完成这些操作后,接下来约5分钟内不会有任何后台任务。我查看了top
,也没有发现太多的活动。 - Hal50000