Posted on 2008-08-19 10:20
Prayer 阅读(737)
评论(0) 编辑 收藏 引用 所属分类:
GLASSFISH
一般在Glassfish下面新建domain都是使用其自带的ANT文件setup.xml。有时需要建立多个domain来区分开发和生产环境。如果直接修改setup.xml中的domain.name来新建,则两个domain会由于端口冲突不能同时运行。setup.xml中列出了Glassfish用到的如下端口:
- <property name="admin.port" value="4848"/>
- <property name="instance.port" value="8888"/>
- <property name="orb.port" value="3700"/>
- <property name="imq.port" value="7676"/>
- <property name="https.port" value="8181"/>
<property name="admin.port" value="4848"/>
<property name="instance.port" value="8888"/>
<property name="orb.port" value="3700"/>
<property name="imq.port" value="7676"/>
<property name="https.port" value="8181"/>
但实际上Glassfish还用到了如下端口,这些端口没有在setup.xml中列出:
- orb.ssl.port
- orb.mutualauth.port
- domain.jmxPort
orb.ssl.port
orb.mutualauth.port
domain.jmxPort
如果需要两个domain能同时运行,domain所用到的以上所有的端口都不能相同。上面列出的三个端口跟前面的一样,是通过"--domainproperties"在setup.xml中作为参数传入的:
- <target name="create.domain" depends="setup.init,set.env">
- <exec executable="${ASADMIN}" failonerror="true">
- ...
- <arg line="--domainproperties orb.listener.port=${orb.port}:jms.port=${imq.port}:http.ssl.port=${https.port}:domain.jmxPort=${jmx.admin}:orb.ssl.port=${iiop_ssl}:orb.mutualauth.port=${iiop_mutualauth}" />
- ...
- </exec>
- ...
- </target>
<target name="create.domain" depends="setup.init,set.env">
<exec executable="${ASADMIN}" failonerror="true">
...
<arg line="--domainproperties orb.listener.port=${orb.port}:jms.port=${imq.port}:http.ssl.port=${https.port}:domain.jmxPort=${jmx.admin}:orb.ssl.port=${iiop_ssl}:orb.mutualauth.port=${iiop_mutualauth}" />
...
</exec>
...
</target>
这样在setup.xml中如下设置这些对应的属性即可:
- <property name="admin.port" value="4848"/>
- <property name="instance.port" value="8888"/>
- <property name="orb.port" value="3700"/>
- <property name="imq.port" value="7676"/>
- <property name="https.port" value="8181"/>
-
- <property name="iiop_ssl" value="3821"/>
- <property name="iiop_mutualauth" value="3921"/>
- <property name="jmx.admin" value="8687"/>
<property name="admin.port" value="4848"/>
<property name="instance.port" value="8888"/>
<property name="orb.port" value="3700"/>
<property name="imq.port" value="7676"/>
<property name="https.port" value="8181"/>
<property name="iiop_ssl" value="3821"/>
<property name="iiop_mutualauth" value="3921"/>
<property name="jmx.admin" value="8687"/>
每次新建domain时,增加这些端口的值就可以保证新建的domain能正常启动而不与已有的domain发生端口冲突。