"khalidhajsaleh" wrote : hi,
  | 
  | I wrote a simple stateless session bean to test ejb3. The code compiles but 
when I try a context lookup on my bean I get a NameNotFoundException. 
  | ====
  | 
  | Here is the interface:
  | 
  | package ejb3.test.business;
  |   | 
  |   | import javax.ejb.*;
  |   | 
  |   | @Local
  |   | public interface IBean{
  |   | 
  |   |   public void doSomething ();
  |   | 
  |   | }
  | 
  | =======
  | 
  | the bean:
  | 
  | package ejb3.test.business;
  |   | 
  |   | import javax.persistence.EntityManager;
  |   | import javax.persistence.PersistenceContext;
  |   | import java.io.Serializable;
  |   | import javax.persistence.*;
  |   | import java.lang.annotation.*;
  |   | import javax.ejb.Stateless;
  |   | 
  |   | @Stateless
  |   | public class MyBean implements IBean
  |   | {
  |   | 
  |   |         final String  CLASS_NAME="MyBean";
  |   |         public void doSomething()
  |   |         {
  |   |                 System.out.println("inside " + CLASS_NAME);
  |   | 
  |   |         }
  |   | 
  |   | }
  | 
  | The client is a simple servlet:
  | 
  | import java.io.*;
  |   | import java.text.*;
  |   | import java.util.*;
  |   | import javax.servlet.*;
  |   | import javax.servlet.http.*;
  |   | import ejb3.test.business.MyBean;
  |   | import ejb3.test.business.IBean;
  |   | 
  |   | import javax.naming.InitialContext;
  |   | 
  |   | public class TestServlet extends HttpServlet {
  |   | IBean bean = null;
  |   | 
  |   | public void init(ServletConfig config) throws ServletException
  |   | {
  |   | try {
  |   | InitialContext ctx = new InitialContext();
  |   | 
  |   | //problem in this line!
  |   | bean = (IBean)ctx.lookup(IBean.class.getName());
  |   | 
  |   | } catch (Exception e)
  |   | {
  |   | e.printStackTrace();
  |   | }
  |   | //bean.doSomething();
  |   | 
  |   | }
  |   | }
  |   | 
  | 
  | The error I get:
  | [STDOUT] javax.naming.NameNotFoundException: ejb3.test.busine
  | ss.IBean not bound
  | 15:57:52,172 INFO  [STDOUT]     at 
org.jnp.server.NamingServer.getBinding(Naming
  | Server.java:491)
  | 
  | I would apperciate any help!
  | 
  | Khalid
  | 
  | 
  | 

I'm doing a similar example in jboss4.0.4.GA and have the same problem when I'm 
trying to lookup the bean: NameNotFoundException ... not bound.

How did you solve your problem ?

Thanks.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950543#3950543

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950543


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to