users@glassfish.java.net

ejb 3.0 problems

From: Dru Devore <ddevore_at_duckhouse.us>
Date: Wed, 26 Mar 2008 10:22:45 -0700
I have been having more problems since I started with EJB 3.0 that I ever remember having on any other technology.

Anyway here is my latest problem. I am trying to kick off a scheduled task from a servlet that has to access a database. So I have a entity bean that does the DB communications wrapped by a stateless ejb I then have a class for the business logic that I had converted into a WS for testing, and so it was a stateless session also. This worked great tell I tried to call the business directly from the schedule task. To do this I removed the WS and stateless annotations from the business logic and used a generated ejb look method from NB to lookup the EJB. The error I am getting is

javax.naming.NameNotFoundException: No object bound to name

This is the method I am using for the lookup:

private OrderProcessingDALocal lookupOrderProcessingDABean() {
        try {
            Context c = new InitialContext();
            return (OrderProcessingLocal) c.lookup("java:comp/env/OrderProcessingBean");
        } catch (NamingException ne) {
            java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
.
I have also tried to put in a mapped name in the session bean and used "OrderProcessingBean", I also used "java:comp/env/ejb/OrderProcessingBean" for the lookup.

What am I doing wrong and how do I fix it. Is there an easier way to get a reference to a stateless session bean from a servlet?


---
Dru Devore