This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes how to call an ejb from ejb in Weblogic 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how to call an ejb from ejb in Weblogic 7" Watch "how to call an ejb from ejb in Weblogic 7" New topic
Author

how to call an ejb from ejb in Weblogic 7

Saurabh Jaiswal
Greenhorn

Joined: Feb 06, 2004
Posts: 1
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


The angels set the message and fly......
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
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
 
Consider Paul's rocket mass heater.
 
subject: how to call an ejb from ejb in Weblogic 7
 
Similar Threads
Ant 1.5.2 and ejbjar task
weblogic-ejb-jar.xml
accessing EJB deployed in Weblogic 6.1
"0 deployed, 9 failed to deploy."
calling local bean