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에 등록된 서비스 이름입니다.
15 <constructor>
16 <!-- The name of the set of bindings to use for this server -->
17 <parameter>${jboss.service.binding.set:ports-default}</parameter>
18
19 <!-- The named sets of bindings -->
20 <parameter>
21 <bean name="ServiceBindingStore" class="org.jboss.services.binding.impl.PojoServiceBindingStore">
22
23 <!-- Base bindings that are used to create bindings for each set -->
24 <property name="standardBindings"><inject bean="StandardBindings"/></property>
25
26 <!-- The sets of bindings -->
27 <property name="serviceBindingSets">
28 <set>
29 <inject bean="PortsDefaultBindings"/>
30 <inject bean="Ports01Bindings"/>
31 <inject bean="Ports02Bindings"/>
32 <inject bean="Ports03Bindings"/>
33 </set>
34 </property>
35 </bean>
36 </parameter>
37 </constructor>
위의 port-default 값은 아래쪽의 xml 설정을 보시면 다음과 같이 정의되어 있습니다.
41 <!-- The ports-default bindings are obtained by taking the base bindings and adding 0 to each port value -->
42 <bean name="PortsDefaultBindings" class="org.jboss.services.binding.impl.ServiceBindingSet">
43 <constructor>
44 <!-- The name of the set -->
45 <parameter>ports-default</parameter>
46 <!-- Default host name -->
47 <parameter>${jboss.bind.address}</parameter>
48 <!-- The port offset -->
49 <parameter>0</parameter>
50 <!-- Set of bindings to which the "offset by X" approach can't be applied -->
51 <parameter><null/></parameter>
52 </constructor>
53 </bean>
위에서 중요한 태그는 'ports-default'라는 파라미터 이름과 붉은 부분으로 표시된 offset 값입니다. 기본 port는 RMI 1099, Web 8080, AJP 8009로 시작하며 실제 Ports01Bindings의 경우 기본 offset에 100값을 더한 값으로 세팅되어 있습니다.(bindings.xml 참조). 즉 ports-01을 사용하게 되면 RMI는 1199, Web 8180, AJP 8109 와 같은 형식으로 포트를 변경하게 됩니다.
Offset 파라미터를 조정함으로써 수십개의 포트를 손쉽게 추가할 수 있는 기능이 마련되었습니다.