Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7879

JNDI Lookup for EJB3 Component with EJB2 Interface delivers wrong Proxy (EJB3 instead of EJB2)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • No Release
    • JBossAS-5.1.0.GA
    • None
    • None

    Description

      Two EJB components are packaged into two jars within an EAR. EJB3 is an EJB3.0 Stateless Session Bean. EJB2 is a EJB2.0 Stateless Session Bean. EJB2 needs access to EJB3 so EJB3 was equipped with EJB2.0 Home and Remote Interfaces.

      1. The EJB3 is coded like that:
      ...
      @Stateless(name="EJB3")
      @RemoteHome(EJB3Home.class)
      public class EJB3Bean implements EJB3
      {
      ...

      2. EJB3Home looks like this: (for compatibility with EJB2.0)
      public interface EJB3Home extends EJBHome
      {
      public EJB3Remote create() throws CreateException, RemoteException;
      }

      3. EJB3 is the EJB3 Business Remote Interface (according to EJB3.0 Spec) and looks like this:
      @Remote
      public interface EJB3
      {
      public void doThings() ;

      4. EJB3Remote is a Remote Interface according to the EJB2.0 Spec:

      public interface EJB3Remote extends EJBObject
      {
      public void doThings() throws RemoteException ;
      ...

      5. For the EJB2 there is a deployment descriptor defined. The section for the EJB2 Session Bean contains the following ejb-ref:
      ...
      <ejb-ref>
      <ejb-ref-name>EJB2Remote</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      EJB3Home
      EJB3Remote
      <ejb-link>EJB3</ejb-link> <!-- results are identical with or without this line-->
      </ejb-ref>
      ...

      6. The EJB2 does a Lookup like
      Object obj = jndi.lookup("EJB2Remote") ;

      What i would expect is an object implementing EJB3Home. After narrowing it i could call create() with it and get a EJB3Remote Object.

      But what i get instead is an object of type EJB3, the Business Interface.

      Looks like a bug. jaikiran from the community forums asked me to report this as bug.

      Attachments

        Activity

          People

            Unassigned Unassigned
            magicroomy_jira Volker Raum (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: