Discussions

EJB programming & troubleshooting: Calling Stateful beans from stateless beans.

  1. Calling Stateful beans from stateless beans. (3 messages)

    The scenario is: Simple java clients needs to access an EJB application and the ejb beans will provide the data from LDAP. While beans connecting to the LDAP, we need a client credentials(name, password..etc). How do we pass this client information to Beans? We want provide webservice endpoint in future, so we can't use a Stateful sesssion bean to keep client credentials and LDAP connection specific to client in bean.
    I am thinking design like: Clients will pass his credentials to make a LDAP connection to stateless session beans in each method and, and the stateless session bean should able to find client stefulsesion bean(Some how, not sure how) and return the connection to stateless bean, and from there stateless bean access LDAP and return results.
    What is the point is, Is sateful beans can accessable from stateless beans?
  2. Just like you do a lookup for the stateless bean from your client, your stateless bean can do a lookup to a stateful bean.
  3. If you are using a EJB2.0 compatible appserver you could use local references instead of looking up within your container

    More
    http://www.devx.com/getHelpOn/10MinuteSolution/16677/1954?pf=true

    -vaheesan selvarajah
  4. How do we pass this client information to Beans? We want provide webservice endpoint in future, so we can't use a Stateful sesssion bean to keep client credentials and LDAP connection specific to client in bean. I am thinking design like: Clients will pass his credentials to make a LDAP connection to stateless session beans in each method and, and the stateless session bean should able to find client stefulsesion bean(Some how, not sure how) and return the connection to stateless bean, and from there stateless bean access LDAP and return results.What is the point is, Is sateful beans can accessable from stateless beans?
    If you want to pass secuity information between beans and enable them to be accessed as web services later then passing the security credentials is probably your best bet.

    Ian Purton
    Tune up your web site stats with IndexTools.com