You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Josh Reeves <j....@lycos.com> on 2001/09/17 18:07:10 UTC
log4j with EJB: AccessControlException
Hello everyone!
If you have a minute, please, take a look at my problem and
point me to the right direction.
Many thanks in advance!
Here is what I have.
I'm trying to get log4j working with EJB. And it does, as long as I
agree to the output to the console. But if my log4j.properties
changed to ( borrowed as is from the manual, but the file name):
<< start of file >>
log4j.rootCategory=debug, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.FileAppender
log4j.appender.R.File=MeasurementAPP.log
log4j.appender.R.ImmediateFlush=true
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
<< end of file >>
I'm getting:
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.RemoteException: Unknown exception; nested exception is:
java.lang.ExceptionInInitializerError
java.rmi.RemoteException: Unknown exception; nested exception is:
java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError: java.security.AccessControlException: acc
ess denied (java.io.FilePermission MeasurementAPP.log write)
<<no stack trace available>>
An entity bean looks the following:
public
abstract
class MeasurementEJB implements EntityBean
{
static
final
Category CAT = Category.getInstance( MeasurementEJB.class);
static
final
String LOG_FNAME = "/MeasurementAPP.log";
static
{
FilePermission fp = new FilePermission( LOG_FNAME, "write");
try
{
AccessControlContext acc = AccessController.getContext();
acc.checkPermission( fp);
}
catch( AccessControlException accEx)
{
accEx.printStackTrace();
throw new EJBException( accEx);
}
PropertyConfigurator.configure( "log4j.properties");
} // static
...
public
Collection ejbHomeGetMeasurementsInDate( Date from, Date to,
int quantity)
{
Vector result = new Vector();
CAT.debug( "In ejbHomeGetMeasurementsInDate.");
...
} // end ejbHomeGetMeasurementsInDate
} // end of MeasurementEJB
log4j.jar is bound to the ejb-jar by being under META-INF/lib.
What would be your suggestion?
Also, log4j.configuration property: where it should be specified?
Best regards,
AR
--
Thank you!
Make a difference, help support the relief efforts in the U.S.
http://clubs.lycos.com/live/events/september11.asp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org