dev@glassfish.java.net

NOTICE: MINOR declare EJBContext in the DD as resource-env-ref (instead of resource-ref)

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Thu, 16 Mar 2006 13:55:13 -0500

   There is a recent EJB Spec clarification that the EJBContext
(javax.ejb.EJBContext, javax.ejb.SessionContext,
javax.ejb.MessageDrivenContext, and javax.ejb.TimerService) should be
declared as resource-env-ref instead of resource-ref.

   The deployment code in our appserver/glassfish was implemented to use
resource-ref. So I have updated the implementation to use
resource-env-ref and just checked in the changes.
 
   If you use EJBContext through annotations, you don't need to do
anything. This change should be transparent to you. If you declare
EJBContext in deployment descriptor, you need to do the conversion like
the following:

Old:
==========
     <resource-ref>
         <res-ref-name>ejbContext</res-ref-name>
         <res-type>javax.ejb.EJBContext</res-type>
         <res-auth>Container</res-auth>
         <res-sharing-scope>Shareable</res-sharing-scope>
         <injection-target>
         
<injection-target-class>com.sun.s1asdev.ejb.ejb30.hello.session2full.SlessEJB3</injection-target-class>
         <injection-target-name>ejbContext</injection-target-name>
         </injection-target>
     </resource-ref>

New:
=========
    <resource-env-ref>
        <resource-env-ref-name>ejbContext</resource-env-ref-name>
       <resource-env-ref-type>>javax.ejb.EJBContext</resource-env-ref-type>
       <injection-target>
       
<injection-target-class>com.sun.s1asdev.ejb.ejb30.hello.session2full.SlessEJB3</injection-target-class>
       <injection-target-name>ejbContext</injection-target-name>
       </injection-target>
    </resource-env-ref>


    I've updated the deployment and ejb unit tests with this change (QL
doesn't need any changes). Please update your test area, sample code,
documentation accordingly. Let me know if you have any question or see
any problem with this change.
 
   Thanks,

- Hong