-
1. Re: Lookup ejb by its COMP_NAME
kanth_seenu Jul 13, 2007 9:46 AM (in response to kanth_seenu)ejb-jar.xml
<![CDATA[LicenseVerifier]]>
<ejb-name>LicenseVerifier</ejb-name>
com.dhyan.nms.server.common.license.interfaces.LicenseVerifierHome
com.dhyan.nms.server.common.license.interfaces.LicenseVerifier
<local-home>com.dhyan.nms.server.common.license.interfaces.LicenseVerifierLocalHome</local-home>
com.dhyan.nms.server.common.license.interfaces.LicenseVerifierLocal
<ejb-class>com.dhyan.nms.server.common.license.ejb.LicenseVerifierBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref >
<ejb-ref-name>ejb/LicenseVerifier</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.dhyan.nms.server.common.license.interfaces.LicenseVerifierLocalHome</local-home>
com.dhyan.nms.server.common.license.interfaces.LicenseVerifierLocal
<ejb-link>LicenseVerifier</ejb-link>
</ejb-local-ref>
jboss.xml
<ejb-name>LicenseVerifier</ejb-name>
<jndi-name>LicenseVerifier</jndi-name>
<local-jndi-name>LicenseVerifierLocalHome</local-jndi-name>
<ejb-local-ref>
<ejb-ref-name>ejb/LicenseVerifier</ejb-ref-name>
<local-jndi-name>LicenseVerifier</local-jndi-name>
</ejb-local-ref>
<method-attributes>
</method-attributes> -
2. Re: Lookup ejb by its COMP_NAME
kanth_seenu Jul 13, 2007 9:53 AM (in response to kanth_seenu)same exception even when I tried
InitialContext iniCtx = new InitialContext(); Context ejbCtx = (Context) iniCtx.lookup("java:comp/env/ejb");
-
3. Re: Lookup ejb by its COMP_NAME
lafr Jul 16, 2007 4:34 PM (in response to kanth_seenu)I think you misunderstood something.
You'll have to add the ejb-local-ref to the bean where you want to lookup LicenseVerfifierFrom from by COMP_NAME.
Just one example from my code base.
In SalesOrderImportMDB I have this for XDoclet to generate the deployment descriptor entries:* @ejb.ejb-external-ref view-type="local" type="Session" * ref-name="ejb/MailServiceLocal" * home="ejb.session.core.MailServiceLocalHome" * business="ejb.session.core.MailServiceLocal" * jndi-name="test/MailServiceLocal"
ejb-jar.xml:<message-driven> <display-name>SalesOrderImportMDB</display-name> ... <ejb-local-ref > <ejb-ref-name>ejb/MailServiceLocal</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home>ejb.session.core.MailServiceLocalHome</local-home> <local>ejb.session.core.MailServiceLocal</local> </ejb-local-ref> ... </message-driven >
jboss.xml:<message-driven> <ejb-name>SalesOrderImportMDB</ejb-name> ... <ejb-local-ref> <ejb-ref-name>ejb/MailServiceLocal</ejb-ref-name> <local-jndi-name>test/MailServiceLocal</local-jndi-name> </ejb-local-ref> ... </message-driven>
jmx-console, JNDI-view:java:comp namespace of the SalesOrderImportMDB bean: +- env (class: org.jnp.interfaces.NamingContext) | +- ejb (class: org.jnp.interfaces.NamingContext) | | +- MailServiceLocal[link -> test/MailServiceLocal] (class: javax.naming.LinkRef)