File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Need help in calling a EJB from a WAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Need help in calling a EJB from a WAR file" Watch "Need help in calling a EJB from a WAR file" New topic
Author

Need help in calling a EJB from a WAR file

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
I have a ejb called :TradeBean.java
Remote interface is called :Trade.java
Home is called TradeHome.java

im my ejb-jar.xml I have :

<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>TradeObject</ejb-name>
<home>brokearage.broker.co.sessionBean.stateless.trades.TradesHome</home>
<remote>brokearage.broker.co.sessionBean.stateless.trades.Trades</remote>
<ejb-class>brokearage.broker.co.sessionBean.stateless.trades.TradesBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>


In my weblogic-ejb-jar.xml I have

<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TradeObject</ejb-name>
<jndi-name>TradeObject</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>

The EJB is deployed in a jar called BrokerEJB.

in the War file web.xml I have the following

<ejb-ref>
<ejb-ref-name>ejb/TradeObject</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>mbrokearage.broker.co.sessionBean.stateless.trades.TradesHome</home>
<remote>brokearage.broker.co.sessionBean.stateless.trades.Trades</remote>
</ejb-ref>

and in my weblogic.xml I have the following:


<ejb-ref-description>
<ejb-ref-name>TradeObject</ejb-ref-name>
<jndi-name>BrokerEJB/TradeObject</jndi-name>
</ejb-ref-description>

When I try to deploy the war file I get the following error:
ejb-ref ejb/TradeObject requires an ejb-link or jndi-name.

The problem is that I have got very confused about what goes in the deployment xml files.

does the ejb-ref-name in web.xml and weblogic.xml match the ejb-name in ejb-jar.xml and weblogic-ejb-jar.xml
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9937
    
159

In your web.xml addd the ejb-link tag as follows:



[My Blog] [JavaRanch Journal]
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
Thanks it deployed cheers for that.

Tony
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Need help in calling a EJB from a WAR file
 
Similar Threads
calling an ejb from jsp
Problem: creating EJBs in Client in Weblogic7.0
Need Help in understanding the ctx.lookup for looking up a ejb
Error----web app could not find ejb module.
Accessing EJB from servlet in WAR file