• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

calling local bean

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i am calling a local bean from a stateless bean, But it is displaying NameNotFoundExecption
I am pasting the following files
ejb-jar.xml
weblogic-ejb-jar.xml and
Statelessbean.java
Statelessbean.java
---------------
//calling the local bean in the stateless bean
InitialContext ic = new InitialContext();
clhObj = (CustomerLocalHome) ic.lookup("ejb.CallCustomerLocalBean");
ejb-jar.xml
-----------------
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>CallLocalBean</ejb-name>
<home>examples.statelessSession.CallLocalHome</home>
<remote>examples.statelessSession.CallLocal</remote>
<ejb-class>examples.statelessSession.CallLocalBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>call_customer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>examples.containerManaged.local.CustomerLocalHome</local-home>
<local>examples.containerManaged.local.CustomerLocal</local>
<ejb-link>CustomerLocalBean</ejb-link>
</ejb-local-ref>
</session>
<entity>
<ejb-name>CustomerLocalBean</ejb-name>
<local-home>examples.containerManaged.local.CustomerLocalHome</local-home>
<local>examples.containerManaged.local.CustomerLocal</local>
<ejb-class>examples.containerManaged.local.CustomerLocalBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>CustomerLocalBean</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>customerName</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<query>
<query-method>
<method-name>findCustomer</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM CustomerLocalBean AS o]]></ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>CustomerLocalBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CallLocalBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
weblogic-ejb-jar.xml
----------------------
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>CustomerLocalBean</ejb-name>
<entity-descriptor>
<pool>
</pool>
<entity-cache>
<cache-between-transactions>False</cache-between-transactions>
</entity-cache>
<persistence>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-use>
</persistence>
<entity-clustering>
<home-is-clusterable>False</home-is-clusterable>
</entity-clustering>
</entity-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<local-jndi-name>ejb.CustomerLocalBean</local-jndi-name>
</weblogic-enterprise-bean>
<weblogic-enterprise-bean>
<ejb-name>CallLocalBean</ejb-name>
<stateless-session-descriptor>
<pool>
</pool>
<stateless-clustering>
</stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<reference-descriptor>
<ejb-local-reference-description>
<ejb-ref-name>call_customer</ejb-ref-name>
<jndi-name>ejb.CallCustomerLocalBean</jndi-name>
</ejb-local-reference-description>
</reference-descriptor>
<jndi-name>ejb.CallLocalBean</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Observations...
Your code is trying to look up a Local Interface of the CustomerLocalBean with this code:

However, your deployment descriptor clearly states that the JNDI name for the CustomerLocalBean is ejb.CustomerLocalBean not ejb.CallCustomerLocalBean with this line:
 
Slime does not pay. Always keep your tiny ad dry.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic