open jndi connection to unknown bean

Discussion in 'Java' started by tmaus, Sep 13, 2004.

  1. tmaus

    tmaus Guest

    hi there..
    im actually running into a problem i do not find any solution for ...

    the problem:

    i have a class doing nothing more than to delegate request from the
    controller layer to the business components. this means that the class
    itself is called by every request from the controller layer.
    the controller layer provides a service identifier ..
    the service identifier is taken by the delegator class ...
    their corresponding bean is calculated
    and the delegator tries to setup the connection to the bean ..

    each bean .. well .. better manager ejb .. implements the
    managerInterface ..
    which exposes a single method called executeService.
    this is the only important method for each manager bean.

    my problem is that im not able to setup a connection to the manager
    class ..
    the jndi name is found ... thats shure ..
    but i always receive a cast exception ...

    i provide you some snipplets from my code ..
    perhaps you can help ..

    public interface ManagerInterface {

    public ServiceCollector executeService(ServiceCollector sc)
    throws NoServiceProvidedException, ServiceNotAvailableException;
    }

    public interface ManagerInterfaceLocalHome extends
    javax.ejb.EJBLocalHome{

    public ManagerInterfaceLocal create() throws
    javax.ejb.CreateException;
    }

    public interface ManagerInterfaceLocal extends ManagerInterface,
    EJBLocalObject {}

    ------------ manager bean implementing the executeService method ----
    public class GameManagerBean implements SessionBean,ManagerInterface{

    /**
    * @ejb.interface-method view-type = "local"
    */
    public ServiceCollector executeService(ServiceCollector sc)
    throws NoServiceProvidedException, ServiceNotAvailableException {


    ------ delegator ejb trying to setup a connection to a manager bean
    ----
    InitialContext iContext = new InitialContext();

    ManagerInterfaceLocalHome localHome = (ManagerInterfaceLocalHome)
    iContext.lookup(_jndiName);

    ManagerInterfaceLocal local = localHome.create();

    local.executeService(sc);

    the error is a class cast exception on the line where we do the lookup
    for the jndi name
    !!! jndi name is correct !!!

    thanks ..
    tmaus, Sep 13, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benjamin Stewart

    To bean or not to bean...

    Benjamin Stewart, Jun 30, 2003, in forum: Java
    Replies:
    0
    Views:
    791
    Benjamin Stewart
    Jun 30, 2003
  2. Mike S
    Replies:
    0
    Views:
    22,987
    Mike S
    Sep 16, 2004
  3. Mick
    Replies:
    2
    Views:
    9,503
    Marcin Grunwald
    Feb 23, 2005
  4. shoa

    JNDI and Bean need help

    shoa, Jun 2, 2005, in forum: Java
    Replies:
    2
    Views:
    2,130
  5. Tom Anderson
    Replies:
    0
    Views:
    425
    Tom Anderson
    Apr 22, 2011
Loading...

Share This Page