Unable to deploy a jar with both ejb 2.1 and ejb 3.0 beans in JBoss EAP

Solution Verified - Updated -

Environment

  • JBoss EAP 4.3_CP06
  • JDK 1.6_0_17

Issue

  • Currently we have an EJB 2.1 project which is deployed as a JAR. It contains stateless, statefull, entity and MDB beans. All of these are generated using xdoclet.
    All is working great until the moment we add an EJB3 annotation.
  • I have created a new EJB singleton 'ConfigService' bean using the @Service annotation (org.jboss.annotation.ejb.Service). It implements the interface 'ConfigServiceManagement'. The interface is annotated with the @Management annotation (org.jboss.annotation.ejb.Management).
  • When I deploy the JAR containing these new classes all kind of errors are thrown not related to these new classes.
    Uploaded are the logs files containing a log for successfull deployment and one for the failure.
  • The error happens on a method which contains the javadoc line '@ejb:transaction type="NotSupported"'. Removing this line will result in a successfull deployment for this bean. However other beans have the same problem as well.
  • I was under the impression that JBoss supports a JAR to be deployed with both EJB2.1 and EJB3 beans?

Resolution

  • Bundle the EJB2 beans and EJB3 beans into separate jars.

Root Cause

  • EJB3 and EJB2 are not supported within the same jar file.
    • If an EJB3 annotation is found, the EJB3 deployer will deploy the jar.
  • EJBs can defined using the ejb-jar.xml, but they are actually just an EJB2 view of the EJB and internally they are EJB3.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.