Enterprise JavaBeans and OSGi Applications

An OSGi application can contain Enterprise JavaBeans (EJBs). OSGi applications can access and invoke an enterprise bean directly.

Support is provided for EJB 3.x style enterprise beans, and all EJB functionality works the same in an OSGi application as in a J2EE enterprise application. EJB 2.1 enterprise beans are not supported.

The enterprise beans in your OSGi bundles can be developed from scratch, or you can include existing EJB assets and migrate them to use OSGi modularity with minimal code changes. Stateful, stateless, and singleton enterprise beans are supported. Your OSGi application can also contain message-driven beans (MDBs). You deploy and configure an OSGi application that contains enterprise beans in a similar way to deploying and configuring a J2EE enterprise application, by using wsadmin or the administrative console.

You convert an enterprise application to an OSGi application by completing manual tasks that convert the enterprise archive (EAR) file to an enterprise bundle archive (EBA) file.

The presence of an Export-EJB header in the OSGi bundle manifest file identifies a bundle as an EJB bundle, and causes any enterprise beans in the bundle to be loaded and run by the EJB container. The value of this header declares the enterprise beans that you want to export as OSGi services; for more information, see the description of the Export-EJB header.

You can use the WebSphere® Application Server administrative console, or wsadmin scripting commands, to complete the following JNDI binding operations for the enterprise beans in your OSGi applications:
  • Provide EJB JNDI names.
  • Map EJB references.
  • Map EJB resource references to resources.
  • Bind EJB message destination references to administered objects..
  • Bind listeners for message-driven beans.