Technical bean implementation won't lookup any ejb-external-ref, unless there 
is some ejb-ref
---------------------------------------------------------------------------------------------

         Key: XDT-1626
         URL: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1626
     Project: XDoclet
        Type: Bug

  Components: EJB Module  
    Versions: 1.2.3    
    Reporter: R. Lemos
 Assigned to: xdoclet-devel (Use for new issues) 


The <session> subtask for the following session bean won't work as expected:

public class SomeSessionBean implements javax.ejb.SessionBean {
    /**
     * @ejb.ejb-external-ref
     *  ref-name = "ejb/ExternalRefName"
     *  home = "externalRefPackage.ExternalRefHome"
     *  business = "externalRefPackage.ExternalRef"
     *  type = "Session"
     *  jndi-name = "ExternalRefNameJNDIName"
     *  view-type = "remote"
     */
    protected SomeExternalRefHome externalRef;
}

It is expected that the following lines are generated (inside 
setSessionContext(...)  method):

      javax.naming.Context namingCtx = null;
      try 
      {
         namingCtx = new javax.naming.InitialContext();
         {
             Object obj = namingCtx.lookup("java:comp/env/ejb/ExternalRefName");
             externalRef = 
(externalRefPackage.ExternalRefHome)javax.rmi.PortableRemoteObject.narrow(obj, 
externalRefPackage.ExternalRefHome.class);       
         }
      } 
      catch(javax.naming.NamingException e) 
      {
             throw new javax.ejb.EJBException("lookup failed", e);
      }
      finally {
         if (namingCtx != null) 
         {
            try 
            {
               namingCtx.close(); 
            }
            catch(javax.naming.NamingException e) 
            {
               e.printStackTrace();
            }                   
         }
      }

But in fact, setSessionContext(...) is empty.

Is you add a second field, with @ejb.ejb-ref (instead of @ejb.ejb-external-ref) 
then everything works ok (including the external ref).

The problem is a <XDtEjbEnv:ifHasTag ...> near the begining of 
xdoclet/modules/ejb/src/xdoclet/modules/ejb/env/resources/env-lookups.xdt, 
which searches for some annotations.
But "ejb.ejb-external-ref" is incorrectly written as "ejb.external-ref", which 
ends the "if" block prematurely (before forAllEjbMemberTags, which works fine).

Proposed patch (straight forward)
---------------------- cut here ----------------------
--- 
xdoclet-1.2.3-original/modules/ejb/src/xdoclet/modules/ejb/env/resources/env-lookups.xdt
    2005-04-10 13:50:08.000000000 -0300
+++ 
xdoclet-1.2.3/modules/ejb/src/xdoclet/modules/ejb/env/resources/env-lookups.xdt 
    2006-04-05 08:27:16.000000000 -0300
@@ -1,5 +1,5 @@

-    <XDtEjbEnv:ifHasTag 
tagName="ejb.env-entry,ejb.resource-ref,ejb.resource-env-ref,ejb.destination-ref,ejb.ejb-service-ref,ejb.ejb-ref,ejb.external-ref">
+    <XDtEjbEnv:ifHasTag 
tagName="ejb.env-entry,ejb.resource-ref,ejb.resource-env-ref,ejb.destination-ref,ejb.ejb-service-ref,ejb.ejb-ref,ejb.ejb-external-ref">
       javax.naming.Context namingCtx = null;
       try
       {
---------------------- cut here ----------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to