3

Mac OSX 10.9.5 / Tomcat 7.0.62/ java version "1.8.0_45"/ IDEA 14.1.3

I'm experiencing some odd behavior getting IDEA to launch an exploded war to Tomcat as a local Tomcat server configuration.

By itself, Tomcat starts immediately if I run its scripts (i.e., startup.sh or catalina.sh start | run) and the webapp is accessible from a browser. Command line apps run immediately in IDEA. The problem is just when I run a web application from inside IDEA, trying to deploy the exploded app to Tomcat local. Changing the browser in the configuration has no effect.

When I hit "run" there's nothing in the output window for about 5 minutes. Then the web app actually runs, and the following output shows in the IDEA output window:

/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

There's been a few posts about the line:

Artifact thought_test:war exploded: Server is not connected. Deploy is not available.

But none of the given solutions work. I can't see anything that's going on that looks like it's using a lot of resources, that would cause the delay. It's really odd because after the delay, the connection to the server works, even though initially it didn't.

Update:

I tracked it down to the firewall. In 'Security & Privacy' -> 'Firewall' -> 'Firewall Options...' I unchecked 'Enable stealth mode'. After I did that the app started right up in IDEA and the browser (Chrome). Note that I first added both IDEA and Chrome to the firewall's list of applications that 'Allow incoming connections' but that didn't matter.

I'd mark it as a solution, but I rather know why there's something in the Mac OS firewall that's treating the connection from IDEA to Tomcat as Ping or ICMP and blocking it for a few minutes.

Hal50000
  • 639
  • 1
  • 6
  • 16
  • What does your `run configuration` do before actually launching, eg run make or a maven build? Can you post a screeshot of the configuration window? You can also check the background tasks to see if something is running before tomcat (Window -> Background tasks -> Show) – Morfic Jun 05 '15 at 14:13
  • Here's a screen shot of my run configuration: http://i59.tinypic.com/331q0r4.png -- all it's doing is 'make' and 'build artifact' that seems to happen in a second or so. Then the background tasks window just says "There are no active background tasks" – Hal50000 Jun 05 '15 at 14:26
  • How long does a build (e.g. `Build/Rebuild Project`) typically take? Same question for `Build/Build Artifacts/thought_test:war exploded/Rebuild`. – pens-fan-69 Jun 05 '15 at 14:38
  • One note on the `Server is not connected. Deploy is not available.` line: that is normal and is not the source of your problem. – pens-fan-69 Jun 05 '15 at 14:41
  • @pens-fan-69 `Build/Rebuild Project` takes under a second. For `Build/Build Artifacts/thought_test:war exploded/Rebuild` 92 ms. – Hal50000 Jun 05 '15 at 14:45
  • That's about 2/5 minutes. Any other background task running after these 2 and before starting tomcat? – Morfic Jun 05 '15 at 14:49
  • @Morfic - how are you getting 2/5 minutes? It takes about two seconds for the `make` and `buld artifact`. After those happen there no background tasks at all for ~5 minutes. I checked `top` but didn't show much going on either. – Hal50000 Jun 05 '15 at 14:57
  • Apologies, I missed the `m` in the `ms`. Under the circumstances my next assumption would be that the _actual deployment_ takes that long. Anything else fishy on the deployment tab in the configuration window? How does it behave if you remove your artefact from the deployment list? – Morfic Jun 05 '15 at 15:33
  • @Hal50000 Have you tried performing a `Build/BuildArtifacts/thought_test:war exploded/Clean` followed by a `Build/BuildArtifacts/thought_test:war exploded/Rebuild`? Also, you might want to check system logs to make sure you aren't getting retries on the disk or something weird like that. Another question that occurs is how much memory you have. Could you be in a situation where you are having to do massive swapping because of low available physical memory or because you have a large heap configured? – pens-fan-69 Jun 05 '15 at 16:01
  • I checked a little deeper. I'm just testing it out a jsp page. The jsp is in `$CATALINA_HOME/webapps/though_test/web/index.jsp`. When I hit run, the `before launch` settings `make` and then `build artifacts`. The path of the artifact build is `$CATALINA_HOME/thought_test/out/artifacts/thought_test_war_exploded/index.jsp` (and WEB-INF). The Tomcat instance run from IDEA runs the jsp in the `out`path. Everything in that directory is built almost immediately, *before* the ~5 minute wait. I thought about swapping being the issue. Any suggestions where to look for that in console? – Hal50000 Jun 05 '15 at 20:55

3 Answers3

1

You need to increase your memory parameter.

Just go Run / Debug configuration and set is as in picture.Hope it will work better than previous

enter image description here

Yasir Shabbir Choudhary
  • 2,458
  • 2
  • 27
  • 31
1

You might turn on the method breakpoints , find them and turn them off.

See also this so: Intellij Debugger slow: Method breakpoints my dramatically slow down debugging
and also this official article: https://intellij-support.jetbrains.com/hc/en-us/articles/206544799-Java-slow-performance-or-hangups-when-starting-debugger-and-stepping

jiacheo
  • 308
  • 1
  • 2
  • 12
0

If you're using Tomcat plugin then make sure that in Tomcat Server configuration "Before Launch" doesn't contain the 'Build:artifcat' option as that's what makes it run every time even when you've done clean install.

enter image description here

Smart Coder
  • 1,435
  • 19
  • 19