草庐IT

java - Tomcat运行在8080端口,但是无法通过IP地址远程访问?

coder 2023-09-18 原文

我在我的服务器上新安装了 apache-tomcat-7.0.62。 当我启动 tomcat 时它开始时没有错误,但是当我想使用浏览器访问它时它说页面不可用。我使用以下命令检查 tomcat 是否正常运行:-

     netstat -ntlp | grep LISTEN

下面是输出:-

tcp 0 0 0.0.0.0:22 0.0.0.0:* 收听 -
tcp 0 0 127.0.0.1:8005 0.0.0.0:* 监听 19430/java
TCP 0 0 0.0.0.0:8009 0.0.0.0:* 监听 19430/java
tcp 0 0 127.0.0.1:3306 0.0.0.0:* 听-
TCP 0 0 0.0.0.0:8080 0.0.0.0:* 监听 19430/java
tcp6 0 0:::22:::* 听 -
tcp6 0 0:::8000:::* 听 -
tcp6 0 0:::80:::* 听 -

以下是catalina.out的内容

 Aug 28, 2015 7:56:39 AM               org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.62
Aug 28, 2015 7:56:39 AM    org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          May 7 2015 17:14:55 UTC
Aug 28, 2015 7:56:39 AM     org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.62.0
Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Linux
  Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Version:            3.13.0-48-generic
 Aug 28, 2015 7:56:39 AM      org.apache.catalina.startup.VersionLoggerListener log
 INFO: Architecture:          amd64
   Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
 INFO: Java Home:             /usr/lib/jvm/java-7-openjdk-amd64/jre
 Aug 28, 2015 7:56:39 AM      org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.7.0_79-b14
 Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation 
Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         /home/ubuntu/apache-tomcat-7.0.62
Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         /home/ubuntu/apache-tomcat-7.0.62
Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: - Djava.util.logging.config.file=/home/ubuntu/apache-tomcat- 7.0.62/conf/logging.properties
 Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
 INFO: Command line argument: - Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.net.preferIPv4Stack=true 
 Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.net.preferIPv4Addresses=true
Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/home/ubuntu/apache- tomcat-7.0.62/endorsed
Aug 28, 2015 7:56:39 AM  org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/ubuntu/apache-     tomcat-7.0.62
Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/home/ubuntu/apache- tomcat-7.0.62
 Aug 28, 2015 7:56:39 AM   org.apache.catalina.startup.VersionLoggerListener log
 INFO: Command line argument: -Djava.io.tmpdir=/home/ubuntu/apache-   tomcat-7.0.62/temp
 Aug 28, 2015 7:56:39 AM org.apache.catalina.core.AprLifecycleListener  lifecycleEvent
  INFO: The APR based Apache Tomcat Native library which allows optimal     performance in production environments was not found on the   java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-  gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-  gnu:/usr/lib/jni:/lib:/usr/lib
 Aug 28, 2015 7:56:39 AM org.apache.coyote.AbstractProtocol init
 INFO: Initializing ProtocolHandler ["http-bio-8080"]
 Aug 28, 2015 7:56:39 AM org.apache.coyote.AbstractProtocol init
 INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
 Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.Catalina load
 INFO: Initialization processed in 1060 ms
 Aug 28, 2015 7:56:39 AM org.apache.catalina.core.StandardService     startInternal
 INFO: Starting service Catalina
  Aug 28, 2015 7:56:39 AM org.apache.catalina.core.StandardEngine   startInternal
 INFO: Starting Servlet Engine: Apache Tomcat/7.0.62
 Aug 28, 2015 7:56:39 AM org.apache.catalina.startup.HostConfig  deployDirectory
INFO: Deploying web application directory /home/ubuntu/apache-tomcat- 7.0.62/webapps/ROOT
Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig  deployDirectory
 INFO: Deployment of web application directory /home/ubuntu/apache - tomcat-7.0.62/webapps/ROOT has finished in 805 ms
 Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig    deployDirectory
 INFO: Deploying web application directory /home/ubuntu/apache-tomcat- 7.0.62/webapps/examples
 Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig  deployDirectory
 INFO: Deployment of web application directory /home/ubuntu/apache-  tomcat-7.0.62/webapps/examples has finished in 611 ms
 Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig  deployDirectory
 INFO: Deploying web application directory /home/ubuntu/apache-tomcat-  7.0.62/webapps/host-manager
  Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig   deployDirectory
 INFO: Deployment of web application directory /home/ubuntu/apache- tomcat-7.0.62/webapps/host-manager has finished in 204 ms
Aug 28, 2015 7:56:40 AM org.apache.catalina.startup.HostConfig  deployDirectory
INFO: Deploying web application directory /home/ubuntu/apache-tomcat    -7.0.62/webapps/manager
 Aug 28, 2015 7:56:41 AM org.apache.catalina.startup.HostConfig    deployDirectory
 INFO: Deployment of web application directory /home/ubuntu/apache- tomcat-7.0.62/webapps/manager has finished in 107 ms
Aug 28, 2015 7:56:41 AM org.apache.catalina.startup.HostConfig  deployDirectory
INFO: Deploying web application directory /home/ubuntu/apache-tomcat-  7.0.62/webapps/docs
Aug 28, 2015 7:56:41 AM org.apache.catalina.startup.HostConfig   deployDirectory
 INFO: Deployment of web application directory /home/ubuntu/apache-  tomcat-7.0.62/webapps/docs has finished in 115 ms
 Aug 28, 2015 7:56:41 AM org.apache.coyote.AbstractProtocol start
 INFO: Starting ProtocolHandler ["http-bio-8080"]
 Aug 28, 2015 7:56:41 AM org.apache.coyote.AbstractProtocol start
 INFO: Starting ProtocolHandler ["ajp-bio-8009"]
 Aug 28, 2015 7:56:41 AM org.apache.catalina.startup.Catalina start
 INFO: Server startup in 1960 ms

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">
  <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" />
  <!--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" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" 
	useIPVHosts="true" />
    <!-- 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 BIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" 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>


	<Host name="mining.knowaptitude.in"  appBase="mining_apps"
            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>

最佳答案

请检查8080端口是否可以从外部访问。端口可能被阻止。检查您的防火墙设置并打开用于 http 请求的端口。

关于java - Tomcat运行在8080端口,但是无法通过IP地址远程访问?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32266553/

有关java - Tomcat运行在8080端口,但是无法通过IP地址远程访问?的更多相关文章

  1. ruby - 如何从 ruby​​ 中的字符串运行任意对象方法? - 2

    总的来说,我对ruby​​还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby - 如何每月在 Heroku 运行一次 Scheduler 插件? - 2

    在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/

  4. ruby - 为什么 4.1%2 使用 Ruby 返回 0.0999999999999996?但是 4.2%2==0.2 - 2

    为什么4.1%2返回0.0999999999999996?但是4.2%2==0.2。 最佳答案 参见此处:WhatEveryProgrammerShouldKnowAboutFloating-PointArithmetic实数是无限的。计算机使用的位数有限(今天是32位、64位)。因此计算机进行的浮点运算不能代表所有的实数。0.1是这些数字之一。请注意,这不是与Ruby相关的问题,而是与所有编程语言相关的问题,因为它来自计算机表示实数的方式。 关于ruby-为什么4.1%2使用Ruby返

  5. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  6. ruby-on-rails - 如何在 ruby​​ 中使用两个参数异步运行 exe? - 2

    exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby​​中使用两个参数异步运行exe吗?我已经尝试过ruby​​命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何ruby​​gems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除

  7. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  8. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  9. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  10. ruby - Sinatra:运行 rspec 测试时记录噪音 - 2

    Sinatra新手;我正在运行一些rspec测试,但在日志中收到了一堆不需要的噪音。如何消除日志中过多的噪音?我仔细检查了环境是否设置为:test,这意味着记录器级别应设置为WARN而不是DEBUG。spec_helper:require"./app"require"sinatra"require"rspec"require"rack/test"require"database_cleaner"require"factory_girl"set:environment,:testFactoryGirl.definition_file_paths=%w{./factories./test/

随机推荐