在server文件里改了其他端口以后也可以正常启动tomcat,没有报端口被占用的错误,但是没有办法访问,改回8080端口就可以正常使用了,是为什么。
是否是服务器,查看下入站规则里是否只配置了8080
配置文件server.xml贴出来看看
因为你修改的端口号 早已被其他进程的端口占用了 你打开任务管理器 有一个PID 这是你操作系统你能看到的 "进程端口号"!
试一试用Ip地址访问
配置文件没配全吧,配置文件里需要修改端口8080为其他端口的不只一个地方
我这边一个机器上装3个tomcat,都能正常运行,一个用一个端口
不对,应该是防火墙没开放你配置的端口。执行:
vi /etc/sysconfig/iptables
复制一行已存在的INPUT,然后修改成你配置的端口。以上适用于centos,如果是其他系统,百度一下吧。
希望对你有帮助。
<?xml version='1.0' encoding='utf-8'?>
<!-- Security listener. Documentation at /docs/config/listeners.html
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
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" />
<!-- 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
-->
<!--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="8081" 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 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="www.yinling365.com" appBase="ROOT"
unpackWARs="true" autoDeploy="true">
<Context docBase="C:\war\mdoor" path="" debug="0" reloadable="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 "%r" %s %b" />
</Host>
</Engine>
防火墙的问题吧,检查下防火墙,看看其他端口开放没。
你看下,,,你改成别的端口,, 日志里面有木有显示在 某某端口启动成功。
防火墙关掉在访问,遇到过类似的,是防火墙引起的,关键服务器本机能访问么?