Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server is not connected when trying to deploy with intellij

Tags:

I am trying to build, deploy and debug my webapp inside intellij.

I have setup my tomcat using this answer and I was able to get the server running. The issue is that my webapp is not being deployed, though it is defined in the deployment tab.

I am getting the following error: server is not connected. Deploy is not available

If I copy the war and start the server everything works Ok. With ports 8080 and 8000.

What am I doing wrong?

Just in case it is somehow related, the project is build with Maven & Spring

I added the Run/Debug Configuration for the Server:

Server Tab Server Tab

Deployment Tab Deployment tab

Debug Console output:

D:\development\infra\appServers\apache-tomcat-7.0.47\bin\catalina.bat run [2014-08-05 01:23:11,413] Artifact devstage:war exploded: Server is not connected. Deploy is not available. Using CATALINA_BASE:   "C:\Users\chaim\.IntelliJIdea13\system\tomcat\Unnamed_devstage_4" Using CATALINA_HOME:   "D:\development\infra\appServers\apache-tomcat-7.0.47" Using CATALINA_TMPDIR: "D:\development\infra\appServers\apache-tomcat-7.0.47\temp" Using JRE_HOME:        "C:\Program Files\Java\jdk1.7.0_45" Using CLASSPATH:       "D:\development\infra\appServers\apache-tomcat-7.0.47\bin\bootstrap.jar;D:\development\infra\appServers\apache-tomcat-7.0.47\bin\tomcat-juli.jar" Aug 05, 2014 1:23:12 PM org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.4.8. Aug 05, 2014 1:23:12 PM org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. Aug 05, 2014 1:23:12 PM org.apache.catalina.core.AprLifecycleListener initializeSSL INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013) Aug 05, 2014 1:23:12 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-apr-8080"] Aug 05, 2014 1:23:12 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-apr-8009"] Aug 05, 2014 1:23:12 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 902 ms Aug 05, 2014 1:23:12 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Aug 05, 2014 1:23:12 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Aug 05, 2014 1:23:12 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-apr-8080"] Aug 05, 2014 1:23:12 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-apr-8009"] Aug 05, 2014 1:23:12 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 35 ms [2014-08-05 01:23:21,363] Artifact devstage:war exploded: Server is not connected. Deploy is not available. Aug 05, 2014 1:23:22 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory D:\development\infra\appServers\apache-tomcat-7.0.47\webapps\manager [2014-08-05 01:23:38,311] Artifact devstage:war exploded: Server is not connected. Deploy is not available. 
like image 247
special0ne Avatar asked Aug 05 '14 20:08

special0ne


People also ask

How do I connect to an IntelliJ server?

Connect via Space Launch IntelliJ IDEA. On the starting page, select JetBrains Space and click Connect to Space. Enter your organization URL and click Continue in Browser. In the browser window that opens, click Accept to grant the required permissions.

How do I deploy in IntelliJ?

on the main toolbar or press Ctrl+Alt+S to open the Settings/Preferences dialog, and choose the Deployment page (you can access the same page by choosing Tools | Deployment | Configuration from the main menu).

How do I find my IntelliJ server?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Application Servers. and select the application server.


2 Answers

In short:

After setting my IntelliJ configuration to run the latest version of Tomcat that I was running in the background my problem was resolved.

A brief description:

I had the exact same error in my IntelliJ 14 while I had a setup and was working on another machine. While the source of the issue can differ, in my case here was the root cause:

I basically had two different versions of Tomcat Installed on my machine. Tomcat 8 was running in the background on port 8090 and despite of setting my debugger instance port to be 8091 it was giving me the following error:

Server is not connected. Deploy is not available.

and The following warnings:

1:21:18 PM It is possible to bind and connect to localhost:8091 at the same time - application server will probably compete with some other software on the port

1:32:39 PM Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099

After setting my IntelliJ configuration to run the latest version of Tomcat that I was running in the background my problem was resolved.

Hint: Running applications in debug mode can slow them down a fair bit. I usually have two instances running. One in debug mode and one in normal mode in two different ports. This way I can have a normal instance of my web application as well as a debugger instance for more in depth investigations.

Hope this helps.

like image 119
AmirHd Avatar answered Oct 14 '22 13:10

AmirHd


In my case, this problem was due to a JAVA_OPTS variable defined in catalina.bat (or catalina.sh).

I only commented the first line of catalina.bat and everything started working. Here is the line :

set "JAVA_OPTS=-Xmx1024M -XX:MaxPermSize=512m -Djava.util.logging.config.file=logging.properties -Djava.net.preferIPv4Stack=true" 

To comment, put rem in front of it. rem is the way to comment a line in windows .bat files.

I suppose that this line conflicts with IntelliJ JAVA_OPTS settings. In fact, IntelliJ tries to set a port on tomcat to use as a debugger, but the catalina.bat JAVA_OPTS variable deleted this setting.

like image 28
musikele Avatar answered Oct 14 '22 13:10

musikele