Inside the servlet, declare a public static synchronized (uf) field. Then
declare a public static method, to retrieve the field

public static MessageBundle ms;
public static synchronized getMS() {
        return ms;
}

then inside your SLSB:

private MessageBundle ms; //it could even be static??
public void ejbCreate() {
        if (ms==null) ms = MyServley.getMS();

}


HTH

JP

> -----Original Message-----
> From: Neal Kaiser [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 11, 2001 9:25 PM
> To: Orion-Interest
> Subject: Stateless Session Bean Initialization Pattern 
> 
> 
> Hi. I have a framework as follows:
> 
> A startup servlet reads in an XML file and creates a message 
> bundle. This
> message bundle will be used by Servlets and EJBs to pull 
> resources from it.
> 
> I somehow need a way to initialize the stateless session bean 
> by passing the
> message bundle to it. When the startup servlet starts, I get 
> a reference to
> the session bean and call init(MessageBundle).
> 
> However, this does not work because other instances of the 
> session bean will
> not be initialized. I need some sort of static variable, or 
> environment, or
> some way I can get the original MessageBundle passed in from 
> the startup
> servlet.
> 
> Any suggestions on how I should handle this?   I suppose one 
> solution would
> be to use JNDI and store the object in there.  Are there any 
> Orion examples
> of how to do this?
> 
> 

Reply via email to