Reading Debu Pandas article on DI from 2006 on
http://www.onjava.com/pub/a/onjava/2006/01/04/dependency-injection-java-ee-5.html?page=1.
Still, having problem using the @EJB.
The example in Pandas article ( page 4 ) is like this:
-code:
@EJB(name="ProcessManager")
private ProcessManager pm;
pm.submitOrder(order);
He never tells where the ProcessManager is coming from, it must be from a ejb-jar.xml ( or another DD )
- but how is the syntax ?
Another example:
From O'Reillys workbook (Enterprise Javabeans 3.0, 5th edition ) there is an example of a Stateless 'TravelagentBean' that is using 'ProcessPaymentBean' which implements both a Local and a Remote interface ( ch. 11_5 ).
The 'TravelAgentBean' is using 'ProcessPaymentBean', and the code within the 'TravelAgentBean' is like this:
code:
@EJB
private ProcessPaymentLocal processPayment;
and the ejb-jar.xml is like this:
-code:
ejb/PaymentProcessor
Session com.titan.processpayment.ProcessPaymentLocal
com.titan.travelagent.TravelAgentBean
processPayment
But the syntax is not correct.
I am getting the following error:
[ServiceController] Problem starting service jboss.j2ee:jar=titan.jar,name=TravelAgentBean,service=EJB3 java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container TravelAgentBean: reference class: is.processpayment.ProcessPaymentLocal ejbLink: not used by any EJBs at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
And finally:
Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container TravelAgentBean
is there an obvious answer here or am I totally missing the point ?
regards, i