
Deployment command and tools deal with libraries in the same way as applications. The same set of commands are supported for libraries as for applications. There are, however, additional restrictions on library undeployment and redeployment. Undeployment or redeployment of a library is disallowed in case there are any deployed applications that refer to it in a running server. This does not necessarily interfere with upgrade scenarios. The recommended practice for upgrading shared libraries is to use versions and not to use "exact-match" while referring to libraries. A new version of library may be deployed without touching the older version. The applications that need to be upgraded may then simply be redeployed.
There is, however, a need for developers who create these libraries to test a change in deployed libraries in an iterative development scenario. If the developer does not mind loosing application state, she could use getReferencingRuntimes() methods of LibraryRuntimeMBean to identify referring applications and perform the following steps:
- Undeploy referring applications
- Redeploy library
- Deploy applications from the list gathered in #1
Here is a simple function that implements steps 1 - 3:
def redeployLibraryWithApps(libraryName):
serverRuntime()
cd('LibraryRuntimes/'+libraryName)
apps=cmo.getReferencingRuntimes()
appPaths={}
domainConfig()
cd('AppDeployments')
for app in apps:
appId = app.getApplicationIdentifier()
cd(appId)
appPaths[appId] = cmo.getAbsoluteSourcePath()
cd('..')
undeploy(appId)
redeploy(libraryName)
for appId in appPaths.keys():
deploy(appId, appPaths[appId])
return
Such a function may then be used in WLST scripts:
if (len(sys.argv) < 4):
print "Usage java weblogic.WLST redeployLib.py [username] [password] [library-name]"
exit()
connect(sys.argv[1],sys.argv[2])
redeployLibraryWithApps(sys.argv[3])
disconnect()
(Picture licensed from quapan under Creative Commons)
Comments (3)
hey. after i build my app, i saw that best is to redeploy the application from WebLogic. The question is: After i redeploy the app, is it ok to restart the WL? are there any chances that something not to work if i don't restart the WL? thanks
- is it necessary, or safe to restart the WL after redeploy?
Posted by godra | November 9, 2009 7:55 AM
Posted on November 9, 2009 07:55
Godra: It okay & safe to restart the server but it is not necessary. Redeploying the application is enough to pick up the new application bits.
Posted by Aseem Bajaj | November 9, 2009 9:05 AM
Posted on November 9, 2009 09:05
If use ant, the same results can be achieved with wldeploy ant task.
Posted by Jean Drolet | November 20, 2009 1:27 PM
Posted on November 20, 2009 13:27