[jboss-user] [EJB 3.0] - Simplest possible stateless bean
Renen
do-not-reply at jboss.com
Wed Sep 19 07:37:17 EDT 2007
Having worked happily with EJB2 code for a couple of years, I attempted to get an EJB3 stateless session bean to work.
I failed.
My EJB code:
| @Stateless
| public class T2Bean {
|
| public void doIt(int i) {
| System.out.println("in do it!: " + i);
| }
|
| }
|
In a JSP page, I attempt to access the bean as follows:
| InitialContext ctx = new InitialContext();
| T2Bean t = (T2Bean)ctx.lookup(T2Bean.class.getName());
| t.doIt(4);
|
The ejb is packaged in a JAR and deployed. The JSP is contained in a WAR. And both are deployed within a single EAR.
I get an error: javax.naming.NameNotFoundException: za.co.oneTwoOne.T2Bean not bound
What am I doing wrong?
My understanding is that EJB3 should simplify things, eliminate the need to declare interfaces, and herald the new world order of love and happiness. Clearly things are not so simple! ;-) Or (hopefully), I'm missing something obvious.
If somebody can point me in the right direction, I will happily add the solution to the wiki for the benefit of future generations!
Renen.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086004#4086004
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086004
More information about the jboss-user
mailing list