We have an existing Logging service that works as a singleton in our
servlet project. We want to move that into the EJB environment. One
possible logging option is to a file. Thus, the following question:
I have a question with respect to the compliance to the EJB spec.
It is illegal, according to the spec, to access a file from a bean. Is
this
enforced by the bean's class loader?
What happens if the bean calls a static method of a class that is NOT
in the bean's class path but rather in the application server's
classpath?
Are the security restrictions still enforced? Will the static method not
be allowed to write to a file?
A third scenario:
On application startup, before any beans are loaded, we create a
singleton instance of our class and bind that to JNDI. Again, this
class is on the application server's classpath.
If a bean then gets a reference to this from JNDI, will the singleton be
allows to write to a file?
As an example, in our servlet project the log might look something like
this:
Log {
static private Log mo_log = Log ();
static void logMessage (String ls_message) {
mo_log.logToFile (ls_message);
}
private void logToFile (String ls_message) {
//Write some message to a file.
}
}
If it is illegal for a bean to call the logMessage method when
the class is loaded on the application's class path, we are thinking
about changing the class to look like this:
Log {
static private Log mo_log;
static {
//Bind to JNDI
//Get reference to logger
//Set mo_log to reference.
}
static void logMessage (String ls_message) {
mo_log.logToFile (ls_message);
}
private void logToFile (String ls_message) {
//Write some message to a file.
}
}
Thanks In advance.
Tyler Van Gorder
[EMAIL PROTECTED]
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".