<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: How to use ejb3 in ejb2 using xdoclet
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/jayabharath">bharath sadanagiri</a> in <i>EJB3</i> - <a href="http://community.jboss.org/message/570734#570734">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I got the solution for this problem<br/>I have choosen the last option, that is using the Xdoclet generated configuaration files.<br/>The following steps that I have followed <br/><strong>1.</strong> I did changes on top of the XMLs that got generated using Xdoclets<br/><strong>2.</strong> Create a LocalHome in ejb3.0 eventhough it is not required(For ejb3 LocalHome is junk file but it is useful when called from ejb2)<br/><strong>3.</strong> In ejb-jar.xml under <message-driven > element declared the ejb3.0 like below</p><p><em><ejb-local-ref ><br/>      <ejb-ref-name>ejb/AuditService</ejb-ref-name><br/>      <ejb-ref-type>Session</ejb-ref-type><br/>      <local-home>com.receiver.audit.AuditServiceLocalHome</local-home><br/>      <local>com.receiver.audit.AuditServiceLocal</local><br/> </ejb-local-ref><br/></em> <br/><strong> 4.</strong> In jboss.xml under <message-driven> element declared the ejb3.0 like below<br/> <br/><em> <ejb-local-ref ><br/>  <ejb-ref-name>ejb/AuditService</ejb-ref-name><br/>  <local-jndi-name>AuditService/localHome</local-jndi-name><br/> </ejb-local-ref ><br/></em> <br/><strong> 5.</strong> In MDB(In my case I need the AuditService in MDB) look up the ejb like following and use <br/>      auditServiceLocalHome = (AuditServiceLocalHome)ctx.lookup("java:comp/env/ejb/AuditService");<br/>      auditServiceLocal = (AuditServiceLocal)auditServiceLocalHome.create();<br/><strong> 6.</strong> Changed the build file to include in EAR the above XML files instead of the files that got generated using Xdoclets<br/><strong> 7.</strong> For the verification purpose go to jmx-console (jboss:service=JNDIView) and check AuditService is visible in java:comp as well as in Global JNDI Namespace<br/> <br/><strong><em style="color: #ff0000; "> java:comp namespace of the ReceiverMDB bean:<br/></em></strong>   +- env (class: org.jnp.interfaces.NamingContext)<br/>   |   +- ejb (class: org.jnp.interfaces.NamingContext)<br/>   |   |   +- AuditService[link -> AuditService/localHome] (class: javax.naming.LinkRef)<br/>   <br/>   <br/> <span style="color: #333333;"><strong><em style="color: #ff0000; ">Global JNDI Namespace<br/></em></strong></span>  +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)<br/>  +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)<br/>  +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)<br/>  +- AuditService (class: org.jnp.interfaces.NamingContext)<br/>  |   +- localHome (proxy: $Proxy80 implements interface com.receiver.audit.AuditServiceLocalHome)<br/> </p><p> Thanks,</p><p> Bharath</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/570734#570734">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in EJB3 at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>