3.2.9. EJB 2.x Changes

3.2.9.1. Update Applications That Use EJB 2.x

JBoss Enterprise Application Platform 6 provides support for EJB 2.x, however, you need to make a few code modifications and start the server with the full profile.

Procedure 3.26. Run EJB 2.x on JBoss Enterprise Application Platform 6

  1. Modify the Code to Use the New JNDI Namespace Rules

    As with EJB 3.0, you must use the full JNDI prefix with EJB 2.x. For more information on the new JNDI namespace rules and code examples, see Section 3.1.8.1, “Update Application JNDI Namespace Names”.
  2. Replace JBoss AOP Interceptors

    JBoss AOP (Aspect Oriented Programming) is no longer included in JBoss Enterprise Application Platform 6. In previous releases, JBoss AOP was used by the EJB container. However, in JBoss Enterprise Application Platform 6, the EJB container uses a new mechanism. If your application uses JBoss AOP, you need modify your application code as follows.

    • Standard EJB3 configurations that were made in the ejb3-interceptors-aop.xml file are now done in the server configuration file. For a standalone server, this is the standalone/configuration/standalone-full.xml file. If you are running your server in a managed domain, this is the domain/configuration/domain.xml file.
    • Applications that integrate AOP interceptors into the EJB layer must be redesigned to use EJB3 interceptors and CDI. Server side interceptors can be changed to EJB3 interceptors.
  3. Modify the jboss-web.xml File Descriptor

    Modify the <jndi-name> for each <ejb-ref> to use the new JNDI fully qualified lookup format.
  4. Replace the jboss.xml deployment descriptor file

    The jboss-ejb3.xml deployment descriptor replaces the jboss.xml deployment descriptor to override and add to the features provided by the Java Enterprise Edition (EE) defined ejb-jar.xml deployment descriptor. The new file is incompatible with jboss.xml, and the jboss.xml is now ignored in deployments.
  5. Start the Server with the Full Profiles

    EJB 2.x requires the Java Enterprise Edition 6 Full Profile. To start JBoss Enterprise Application Platform 6 with the full profile, pass the argument -c standalone-full.xml on the command line when you start the server.