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.

25 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.

Andrej Baranovskij 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

Andrej Baranovskij said...

Thanks for sample script.

Andrejus

Anonymous 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.

Andrej Baranovskij 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

Anonymous 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

Andrej Baranovskij 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

Anonymous 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.

Andrej Baranovskij 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?

Andrej Baranovskij said...

Please mention what line you needed?

Andrejus

AnAverageJoe 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.

Andrej Baranovskij said...

Interestin - I didnt faced that. Thanks for update.

Andrejus

Anonymous 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

Mohammed Tanveer said...

Hi

One issue I faced with this approach is that - Even for new session old code/ui is displayed. The code only refreshes once I restart managed server. This kills the HA concept.

Andrej Baranovskij said...

Something is wrong with your deployment process. It should show new version for new session, without server restart.

Regards,
Andrejus

Anonymous said...

Hello,

Followiny your steps for ADF 12.2.1.1.0 results in no version change. Deployment log doesn't show any artifact that the Manifest.MF file is even been considered. Can you confirm this still functions for 12.2.1.1.0?

Thanks,

Alex

Andrej Baranovskij said...

Hi,

It works fine in 12.2.1.1 and 12.2.1.2, probably mistype in your config.

Regards,
Andrejus

Marco said...

Hi Andrejus,

I follow this post and all works fine in 12.2.1.2. A question, how i can read MANIFEST.MF from my ViewController project? The goal is to show EAR version in the application UI.

Regards,
Marco

Shrikant Kandkurwar said...

Its very very helpful post for the developer...thank you Andrejus. I tried it on 11.1.1.5 version and getting expected result as stated.

José said...

Hello
I have generated the ear file with the versioned manifest, however I have doubts on how the file is uploaded to the weblogic. Do I have to upload the ear file with another name (myEar_version2) and then deploy it for both versions to work (myEar_version1)?

Unknown said...

Hello
I am trying to make a Ear versioned, by palcing the manifest file directly in the Ear(path- xxx.EAR/META-INF/MANIFEST.MF) and deploying it.
The ear is Deployed on the weblogic sucessfully with version but i am facing issue on updating the next EAR with updated version.
Is there a entry i need to make in Ear xml's?
Do weblogic reads a XML file in EAR for deployment process?