• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deployment of ear without using admin console

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

can any one let me know is there any way to deploy application ear into websphere without using Admin console.
if so pls provide me the way or links where i can get useful information fot this
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can deploy from the command line using a wsadmin or jacl script.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use one of my JACL scripts, to help your learn JACL especially how to deploy an ear file. I also have a quite a library of JACL not yet posted on my site. Use my contact form if you are looking for a particular WAS JACL script. I most probably have one already.

http://www.webspheretools.com/stever/webspheretools.nsf/0/d3f3f4ab9c970a2a802573e3005d69b9!OpenDocument

04-feb-2008: In response to a forumn member I have added a JACL script designed for Websphere ND cluster EAR deployment. It shows some good tips on how to use property files which are often essential for enterprise release management.

The JACL is below, the full article is:

http://www.webspheretools.com/stever/webspheretools.nsf/0/F7AFB0CDC9031817802573E5007837C9?opendocument

########################################
# Declare Java classes for getting property pairs from props file
#########################################
proc loadProperties {propFileName} {
puts "loading prop file $propFileName"
java::import java.io.FileInputStream
java::import java.util.Properties

set fileprop [java::new Properties]
set fileStream [java::new FileInputStream $propFileName]

$fileprop load $fileStream
return $fileprop
}

########################################
# Load script properties
########################################
set log_props [loadProperties logview.props]
#-----------------------------------------------------------------
# Func delJvm(jvmEntry)
#-----------------------------------------------------------------
proc delJvm {jvmEntry} {
global AdminConfig jvm
set listProp [$AdminConfig list Property $jvm]
foreach eListProp $listProp {
set name [$AdminConfig showAttribute $eListProp name]

if { $name == $jvmEntry } {
puts "Info : - Deleting JVM Parameter : $name"
$AdminConfig remove $eListProp
#break
}
}
}
#-----------------------------------------------------------------
# Func modifyJvm {jvmEntry}
#-----------------------------------------------------------------
proc modifyJvm {jvmEntry jvmValue} {
global AdminConfig jvm
delJvm $jvmEntry
puts "Info - setting $jvmEntry with $jvmValue"
$AdminConfig modify $jvm [subst {{systemProperties {{{name {$jvmEntry}} {value {$jvmValue}}} }}} ]
}
#-----------------------------------------------------------------
# End of the function
#-----------------------------------------------------------------
set createMsg "Creating JVM Property"
set successMsg "Success creating JVM Properties"
#--------------------------------------------------------------


########################################
# Set script attributes
########################################
puts "-------------------------"
puts "setting script attributes"
puts "-------------------------"
set earFileLocation [$log_props getProperty log.app.ear.location]
set clusterName [$log_props getProperty com.log.was.cluster.name]
set earFileName [$log_props getProperty log.app.ear.name]
set warFileName [$log_props getProperty log.app.war.name]
set warModuleName [$log_props getProperty log.app.war.module.name]
set virtualHost [$log_props getProperty com.log.was.vhost]
set cell [$log_props getProperty com.log.was.cell.name]
#----------------------------------------------------------------
# change the following line if you want to install it on a node
set appServer WebSphere:cell=$cell,cluster=$clusterName
#----------------------------------------------------------------
set generator [$AdminControl completeObjectName type=PluginCfgGenerator,*]
puts "-------------------------"
puts "setting clusterId"
puts "-------------------------"
set clusterId [$AdminConfig getid /ServerCluster:$clusterName/]
set adminControlClusterId [$AdminControl completeObjectName type=Cluster,name=$clusterName,*]
set clusterMembers [$AdminConfig list ClusterMember $clusterId]
set installedApps [$AdminApp list]

########################################
# Display script attributes
########################################
puts "-------------------------"
puts "Listing script attributes"
puts "-------------------------"
puts "earFileLocation: $earFileLocation"
puts "warFileName: $warFileName"
puts "warModuleName: $warModuleName"
puts "clusterName: $clusterName"
puts "earFileName: $earFileName"
puts "virtualHost: $virtualHost"
puts "cell: $cell"
puts "appServer: $appServer"
puts "generator: $generator"
puts "clusterId: $clusterId"
puts "adminControlClusterId: $adminControlClusterId"
puts "clusterMembers: $clusterMembers"
puts "installedApps: $installedApps"

###################################
# Check if application is installed
###################################
set applicationFound 0
foreach appId $installedApps {
set existingApp $appId

if {[string compare $earFileName $existingApp] == 0} {
set applicationFound 1
break
}
}

puts "applicationFound for $earFileName: $applicationFound"

if {$applicationFound == 1} {
########################################
# Stop the log application if it is installed
#######################################
puts "-------------------------"
puts "Stopping the application: $earFileName on cluster $clusterName"
puts "-------------------------"
foreach m_id $clusterMembers {
set currentServer [$AdminConfig showAttribute $m_id memberName]
set currentNodeName [$AdminConfig showAttribute $m_id nodeName]
set query cell=$cell,node=$currentNodeName,type=ApplicationManager,
append query process=$currentServer,*
set appManager [$AdminControl queryNames $query]
puts "Stopping $earFileName on node $currentNodeName, server $currentServer."
if {[catch "$AdminControl invoke $appManager stopApplication $earFileName"]} {
# Exception is thrown don't do any thing
puts "Info: Exception is thrown while stopping application, this could be due to the fact that application is already stopped"
}
}

########################################
# Uninstall the current application if it is installed
########################################
puts "-------------------------"
puts "Uninstalling the application: $earFileName"
puts "-------------------------"
$AdminApp uninstall $earFileName

########################################
# Save the configuration if it is installed
########################################
puts "-------------------------"
puts "Saving the configuration"
puts "-------------------------"
$AdminConfig save
}

########################################
# Stop the cluster
########################################
puts "-------------------------"
puts "Stopping the cluster: $clusterName"
puts "-------------------------"
$AdminControl invoke $adminControlClusterId stop

########################################
# MapModulesToServers
########################################
puts "Setting MapModulesToServers attributes"
set module_log [list "$warModuleName" "$warFileName,WEB-INF/web.xml" $appServer]

########################################
# MapWebModToVH
########################################
puts "Setting MapWebModToVH attributes"
set virtualhost_log [list "$warModuleName" "$warFileName,WEB-INF/web.xml" $virtualHost]

########################################
# MapRolesToUsers
########################################
puts "Setting MapRolesToUsers attributes"

set opts [list -appname $earFileName]

set optss $opts
set webservers 0
set httpServer ""
for {set nodeIndx 1} {[string length [set nodeName [$log_props getProperty com.log.was.node$nodeIndx.name]]] != 0} {incr nodeIndx} {
puts "Info: checking for the web server name in $nodeName"
for {set httpServerIndx 1} {[string length [set httpServerName [$log_props getProperty loadmanager.http.node$nodeIndx.server$httpServerIndx]]] != 0} {incr httpServerIndx} {
set webservers 1
if {$httpServer == ""} {
set httpServer WebSphere:cell=$cell,node=$nodeName,server=$httpServerName
} else {
set httpServer $httpServer+WebSphere:cell=$cell,node=$nodeName,server=$httpServerName
}
}
}

puts "Info: - Web Server status $webservers now deploy to $appServer and $httpServer "

if {$webservers == 1} {
set module_log_web [list "$warModuleName" "$warFileName,WEB-INF/web.xml" $appServer+$httpServer]
lappend opts -MapModulesToServers [list $module_log_web $module_log]
} else {
set module_log_web [list "$warModuleName" "$warFileName,WEB-INF/web.xml" $appServer]
puts "-------------------------"
puts "module_log_web = $module_log_web"
puts "-------------------------"
puts "module_log = $module_log"
puts "-------------------------"

lappend opts -MapModulesToServers [list $module_log_web $module_log]

}

lappend opts -MapWebModToVH [list $virtualhost_log]

########################################
# Install the Enterprise Application (EAR)
########################################
puts "-------------------------"
puts "Installing $earFileLocation using $opts"
puts "-------------------------"
$AdminApp install $earFileLocation $opts

########################################
# Regenerate the node plug-in config
########################################

if {$webservers == 0} {
puts "-------------------------"
puts "No WebServer plugins. No need to regenerate the node plug-in config"
puts "-------------------------"
} else {
puts "-------------------------"
puts "Regenerating the node plug-in config"
puts "-------------------------"
set WASRoot [$log_props getProperty com.log.was.profile.home]
puts "info --- generating plugin for $nodeName ---- $WASRoot"
$AdminControl invoke $generator generate "$WASRoot $WASRoot/config $cell null null plugin-cfg.xml"
puts "info --- plugin generated successfully"
}

########################################
# Save the configuration
########################################
puts "-------------------------"
puts "Saving the configuration"
puts "-------------------------"
$AdminConfig save

########################################
# Syncronizing Nodes
########################################
puts "-------------------------"
puts "Syncronizing Nodes"
puts "-------------------------"
for {set nodeIndx 1} {[string length [set nodeName [$log_props getProperty com.log.was.node$nodeIndx.name]]] != 0} {incr nodeIndx} {
puts "Node name : $nodeName"
set nodeToSync [$AdminControl completeObjectName type=NodeSync,node=$nodeName,*]
$AdminControl invoke $nodeToSync sync
}


#----------------------------------------------------------
# Loop thru the server and node to set the jvm properties
#----------------------------------------------------------

for {set nodeIndex 1} {[string length [set nodeName [$log_props getProperty com.log.was.node$nodeIndex.name]]] !=0} {incr nodeIndex} {

puts "Info : - Node name : $nodeName"
set nodeID [$log_props getProperty com.log.was.node$nodeIndex.id]
puts "Info :- Node id: $nodeID"
set serverName [$log_props getProperty com.log.was.node$nodeID.app.server]
puts "Info : - Server name : $serverName"

#---------------------------------------
# Create the ServerID and AdminConfig
#----------------------------------------


set serverId [$AdminConfig getid "/Node:$nodeName/Server:$serverName/"]
puts "Info : -- Checking for existence of server '/Node:$nodeName/Server:$serverName/'"

if {[llength $serverId] == 0} {
puts "Error: -- Server '/Node:$nodeName/Server:$serverName/' not found"
} else {
puts "Success: -- Server ID '$serverId' found"
}

#------------------------------------------------------
# Start of jvm parameters loop
#-----------------------------------------------------
set jvm [$AdminConfig list JavaVirtualMachine $serverId]
for {set jvmIndx 1} {[string length [set jvmEntry [$log_props getProperty com.log.jvm.param$jvmIndx]]] != 0} {incr jvmIndx} {

# change for only DMS_LOGGING and logLog4j.configuration
set jvmVal [$log_props getProperty $jvmEntry]
if {[llength $jvmVal] == 0} {
set jvmVal [$log_props getProperty "$serverName.$jvmEntry"]
puts "Success: --value -- $jvmVal"
}
modifyJvm $jvmEntry $jvmVal
}
#------------------------------------------------------
# End of jvm parameters loop
#-----------------------------------------------------
#-----------------------------------------------------
# Now print the values that have been created so far
#-----------------------------------------------------
set listProp [$AdminConfig list Property $jvm]
foreach eListProp $listProp {
set name [$AdminConfig showAttribute $eListProp name]
puts "Info : - $name"
}

puts "JVM parameters $successMsg"
}

$AdminConfig save

########################################
# Start the cluster
########################################
puts "-------------------------"
puts "Starting the cluster: $clusterName"
puts "-------------------------"
$AdminControl invoke $adminControlClusterId start
puts "-------------------------"
puts "Please check Admin Console or Server Log for Cluster and Application Status."
puts "-------------------------"

puts "Task Completed..."
[ February 04, 2008: Message edited by: Steve Robinson ]
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a sample, ver simple, JACL script:

I've put together a few dozen on my site - from the simple to the complicated: Carlos the JACL at <a href="http://www.pulpjava.com</a>" target="_blank" rel="nofollow">www.pulpjava.com[/url]

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic