Skip to main content

tag with EJB's

1 reply [Last post]
cmathrusse
Offline
Joined: 2008-04-15

Our project is contained within and EAR file that contains both an EJB project and a web project, which utilizes JSF. We are attempting to deploy our application into a cluster and I have followed the documentation pertaining to the specific settings needed for distributing the application.

In web.xml:

In sun-web.xml:

My question pertains to EJB references that we have defined as properties of our managed-beans. If I have a managed-bean, call it SalesRepsBacker, that implements java.io.Serializable, and within this bean I have references to several stateless EJB's, (which would also need to be serializable), will the stateless EJB's still be accessible and functional after serialization from one server in the cluster to the other, or should I define these properties as transient and perform a look-up each time I need them?

Thanks for the help...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ksak
Offline
Joined: 2005-05-20

Yes. The Java EE spec requires that a Java EE web container be capable of
handling a number of "special" Java EE objects in an HttpSession, including
EJB references. The EJB reference object itself is opaque from the perspective of
the application, so you don't have to worry about whether it explicitly implements
Serializable. Here's the relevant snippet from the spec :

EE.6.4
Web containers must support Java EE distributable web applications placing
objects of any of the following types into a javax.servlet.http.HttpSession
object using the setAttribute or putValue methods:
• java.io.Serializable
• javax.ejb.EJBObject
• javax.ejb.EJBHome
• javax.ejb.EJBLocalObject
• javax.ejb.EJBLocalHome
• javax.transaction.UserTransaction
• a javax.naming.Context object for the java:comp/env context
• a reference to an EJB local or remote business interface