IDE无法识别Tomcat启动

IDE无法识别Tomcat启动,tomcat,netbeans,tomee-7,Tomcat,Netbeans,Tomee 7,我正在使用Netbeans 11部署WAR文件。使用RUN时,IDE启动Tomcat,显示启动消息: INFO - Starting ProtocolHandler [http-nio-8080] INFO - Starting ProtocolHandler [ajp-nio-8009] INFO - Server startup in 815 ms 但是,IDE的“运行”选项卡显示在超时后启动失败: Deploying on TomEE profile mode: false

我正在使用Netbeans 11部署WAR文件。使用RUN时,IDE启动Tomcat,显示启动消息:

INFO - Starting ProtocolHandler [http-nio-8080]
INFO - Starting ProtocolHandler [ajp-nio-8009]
INFO - Server startup in 815 ms
但是,IDE的“运行”选项卡显示在超时后启动失败:

Deploying on TomEE
    profile mode: false
    debug mode: false
    force redeploy: true
Starting Tomcat process...
Waiting for Tomcat...
Starting of Tomcat failed.
不知何故,IDE没有正确地检测到Tomcat,因为Tomcat确实在8080端口上运行和侦听。我已经试过了,尤其是使用IDE代理和连接器的那个,但都不起作用


根据评论:

1) 我正在运行TomEE,尽管我认为在我的问题上与Netbeans的观点(甚至与TomEE本身)没有区别。老实说,我认为这是一个Netbeans-Tomcat通信问题,TomEE只是添加了一些库和其他东西,这些东西会影响以后的工作

2) 我使用的是自定义的
server.xml
,但现在我使用的是原来的:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <!-- TomEE plugin for Tomcat -->
  <Listener className="org.apache.tomee.catalina.ServerListener" />
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" xpoweredBy="false" server="Apache TomEE" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation with the JSSE engine. When
         using the JSSE engine, the JSSE configuration attributes must be used.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" xpoweredBy="false" server="Apache TomEE" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation. When using the
         APR/native implementation or the OpenSSL engine with NIO or NIO2 then
         the OpenSSL configuration attributes must be used.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" xpoweredBy="false" server="Apache TomEE" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

我认为问题来自一台有两个网络接口的计算机。不知何故,Netbeans(很有可能,除非Tomcat有事做)错误地管理了这种情况,并且它无法检测到Tomcat启动了

我真的不知道如何解决它,但我断开了第二个接口,它似乎可以工作。这是非常烦人和不方便的,但它是一个有效的解决办法

我发现这是因为
sudo
非常慢,我发现有一个问题,sudo在有两个或更多网络接口的机器上速度非常慢。。。不相关,但解决方法是:(
echo“Set probe_interfaces false”| sudo tee-a/etc/sudo.conf


我也遇到了同样的问题,通过使用旧版本的tomcat解决了这个问题

我在使用Netbeans 11.1和11.3时遇到了这个问题

我在tomcat 8.5.54和9.0.34中收到了这个错误。
Tomcat在使用8.5.49版时工作正常,我在谷歌上搜索了一下StackOverflow,直到我在这里看到这篇文章才解决:

我下载了NetBeans11.1的源代码并用命令构建了它

ant -Dcluster.config=full
大约需要17分钟。在那之后,我和你一起跑步

ant tryme
然后我在工具->服务器中设置tomcat设置并打开我的项目。然后我试着运行它。太棒了,现在很好用


显然,这是NetBeans的一个bug。在NetBeans端解决这一问题并不难。

[1]如果您要部署到TomEE而不是Tomcat(根据“运行”代码段,您看起来是这样的),您能更新您的问题以澄清这一点吗?[2] 可以发布server.xml吗?[3] 在出现“Tomcat失败”消息时,Tomcat日志中是否有任何相关消息?[4] 除了被记录的错误消息(“启动Tomcat失败”)之外,还有什么问题吗?例如,如果您试图从NetBeans停止服务器,Tomcat的停止菜单项是否已禁用,即使Tomcat正在运行?[5] 这种情况是一直发生还是间歇性发生?好的。[1] 是否有任何相关内容被写入NetBeans日志(视图>IDE日志)?[2] 这对您一点帮助都没有,但仅供参考,其他一些人报告了NetBeans 11.2上Wildlfly的类似问题:。[3] 虽然我无法重现这两个问题,但这可能是NetBeans 11.x的问题?〔4〕由于这是一个可重复的错误,可能会考虑。谢谢。日志表明
ExecutionChecker.executionResult
失败(请参阅问题中的更新)。从我们所知道的情况来看没什么。我将再次重新安装Netbeans,就像我对Tomcat所做的那样,可能使用不同的版本。对-堆栈跟踪并没有真正添加任何新内容。似乎有一些关于Wildlfy和NetBeans不能正常通信的老NetBeans bug报告,尽管我没有看到Wildlfy 15的任何信息。我不确定重新安装NetBeans是否会有什么效果,但升级到NetBeans 11.2和/或Wildfly 18可能会有效果。在您现有的环境中尝试的另一件相当简单的事情(如果可行的话)是使用不同的服务器,这对我来说是完美的!经过大量的测试,我想我会有所进展。问题似乎与网络接口有关——我的计算机有两个接口,一个用于互联网,一个用于内部网络(需要在测试后部署战争)。如果我禁用了内部的一个,那么Tomcat显然被检测到了。有些事情没有得到正确的管理。(为了记录在案,我还尝试了Netbeans 11.2和10.0,但没有成功)谢谢,谢谢,谢谢!就我而言,这就是问题所在!我发现在NetBeans11.1 bin包中只替换一个jar文件就可以解决这个问题。这是enterprise/modules下的org-netbeans-modules-tomcat5.jar。
ant tryme