| Author |
calling local bean
|
Badri Sarma
Ranch Hand
Joined: Apr 01, 2003
Posts: 72
|
|
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>
|
Thanks<br />Badri
|
 |
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
|
|
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:
|
 |
 |
|
|
subject: calling local bean
|
|
|