Weblogic, side-by-side deployment
August 5, 2009 10 Comments
Weblogic Server supports a nice feature called side-by-side deployment (or versioned deployment). This function is extremely usefull when you need to deploy a new version of an application and still keep the old one up and running. So the running instances will still use the current version and all new instances will be able to invoke the new deployed version of the application.
As soon as all the sessions who’re using the old version of the application are expired, Weblogic will recognize it and will deactivate the old version. So at this moment only the new deployed version is active and all new sessions will make us of it.
So how does this work.
You could either use wlst to deploy the application and specifiy the versionnumber on deployment as one of the parameters or you can use the manifest.mf file. We’ll be using the last one.
- Create a webservice project
- Edit to manifest file located in WebContent > META-INF and add the next on a new row : ‘WebLogic-Application-Version: v1′
- Package the service and deploy it in the console
- Go to the Weblogic Console > Deployments. Click ‘Lock & Edit’ and in the deployments part click Install
- Select the just created archive
- Install this deployment as an application
- Optional Settings. And in here we will see the ‘Archive Version’ of our application. Change the name to ‘MyService’ and leave the rest on default value
Now create a new version of the application and change the v1 in the manifest file to v2, and package it.
- Go to the Weblogic Console > Deployments. Click ‘Lock & Edit’, select the application we want to update (MyService) and in the deployments part click Update
- Click Change Path of the source path and select the just created archive (v2), the application will be deployed as version v2
Version v1 gets status ‘Retired’ and the new version v2 will get status ‘Active’.
We have the next scenarios
Version v1 is deployed. Deploy version v2. The new version v2 will get status ‘Active’ and the old version v1 will get status ‘Retired’.
Since there aren’t any open sessions Weblogic will recognize this and changed the status of the version v1
- Version v1 is deployed and has open sessions. Deploy version v2. The new version v2 will get status ‘Active’ and the old version v1 will stay on status ‘Active’ untill all sessions to it will be closes. After that, Weblogic will change the status to ‘Retired’ and the only ‘Active’ version will be v2