users@glassfish.java.net

Stateful EJB3 and InitialContext query

From: <glassfish_at_javadesktop.org>
Date: Tue, 03 Jun 2008 14:21:51 PDT

I'm writing an application that uses EJBs and Adobe Flex with BlazeDS in the middle. BlazeDS has a servlet (called MessageBrokerServlet) that handles it's requests and as I'm trying to write a photo upload application, there is also an upload servlet.

The BlazeDS servlet part of the application uses InitialContext to lookup the EJBs where the upload servlet has it's instances injected via @EJB.

My question is, why is it each time Flex calls for an EJB via InitialContext is it a new instance? Shouldn't the InitialContext bind to the session and return the same stateful EJB whenever requsted?

Ideally, I'd want to be able to access the same stateful EJB that is used in the upload servlet with the other in BlazeDS.

Thanks in advance.
Dan
[Message sent by forum member 'dansiviter' (dansiviter)]

http://forums.java.net/jive/thread.jspa?messageID=278121