Discussions

EJB programming & troubleshooting: Accessing EJB 3.0 from Servlet 2.4

  1. Accessing EJB 3.0 from Servlet 2.4 (1 messages)

    I have problems to access EJB 3.0 session beans from Servlet, because I don't know how to define the ejb reference in web.xml before EJB 3.0 ist was something like this: ejb/PersonalServiceBeanLocal Session com.teamead.ServiceLocalHome com.teamead.PersonalServiceLocalPersonalServiceBean but this doesn't work anymore, because I don't habe a local home in EJB 3.0. Without the local-home tag, the web.xml is not valid to the Servlet 2.4 spec. Is there a convention to simulate the home interface or how do I do that now. Sorry, the question might be silly for some of you, but I didn't find information about that by now. Thanks in advance, Wolfgang
  2. I have problems to access EJB 3.0 session beans from Servlet, because I don't know how to define the ejb reference in web.xml before EJB 3.0 ist was something like this:

    ejb/PersonalServiceBeanLocal
    Session
    com.teamead.ServiceLocalHome
    com.teamead.PersonalServiceLocalPersonalServiceBean


    but this doesn't work anymore, because I don't habe a local home in EJB 3.0. Without the local-home tag, the web.xml is not valid to the Servlet 2.4 spec. Is there a convention to simulate the home interface or how do I do that now. Sorry, the question might be silly for some of you, but I didn't find information about that by now.

    Thanks in advance,

    Wolfgang
    Hello, if I'm not mistaken, you can directly inject a reference of a session bean into your servlet ( preferably stateless). If you want to use stateful session beans, inject the ejb container and look-up the jndi reference to the bean, and store as an attribute in the http session. read the specifications of the application server. I think in JBoss you can only look-up the jndi reference.