[jboss-user] [EJB 3.0] - Re: Still having problems with java:comp/env lookups

waynebaylor do-not-reply at jboss.com
Wed Dec 26 15:30:57 EST 2007


ejb-jar.xml declares the ejbs and the jboss.xml maps them to their global jndi name.

ejb-jar.xml:
<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">    
  | 
  |      <enterprise-beans>
  | 
  |     	<session>
  |             <ejb-name>MyBean</ejb-name>
  |             <local>com.example.MyLocal</local>
  |             <ejb-class>com.example.MyBean</ejb-class>
  |     	</session>
  | 
  |     </enterprise-beans>
  | 
  | </ejb-jar>

jboss.xml:
<!DOCTYPE jboss PUBLIC
  |           "-//JBoss//DTD JBOSS 3.2//EN"
  |           "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
  | <jboss>
  |   <enterprise-beans>
  |     <session>
  |         <ejb-name>MyBean</ejb-name>
  |         <local-jndi-name>com.example.MyBean/local</local-jndi-name>
  |     </session>
  |   </enterprise-beans>
  | </jboss>

with these you can use the following to look up the ejb:

MyLocal bean = (MyLocal)new InitialContext().lookup("com.example.MyBean/local");
  | 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115552#4115552

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115552



More information about the jboss-user mailing list