[jboss-user] [Beginners Corner] - How to communicate between a SessionBean and a servlet?

TIm Ward do-not-reply at jboss.com
Thu Aug 21 10:59:21 EDT 2008

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.)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171799#4171799

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171799

More information about the jboss-user mailing list