[jboss-user] [EJB3] - Re: How to use ejb3 in ejb2 using xdoclet
bharath sadanagiri
do-not-reply at jboss.com
Thu Nov 11 07:50:18 EST 2010
bharath sadanagiri [http://community.jboss.org/people/jayabharath] created the discussion
"Re: How to use ejb3 in ejb2 using xdoclet"
To view the discussion, visit: http://community.jboss.org/message/570734#570734
--------------------------------------------------------------
I got the solution for this problem
I have choosen the last option, that is using the Xdoclet generated configuaration files.
The following steps that I have followed
*1.* I did changes on top of the XMLs that got generated using Xdoclets
*2.* 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)
*3.* In ejb-jar.xml under <message-driven > element declared the ejb3.0 like below
+<ejb-local-ref >
<ejb-ref-name>ejb/AuditService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.receiver.audit.AuditServiceLocalHome</local-home>
<local>com.receiver.audit.AuditServiceLocal</local>
</ejb-local-ref>
+
*4.* In jboss.xml under <message-driven> element declared the ejb3.0 like below
+<ejb-local-ref >
<ejb-ref-name>ejb/AuditService</ejb-ref-name>
<local-jndi-name>AuditService/localHome</local-jndi-name>
</ejb-local-ref >
+
*5.* In MDB(In my case I need the AuditService in MDB) look up the ejb like following and use
auditServiceLocalHome = (AuditServiceLocalHome)ctx.lookup("java:comp/env/ejb/AuditService");
auditServiceLocal = (AuditServiceLocal)auditServiceLocalHome.create();
*6.* Changed the build file to include in EAR the above XML files instead of the files that got generated using Xdoclets
*7.* 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
*+java:comp namespace of the ReceiverMDB bean:+* +- env (class: org.jnp.interfaces.NamingContext)
| +- ejb (class: org.jnp.interfaces.NamingContext)
| | +- AuditService[link -> AuditService/localHome] (class: javax.naming.LinkRef)
*+Global JNDI Namespace
+* +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
+- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- AuditService (class: org.jnp.interfaces.NamingContext)
| +- localHome (proxy: $Proxy80 implements interface com.receiver.audit.AuditServiceLocalHome)
Thanks,
Bharath
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/570734#570734]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101111/4779832a/attachment-0001.html
More information about the jboss-user
mailing list