« Command Line Editing in WLST Interactive Mode | Main | Starting WLS through nodemanager details »

Redeploying libraries in iterative development

iterative.jpg
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:

  1. Undeploy referring applications
  2. Redeploy library
  3. 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)

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mt/mt-tb.cgi/13355

Comments (3)

godra:

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?

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.

Jean Drolet:

If use ant, the same results can be achieved with wldeploy ant task.

Post a comment

About This Entry

This page contains a single entry from the blog posted on August 12, 2009 3:09 PM.

The previous post in this blog was Command Line Editing in WLST Interactive Mode.

The next post in this blog is Starting WLS through nodemanager details.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle