解决的方案:部署在不同的domain中,并控制domain启动的顺序
例子:applications: RestaurantCenter (比mobile先load);mobile。
服务器: 内网192.168.1.18上
glassfish的路径:/opt/glassfish2.1
1.首先,创建两个domain :domain1,domain2
创建domain1 :ant -f setup1.xml <property name="domain.name" value="domain1"/>
<property name="instance.name" value="server"/>
<property name="admin.user" value="admin"/>
<property name="admin.password" value="adminadmin"/>
<property name="admin.port" value="4849"/>
<property name="instance.port" value="8082"/>
<property name="orb.port" value="3701"/>
<property name="imq.port" value="7677"/>
<property name="https.port" value="8182"/>
<property name="iiop_ssl" value="3822"/>
<property name="iiop_mutualauth" value="3922"/>
<property name="jmx.admin" value="8687"/>
创建domain2 :ant -f setup2.xml <property name="domain.name" value="domain2"/>
<property name="instance.name" value="server"/>
<property name="admin.user" value="admin"/>
<property name="admin.password" value="adminadmin"/>
<property name="admin.port" value="4848"/>
<property name="instance.port" value="8080"/>
<property name="orb.port" value="3700"/>
<property name="imq.port" value="7676"/>
<property name="https.port" value="8181"/>
2.写启动脚本(见/etc/init.d/glassfish2.1):
USER=glassfish
export GLASSFISH_HOME=/opt/glassfish2.1
export AS_HOME=/opt/glassfish2.1
export JAVAEE_HOME=$AS_HOME
export DERBY_HOME=$AS_HOME/javadb
export PATH=$PATH:$AS_HOME/bin:$DERBY_HOME/bin:$JAVA_HOME/bin
glassfish_stop() {
$GLASSFISH_HOME/bin/asadmin stop-domain domain2
$GLASSFISH_HOME/bin/asadmin stop-domain domain1
}
glassfish_start() {
$GLASSFISH_HOME/bin/asadmin start-domain domain1
$GLASSFISH_HOME/bin/asadmin start-domain domain2
}
db_start() {
su - $USER -c "$GLASSFISH_HOME/bin/asadmin start-database"
}
db_stop() {
su - $USER -c "$GLASSFISH_HOME/bin/asadmin stop-database"
}
case "$1" in
start)
# db_start
glassfish_start
;;
stop)
glassfish_stop
# db_stop
;;
restart)
glassfish_stop
glassfish_start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
设置脚本为自动运行command to set up running the script:
# sudo update-rc.d glassfish2.1 defaults
posted on 2009-06-16 15:23
冰是没有未来的,因为它的永恒 阅读(226)
评论(0) 编辑 收藏 所属分类:
web 服务器