tomcat - 尝试使用 intellij 部署时服务器未连接

标签 tomcat intellij-idea war auto-update

我正在尝试在 intellij 中构建、部署和调试我的 webapp。

我已经使用 this 设置了我的 tomcat回答,我能够让服务器运行。问题是我的 webapp 没有被部署,尽管它是在 deployment 选项卡中定义的。

我收到以下错误: 服务器未连接。部署不可用

如果我复制 war 并启动服务器,一切正常。使用端口 8080 和 8000。

我做错了什么?

以防万一,项目是用 Maven & Spring 构建的

我为服务器添加了运行/调试配置:

服务器选项卡 Server Tab

部署选项卡 Deployment tab

调试控制台输出:

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.

最佳答案

简而言之:

设置我的 IntelliJ 配置以运行我在后台运行的最新版本的 Tomcat 后,我​​的问题就解决了。

简要说明:

当我进行设置并在另一台机器上工作时,我在 IntelliJ 14 中遇到了完全相同的错误。 虽然问题的根源可能不同,但就我而言,根本原因是:

我的机器上基本上安装了两个不同版本的 Tomcat。 Tomcat 8 在后台运行在端口 8090 上,尽管将我的调试器实例端口设置为 8091,但它给了我以下错误:

Server is not connected. Deploy is not available.

和以下警告:

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

设置我的 IntelliJ 配置以运行我在后台运行的最新版本的 Tomcat 后,我​​的问题就解决了。

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.

希望这对您有所帮助。

关于tomcat - 尝试使用 intellij 部署时服务器未连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25147843/

相关文章:

java - 如何在 JDBC 调用 MySQL 数据库时指定毫秒超时?

java - tomcat应用程序未启动时如何创建错误事件

java - Resteasy 不适用于 wildfly 11 但适用于 Tomcat

war - gradle:将 jar 添加到 web-inf

java - 使用 openshift 部署 war 时的依赖问题

spring-boot - 将war文件多层打包成docker镜像

linux - 在 CentOS 7 Linux 中编辑 tomcat-users.xml

python - IntelliJ IDEA - 如何将远程 PYTHONPATH 映射到本地环境?

git - IntelliJ IDEA - 如何从命令行触发 Git 冲突解决

svn - 当没有证书时,Intellij SVN不断询问证书的路径