java 服务器未连接。部署不可用。IntelliJ 13 和 Tomcat 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27658343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 12:11:22  来源:igfitidea点击:

Server is not connected. Deploy is not available. IntelliJ 13 and Tomcat 7

javamaventomcatintellij-idea

提问by yesuagg

Trying to run my app with IntelliJ 13 and Apache tomcat 7.0.42. JDK1.6

尝试使用 IntelliJ 13 和 Apache tomcat 7.0.42 运行我的应用程序。JDK1.6

Always getting the error Artifact app:war exploded: Server is not connected. Deploy is not available.

总是收到错误Artifact app:war 爆炸:服务器未连接。部署不可用。

But when I deploy through terminal with catalina.sh startit works perfectly fine.

但是当我使用catalina.sh start通过终端部署时,它工作得很好。

I referred this link for setup: http://confluence.jetbrains.com/display/IntelliJIDEA/Application+Servers

我参考了这个链接进行设置:http: //confluence.jetbrains.com/display/IntelliJIDEA/Application+Servers

Any idea what am I missing?

知道我错过了什么吗?

Here is the Tomcat Catalina log:

这是 Tomcat Catalina 日志:

Dec 29, 2014 11:43:29 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 614 ms
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 44 ms
Dec 29, 2014 11:43:39 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/yesuagg/apache-tomcat-7.0.42/webapps/manager

Exception in Event log

事件日志中的异常

4:58:40 PM Compilation completed successfully with 104 warnings in 6 sec
4:58:42 PM Application Server was not connected before run configuration stop, reason:
       java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
       java.net.ConnectException: Connection refused]

回答by ZakiMak

Please check this answer posted by Christian and also read that thread. Tomcat deployment issue via IntelliJ

请检查 Christian 发布的这个答案,并阅读该主题。 通过 IntelliJ 部署 Tomcat 问题

Simply try removing setenv.shin $CATALINA_HOME/bin

只需尝试删除$CATALINA_HOME/bin 中的setenv.sh

回答by mattyboy

I had this issue today and it wasn't due to setenv.sh as discussed on the other thread. In the end it was an issue with $CATALINA_BASE/conf/server.xml.

我今天遇到了这个问题,这不是由于另一个线程中讨论的 setenv.sh 造成的。最后是 $CATALINA_BASE/conf/server.xml 的问题。

For some reason in our server.xml we were using a custom engine name for example

出于某种原因,我们在 server.xml 中使用了自定义引擎名称,例如

<Engine name="custom-value" defaultHost="localhost">

I tried again with a clean server.xml from tomcat 7.0.57 and the artifact deployed perfectly. After trial and error it came down to this one line.

我再次尝试使用来自 tomcat 7.0.57 的干净 server.xml 并且完美部署了工件。经过反复试验,它归结为这一行。

Changing engine name to 'Catalina' as shown below value fixed our issue and allowed our exploded artifact to deploy using our customised server.xml

将引擎名称更改为“Catalina”(如下所示)修复了我们的问题,并允许使用我们自定义的 server.xml 部署分解的工件

<Engine name="Catalina" defaultHost="localhost">

If you are seeing this issue try a clean server.xml and work backwards from there.

如果您看到此问题,请尝试使用干净的 server.xml 并从那里向后工作。

回答by Макс Даниленко

tomcat-7.0-doc RUNNING

tomcat-7.0-doc 正在运行

(3.2) Set JRE_HOME or JAVA_HOME (required)

(3.2) 设置 JRE_HOME 或 JAVA_HOME (必填)

These variables are used to specify location of a Java Runtime Environment or of a Java Development Kit that is used to start Tomcat.

这些变量用于指定用于启动 Tomcat 的 Java 运行时环境或 Java 开发工具包的位置。

The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME variable is used to specify location of a JDK.

JRE_HOME 变量用于指定 JRE 的位置。JAVA_HOME 变量用于指定 JDK 的位置。

Using JAVA_HOME provides access to certain additional startup options that are not allowed when JRE_HOME is used.

使用 JAVA_HOME 可以访问使用 JRE_HOME 时不允许的某些附加启动选项。

If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.

如果同时指定了 JRE_HOME 和 JAVA_HOME,则使用 JRE_HOME。

回答by Макс Даниленко

In my case, Intellij IDEA doesn't support run tomcat8 installed from linux repositories. /usr/share/tomcat/bin/catalina.sh start (not support) /usr/share/tomcat/bin/catalina.sh run (supported)

就我而言,Intellij IDEA 不支持从 linux 存储库安装的运行 tomcat8。/usr/share/tomcat/bin/catalina.sh 启动(不支持) /usr/share/tomcat/bin/catalina.sh 运行(支持)

Only tomcat8 installed from official website. I tried with distribution downloaded from http://tomcat.apache.org/download-80.cgi. So I got successful results.

只从官网安装了 tomcat8。我尝试使用从http://tomcat.apache.org/download-80.cgi下载的发行版。所以我得到了成功的结果。

The reason is in the catalina.sh file from linux distribution, where there isn't "run" command. But in the tomcat downloaded there is "run" command. catalina.sh_InstalledFromLinuxRepository

原因在于 linux 发行版的 catalina.sh 文件中,其中没有“运行”命令。但是在下载的tomcat中有“运行”命令。catalina.sh_InstalledFromLinuxRepository

回答by mvmn

Do you set JAVA_OPTS anywhere in Tomcat bat/sh files? If you do, make sure to keep previous values also - IDEA seems to use those to specify some connection options to Tomcat. E.g. in .sh files do

您是否在 Tomcat bat/sh 文件中的任何位置设置了 JAVA_OPTS?如果这样做,请确保也保留以前的值 - IDEA 似乎使用这些值来指定一些到 Tomcat 的连接选项。例如在 .sh 文件中

JAVA_OPTS="<your new stuff> $JAVA_OPTS"

instead of just

而不仅仅是

JAVA_OPTS=<your new stuff>

P.S. Same answer as this actually: https://stackoverflow.com/a/28867346/307295

PS实际上与此答案相同:https: //stackoverflow.com/a/28867346/307295