This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
i tried with @EJB,
w/ and w/o @EJB mapped name,
w/ and w/o ejb-jar.xml and jboss.xml (which i doubt i configured properly anyway but the example don't say anything about them,
and with new InitialContext().lookup(...) too
at best i got a:
javax.naming.NamingException: Could not dereference object [Root exception is ja
when i probably managed to integrate it but run into another problem.
some example code:
The backing bean - from which i try to display something in a JSF/JSP page and can't:
Hi there, to get a reference to the same ejb, use sessionContext.getBusinessObject(Greeter.class)(inject sessionContext with @Resource) instead of doing InitialContext ctx = new InitialContext(); greeter = (Greeter) ctx.lookup("GreeterBean/remote");
If it still doesn´t work, please put the full stack trace
Joined: Nov 29, 2009
Hello, sorry I've been out during weekend for I have no internet at home momentarily.
Injecting a @Resource would probably work on JBoss as it is one of the solutions I also read about (i will give it a try and update when i test it on JBoss - although i have doubts, since @Resource injection is in the same category as @EJB)
I will describe the solution I found, although JBoss complains about it.
(I will update here with the WARN message after I apply the solution)
The NameNotFoundException is most likely because you are using the wrong JNDI name. While deploying as a .ear the (default) JNDI name of the bean is different from what you use when you deploy as a .jar. See this for more info.
I guess when you removed the .ear extension, it probably is considering it to be a .jar (which is a bit odd actually). Anyway, rename it back to .ear (if it indeed is a .ear file) and then change the lookup code to use the correct JNDI name.