当前位置: 首页 > 知识库问答 >
问题:

无法使用ip地址访问tomcat

万勇
2023-03-14

我已经检查了netstat并且能够找到处于侦听状态端口8080

C:\users\administrator>netstat-ano findstr“8080”

TCP 0.0.0.0:8080 0.0.0.0:0侦听540

<?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">
  <!-- 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" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- 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 (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" address="0.0.0.0" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- 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>

如有任何帮助,我们将不胜感激。谢谢你。

共有1个答案

梁丘凯定
2023-03-14

我最近就这么做了。

在没有编辑server.xml的情况下,I端口转发了路由器上的tomcat端口,并确保包含了本地端口。我的路由器配置如下所示:

+--------------+-------------+----------------+-------------+-----------+
| SERVICE NAME |  PORT RANGE |    LOCAL IP    |  LOCAL PORT |  PROTOCOL |
+--------------+-------------+----------------+-------------+-----------+
|              |             |                |             |           |
| Tomcat       |  8084       |  192.168.1.237 |  8084       |  BOTH     |
+--------------+-------------+----------------+-------------+-----------+

因为我们不知道你的防火墙设置,你必须确保没有其他东西被阻止,包括杀毒软件和任何硬件配置。

 类似资料:
  • 问题内容: 我在Windows 7上运行Tomcat 5.5实例(端口:8089)。 如果我打开http:// localhost:8089 / ,服务器将正常运行,但是在http://192.168.1.100:8089/上却给我一个错误(连接被拒绝) 我以为这是防火墙问题…所以我禁用了它,但是我仍然没有运气。 提前致谢。 解决了: 在连接器字符串中添加了 地址=“ 0.0.0.0” ,就可以了

  • 我甚至才知道,即使是Docker容器也是由IP组成的。为什么会这样?有谁能帮助我理解容器是如何通过IP访问的吗? 我已经尝试了上面的JSON和ipconfig映像中所有可用的IP,但都不起作用。

  • 在SNS中,我设置了一个主题。 在IAM中,我设置了一个策略,允许仅从特定IP地址访问ARN主题: 我已将此策略附加到一个组,并将用户添加到此组。 从C#windows应用程序,我现在可以从策略中列出的指定SourceIp订阅和发布主题。 但是在这种情况下,我需要使用IAM用户的AccessKey和SecretAccessKey。 只要SourceIp是正确的,有没有一种方法可以绕过需要访问密钥和

  • 问题内容: 我正在建立一个网站,用户可以使用使用Python(在我的情况下为2.6)的Flask微框架(基于Werkzeug)登录和下载文件。 我需要获得用户登录时的IP地址(出于记录目的)。有谁知道如何做到这一点?当然有办法用Python吗? 问题答案: 请参阅有关如何访问Request对象,然后从同一Request对象(即attribute)获取文档。 代码示例 有关更多信息,请参见Werkz

  • 问题内容: 我在Mac OS X上使用自制软件设置了jenkins,它 可以通过主机正常工作,或者无法通过主机名/ ipaddress访问jenkins实例: 即使从本地计算机(詹金斯主机本身)也无法访问这两个链接。同时执行命令并正常工作。 问题答案: 事实证明,启动代理配置为仅侦听127.0.0.1(或localhost)。要修复该詹金斯经纪人的plist: 并修改为而不是

  • 我已经在单机中安装了Elastisearch 2.1.0和kibana 4.3.0。基巴纳。yml配置: 当我在做curl-IP:5601时,我得到了以下输出: Elasticsearch和kibana都已启动并运行,但我无法从浏览器访问kibana GUI。它没有显示页面。 我也检查了elasticsearch.yml的配置。主机和IP在那里是正确的。Curl命令为elasticsearch提供