Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call an ejb from ejb in Weblogic 7

 
Saurabh Jaiswal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have made two cmp's
1st is AccountManaged
2nd is EjbCustomer
Both having Local home and local component
I then have inserted in ejb-jar.xml

<entity>
<ejb-local-ref>
<description>Reference to application EJB</description>
<ejb-ref-name>ejb_D1</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>examples.ejb20.basic.containerManaged.CustHome</local-home>
<local>examples.ejb20.basic.containerManaged.Customer</local>
<ejb-link>ejb_D1.jar#EjbCustomer.CustHome</ejb-link>
</ejb-local-ref>
</entity>
then error at deploying my ejb_D1.jar is javax.naming.namenotfoundException
Unable to resolve ejb link
ejb_D1.jar#EjbCustomer.CustHome
And when i made changes to ejb-jar.xml as
<ejb-local-ref>
<description>Reference to application EJB</description>
<ejb-ref-name>AccountManaged</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>examples.ejb20.basic.containerManaged.AccountHome</local-home>
<local>examples.ejb20.basic.containerManaged.Account</local>
<ejb-link>AccountManaged.AccountHome</ejb-link>
</ejb-local-ref>
</entity>

Then error at deployment of ejb_D1.jar is could not resolve ejb-link

Also at
In weblogic-ejb-jar.xml i have inserted

<weblogic-ejb-jar>

<weblogic-enterprise-bean>
<ejb-name>EjbCustomer</ejb-name>
<entity-descriptor>
<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-descriptor>
<local-jndi-name>EjbCustomer.CustHome</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Please help me regarding this......Tell me how in local or remote can we call an EJB from EJB
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Its possible to call one ejb from another by defining one ejb as a remote and other as local.
weblogic-ejb-jar.xml
====================
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>PlayerEJB</ejb-name>
<jndi-name>JNDIPlayer</jndi-name>
</weblogic-enterprise-bean>
<weblogic-enterprise-bean>
<ejb-name>EREJB</ejb-name>
<local-jndi-name>JNDIERLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Define the ejb-jar.xml the same way.
This will work. I had created an example using Stateless Session bean. It works fine using Weblogic 7.0 and 8.1.
Place the lookup call of EREJB in the business method of PlayerEJB
Seetesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic