JBoss 5.0의 포트 기준이 바뀌었습니다.
기존에서는 /jboss-eap-4.3/jboss-as/docs/examples/binding-manager/sample-bindings.xml 파일을 기준으로 conf/jboss-service.xml파일을 수정하여 변경했었습니다. 이 파일의 경우 단지 4개의 포트를 추가할 수밖에 없었고, 새로운 포트를 추가하려면 사용자가 부가적인 작업을 해줬어야 했습니다.
5.0에서는 설정 파일도 달라졌으며, offset을 이용한 port 변경 방식이 도입되었습니다.
$SERVER_HOME/conf/bootstrap 디렉토리를 보게되면 bindings.xml 파일이 존재합니다.
위 파일을 열어보면 다음과 같은 tag가 설정되어 있습니다. 붉은 색으로 나타난 첫번째 파라미터인 "ports-default'가 사용됨을 의미하는데 "${jboss.service.binding.set:ports-default}"는 JMX에 등록된 서비스 이름입니다.
위의 port-default 값은 아래쪽의 xml 설정을 보시면 다음과 같이 정의되어 있습니다.
위에서 중요한 태그는 'ports-default'라는 파라미터 이름과 붉은 부분으로 표시된 offset 값입니다. 기본 port는 RMI 1099, Web 8080, AJP 8009로 시작하며 실제 Ports01Bindings의 경우 기본 offset에 100값을 더한 값으로 세팅되어 있습니다.(bindings.xml 참조). 즉 ports-01을 사용하게 되면 RMI는 1199, Web 8180, AJP 8109 와 같은 형식으로 포트를 변경하게 됩니다.
Offset 파라미터를 조정함으로써 수십개의 포트를 손쉽게 추가할 수 있는 기능이 마련되었습니다.
JBoss 5.0의 경우 설정 방식이나 디렉토리 구조가 조금 바뀌었습니다.
기존 방식에서는 $SERVER_HOME/deploy/jboss-web.deployer 파일을 이용하여 포트를 변경하였으나, 5.0에서 포트를 변경하기 위해서는 변경된 $SERVER_HOME/deploy/jbossweb.sar 디렉토리 하위의 server.xml파일을 변경하시면 됩니다.
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
<!-- Add this option to the connector to avoid problems with
.NET clients that don't implement HTTP/1.1 correctly
restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
-->
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"
redirectPort="8443" />
필요에 따라 AJP Connector도 변경하시면 됩니다.
<mbean
code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute
name="ServerName">ports-01</attribute>
<attribute
name="StoreURL">${jboss.home.url}/conf/port-bindings.xml</attribute>
<attribute
name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
|
AJP Port |
HTTP Port |
|
ports-01 |
8109 |
8180 |
|
ports-02 |
8209 |
8280 |
|
ports-03 |
8309 |
8380 |
|
ports-04 |
8409 |
8480 |
|
ports-05 |
8509 |
8580 |
|
ports-06 |
8609 |
8680 |
|
ports-07 |
8709 |
8780 |
|
ports-08 |
8809 |
8880 |
|
ports-09 |
8909 |
8980 |
|
아래의 코드를 복사하셔서 web application context에 vm.jsp로 저장하신 후 확인하시면 됩니다.
<%@ page contentType="text/html; charset=euc-kr" %>
<%@ page import="java.net.InetAddress" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%
if (request.getParameter("gc") != null) {
System.gc();
System.runFinalization();
}
Properties p = System.getProperties();
%>
<HTML>
<HEAD>
<META content="text/html; charset=euc-kr" http-equiv=Content-Type>
<!--META http-equiv="Refresh" content="10;url=<%= request.getRequestURI() %>"-->
<link href="style.css" rel=stylesheet type="text/css">
</HEAD>
<body leftmargin=15 topmargin=10>
<center><p>
<table width="600" cellpadding="7" cellspacing="0" border="1" bordercolordark="WHITE" bordercolorlight="BLACK">
<tr><td>
■ HOST : <%= InetAddress.getLocalHost().getHostName() %>
(<%= InetAddress.getLocalHost().getHostAddress() %>)
<% SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss z", Locale.CHINA); %>
■ Current Time : <%= formatter.format(new Date()) %>
</td></tr>
<tr><td align=center>
<%
Runtime rt = Runtime.getRuntime();
long free = rt.freeMemory();
long total = rt.totalMemory();
long usedRatio = (total - free) * 100 / total;
long unusedRatio = free * 100 / total;
%>
<table width=100% bgcolor="lightgrey" border=1 cellpadding=6 cellspacing=0>
<tr>
<td align="center" colspan="2">Total Java Virual Machine Memory (<b><%= total/1024 %> KB</b>)</td>
</tr>
<tr bgcolor=#E3E3E3>
<td align="center">Used Memory (<b><%= (total - free)/1024 %> KB</b>)</td>
<td align="center">Available Memory (<b><%= free/1024 %> KB</b>)</td>
</tr>
<tr bgcolor=#E8EEEC>
<td><hr color="#CC3366" align=left size=10 width="<%= usedRatio %>%" noshade>
(<%= usedRatio %> %)</td>
<td><hr color="#0066FF" align=left size=10 width="<%= unusedRatio %>%" noshade>
(<%= unusedRatio %> %)</td>
</tr>
</table>
<p>
<a href="<%= request.getRequestURI() %>?gc=">
<img src="trash.gif" valign=middle border=0> Execution GC</a>
<a href="<%= request.getRequestURI() %>">
<img src="refresh.gif" valign=middle border=0> Reload</a>
</td></tr>
</table>
</center>
</BODY>
</HTML>