Conversion of an enterprise application to an OSGi application

To convert an enterprise application to an OSGi application, you convert the enterprise archive (EAR) file to an enterprise bundle archive (EBA) file. Before you do this, consider whether the contents of the EAR file are suitable for automatic conversion.

Some enterprise applications can be converted automatically to an OSGi application, some require manual conversion steps, and some require only partial conversion.

It is assumed that the enterprise application that you convert is a single EAR file.

With a large or complex application, it might be appropriate to convert only aspects of the application. For example, the following areas of the application might be suitable for conversion:

Manual conversion steps

If an enterprise application contains web applications and utility JAR files, and the utility JAR files are referenced by using a Class-Path attribute or an Extension-List attribute, conversion requires manual steps. You can do one of the following:
  • Move the JAR file to the WEB-INF/lib directory of the WAR file. This option is simple, but you do not get all the benefits of OSGi. For example, the same library file might be duplicated in many WAR files.
  • Convert the JAR file to an OSGi bundle. You can then include the bundle directly in the EBA file, or add it to a bundle repository and include it by reference in the EBA file. If you add the bundle to a repository, it is available to other OSGi applications, and can reduce the application footprint.

If an enterprise application contains EJB modules, you must rewrite the application logic. For example, you must remove any annotations and references to EJBs from a servlet, because an OSGi bundle or a web application bundle (WAB) cannot directly look up and invoke an EJB. It is possible to change the application to interact with EJB modules by sending Java Message Service (JMS) messages so that the EJBs or message driven beans (MDBs) can retrieve those messages from those destinations and reply to them. Also, all necessary JAR files must be in the WEB-INF/lib directory of the WAR file, or be converted to OSGi bundles.

If an enterprise application contains EJB modules, another approach is to consider using a Service Component Architecture (SCA) environment and specify bindings in that environment.

After you complete manual conversion steps, you can continue with automatic conversion.

Conversion of Java 2 security settings

When you convert an application from Java EE to OSGi, any existing was.policy file is converted into a permissions.perm file to be used with the OSGi permissions framework, and all permissions are promoted to the application level. If you need finer granularity, you can modify the file after conversion. For more information, see Java 2 security and OSGi Applications.


Concept topic

Terms of use | Feedback


Timestamp icon Last updated: Tuesday, 20 September 2011
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-zos&topic=ca_mig_ejb

Copyright IBM Corporation 2009, 2011. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)