Linux查看程序端口占用情况

今天发现服务器上Tomcat 8080端口起不来,老提示端口已经被占用。
使用命令:
ps -aux | grep tomcat
发现并没有8080端口的Tomcat进程。
使用命令:netstat –apn
查看所有的进程和端口使用情况。发现下面的进程列表,其中最后一栏是PID/Program name
clip_image002
发现8080端口被PID为9658的Java进程占用。
进一步使用命令:ps -aux | grep java,或者直接:ps -aux | grep pid 查看
clip_image004
就可以明确知道8080端口是被哪个程序占用了!然后判断是否使用KILL命令干掉!

方法二:直接使用 netstat   -anp   |   grep  portno
即:netstat –apn | grep 8080

Virtual Hosts with JBoss AS

转自:https://community.jboss.org/wiki/VirtualHostsWithJBossAS

If you want to set up a virtual host for your web app, create or modify the WEB-INF/jboss-web.xml to contain the highlighted line as follows:

 

your-app.war/WEB-INF/jboss-web.xml

<jboss-web>    <virtual-host>www.mycompany.com</virtual-host>    <virtual-host>www.myothercompany.com</virtual-host><context-root>/</context-root> </jboss-web>

 

The following example shows a vhost configuration for the jmx-console.war for jboss-5.0.

jbossweb.sar/server.xml

<Server>    <Service name="jboss.web">       <!-- A HTTP/1.1 Connector on port 8080 -->       <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"                connectionTimeout="20000" redirectPort="8443" ></Connector>       <Engine name="jboss.web" defaultHost="localhost"> ...          <Host name="localhost"> ...             <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"                 cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"                 transactionManagerObjectName="jboss:service=TransactionManager" ></Valve>          </Host>          <Host name="loopback">             <Alias>loopback-120</Alias>             <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"                 cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"                 transactionManagerObjectName="jboss:service=TransactionManager" ></Valve>          </Host>     </Engine>   </Service> </Server>

 

 

jmx-console.war/WEB-INF/jboss-web.xml

<jboss-web>    <!-- Uncomment the security-domain to enable security. You will       need to edit the htmladaptor login configuration to setup the       login modules used to authentication users.       <security-domain>java:/jaas/jmx-console</security-domain>    -->    <virtual-host>loopback</virtual-host> </jboss-web>