This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in calling a EJB from a WAR file

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your web.xml addd the ejb-link tag as follows:

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks it deployed cheers for that.

Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic