Wednesday, December 21, 2011

How to set EAR Version for ADF Application on WebLogic

If it happened to deploy ADF application on WebLogic, most likely you noticed that it assigns default version V2.0 for each ADF deployment. We would like to set our own specific version, instead of having V2.0 assigned by default:


This can be achieved by creating Manifest file inside root src/META-INF folder:


You must create Manifest file by yourself and it should be visible under META-INF descriptors from JDeveloper:


ADF application version is specified by Weblogic-Application-Version parameter inside Manifest file:


Register Manifest file with application deployment profile - include Manifest under EAR options:


Make sure to remove Manifest file from Application Descriptor filters - otherwise file will be included twice and deployment fail:


Application with our predefined version is deployed. Previos version is not removed, but is retired - we can remove it later or restore if needed:


Download sample application, it includes sample Manifest file - ADFVersionApp.zip.

17 comments:

Hasim said...

if there are multiple version running on weblogic then user request will be serviced by which deployment. I have seen issue ,if multiple version are deployed with different context then too it will show GUI of version 1 instead of version 2 on different context.

Andrejus Baranovskis said...

There must be always one version running at one time, other versions should be retired - as per screenshot...

Regards,
Andrejus

Edwin Biemond said...

Hi,

I do it all with ANT like this ( this is a war , but I also do it with a shared lib ,ejb, ear etc )

<war destfile="${workspace.dir}/deploy/${deployment.name}.war" needxmlfile="false">
<lib dir="${workspace.dir}/deploy">
<include name="*.jar"/>
</lib>
<manifest>
<attribute name="Extension-Name" value="${deployment.name}" />
<attribute name="Specification-Version" value="${version.number}" />
<attribute name="Implementation-Title" value="${deployment.name}"/>
<attribute name="Implementation-Version" value="${version.number}-b${build.number}" />
<attribute name="Implementation-Vendor" value="Enbridge" />
<attribute name="Weblogic-Application-Version" value="${version.number}-b${build.number}"/>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${build.date}" />
</manifest>
</war>

thanks

Andrejus Baranovskis said...

Thanks for sample script.

Andrejus

Julien Schneider said...

Hasim,

both version run in parallel while there are session still valid.
Users already connected to old version will continue to use it as long as their session is valid.
New users will use the new version of the application.
Once all sessions on old version are no more, the old application will be retired.

Andrejus Baranovskis said...

Hi,

I tested - app version goes to Retired state, even there is active user session. At least with default settings. Any specific configuration should be set?

Andrejus

Julien Schneider said...

This is the default behavior that while there are some active sessions the old application will have an intermediate 'stop running' status, so if your application was put to Retired all sessions must have been closed.

That's what i observe on all my applications

Andrejus Baranovskis said...

For my test case, I had couple of opened sessions. Most likely it just kills sessions attached with old application and sets Retired state.

Andrejus

Julien Schneider said...

ok, i understand why.
If you update the deployed application from the weblogic console at some point during deployment you have the choice between allowing the app. to finish the current sessions (it's the default behavior) or retire after a timeout (by default 1 in the console).
Jdev is probably using the later option.

Andrejus Baranovskis said...

I see, thats explains it.

Wendy Tromp said...

I tested this in JDeveloper 11.1.1.3 and I needed another bogus line in the MANIFEST.MF file for it to work properly. Otherwise the file is simply ignored and the version stays 2.0. Has anyone else noticed this?

Andrejus Baranovskis said...

Please mention what line you needed?

Andrejus

WOzzie said...

Great concise post - thankyou Andrejus

Anonymous said...

Wendy mentioned:

"I needed another bogus line in the MANIFEST.MF file for it to work properly"

It is important that the last line in MANIFEST.MF be terminated properly with 0x0D 0x0A ( like all previous lines ) else it will be ignored.

Andrejus Baranovskis said...

Interestin - I didnt faced that. Thanks for update.

Andrejus

Micajah McGarity said...

Then is there a way to programmatically (in java) obtain the version number of this EAR?

Shahzad Ahmed Khan said...

Hello Andrejus,
I am new in adf and using jdev11.1.2.3.
I have followed all the steps as mentioned in your post. Application is deployed successfully but where can i found version information in weblogic console. There is no option for version of ear.
Please advice