[jboss-user] [EJB/JBoss] - local entity bean lookup from session bean goes wrong

y0ur1 do-not-reply at jboss.com
Sat Mar 15 19:13:59 EDT 2008


I have an EJB21 session bean that uses an entity bean. 

This is located in the ejb-jar:
		<entity>
  | 			<ejb-name>Book</ejb-name>
  | 			<local-home>BookHome</local-home>
  | 			<local>Book</local>
  | 			<ejb-class>BookEntity</ejb-class>
  | 			<persistence-type>Container</persistence-type>
  | 			<prim-key-class>java.lang.String</prim-key-class>
  | 			<reentrant>false</reentrant>
  | 			<cmp-version>2.x</cmp-version>
  | 			<abstract-schema-name>Book</abstract-schema-name>
  | 			<cmp-field>
  | 				<field-name>title</field-name>
  | 			</cmp-field>
  | 			
  | 			<primkey-field>title</primkey-field>
  | 			
  | 
  |          <ejb-local-ref>
  |             <ejb-ref-name>ejb/Book</ejb-ref-name>
  |             <ejb-ref-type>Entity</ejb-ref-type>
  | 			<local-home>BookHome</local-home>
  | 			<local>Book</local>
  |             <ejb-link>Book</ejb-link>
  |          </ejb-local-ref>			
  | 		</entity>
  | 

JNDI:

  | java:comp namespace of the Book bean:
  | 
  |   +- env (class: org.jnp.interfaces.NamingContext)
  |   |   +- ejb (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- Book[link -> local/Book at 16126503] (class: javax.naming.LinkRef)
  | 

But my lookup says: javax.naming.NameNotFoundException: ejb not bound

This code is inside the session bean is as follow:

  | 		try {
  | 			InitialContext ic = new InitialContext();
  | 		
  | 			book = (BookHome) ic.lookup("java:comp/env/ejb/Book");
  | 			
  | 		} catch (NamingException e) {
  | 			// TODO Auto-generated catch block
  | 			e.printStackTrace();
  | 		}
  | 

Any suggestions? I can't get the local entity bean to work with the session bean.

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

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



More information about the jboss-user mailing list