1 Reply Latest reply on Aug 21, 2008 12:02 PM by Tim Ward

    How to communicate between a SessionBean and a servlet?

    Tim Ward Newbie

      I need to move some information between an EJB SessionBean and a servlet.

      This is a push scenario - something has happened out in the world, this event finds its way to a SessionBean and I need to get it out to the browsers via an Ajax push mechanism.

      First attempt goes like this:

      (1) Make a POJO singleton object.

      (2) Have the servelets do wait( timeout ) on this singleton object.

      (3) Have the SessionBean call into the singleton object to pass it new data as and when it arises.

      (4) Have the singleton object wake up the waiting servlets and return the data to the browsers.

      The bit that doesn't work, with the POJO singleton in the .war file, is step (2), because I get NoClassDefFound, apparently because the EJB side of things and the web application use different class loaders.

      How can I communicate between a web application and a load of EJB stuff running in the same JBoss instance? - this can hardly be a rare thing to want to do!

      (I have found several pages on class loader mechanisms on the JBoss site but haven't found one that I can actually begin to understand.)