How to deploy and undeploy an EAR application in IBM Websphere application server ?

0 comments



Below script can be used to Deploy and undeploy the ear application in IBM WebSphere application server.

#Application and target setting

set ear_file "@{DIRECTORY-PATH}/@{ear file}.ear"
set server "@{server name}"
set node "@{node name}"
set appName "@{applicationName}"

# -------------------------------------------------------------------
# BindJndiForEJBNonMessageBinding settings
# -------------------------------------------------------------------
set bind_option "-BindJndiForEJBNonMessageBinding"
set bind_mod "\"@{EJB name}\""
set bind_ejb "@{EJB name}"
set bind_uri "@{ejb}.jar,META-INF/ejb-jar.xml"
set bind_jndi "ejb/@{EJB name}"

# -------------------------------------------------------------------
# MapEJBRefToEJB settings
# -------------------------------------------------------------------
set map_option "-MapEJBRefToEJB"
set map_mod "\"@{WEB_URI}\""
set map_ejb "\"\""
set map_uri "@{war file}.war,WEB-INF/web.xml"
set map_ref "ejb/@{EJB name}"
set map_class "@{com.tcs.bfs.sample.SampleLocal}"
set map_jndi $bind_jndi

# -------------------------------------------------------------------
# Construct BindJndiForEJBNonMessageBinding option list
# -------------------------------------------------------------------
set bind_string "$bind_mod $bind_ejb $bind_uri $bind_jndi"
set bind_list [list $bind_string]

# -------------------------------------------------------------------
# Construct MapEJBRefToEJB option list
# -------------------------------------------------------------------
set map_string "$map_mod $map_ejb $map_uri $map_ref $map_class $map_jndi"
set map_list [list $map_string]

# -------------------------------------------------------------------
# Construct $AdminApp command
# -------------------------------------------------------------------
set cmd_opt_list [list -node $node -server $server]
lappend cmd_opt_list $bind_option
lappend cmd_opt_list $bind_list
lappend cmd_opt_list $map_option
lappend cmd_opt_list $map_list
$AdminApp install $ear_file $cmd_opt_list
$AdminConfig save

# -------------------------------------------------------------------
# Invoke node synchronization
# -------------------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$node,*]
$AdminControl invoke $var sync

No comments:

Post a Comment

Recent Posts

Popular Posts

© 2011-2019 Web Portal Club