You are right, this is a pain in the ass. We use Jboss and though it poses
other kinds of problem in conjunciton to log4j, that's one great J2EE
container.

May be you can modify the java.policy file in the j2ee directories to get
around this. But honestly I have not used Sun's J2EE server and hence don't
want to suggest something wrong.

Swami

> -----Original Message-----
> From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]]
> Sent: August 19, 2002 9:12 AM
> To: 'Log4J Users List'
> Subject: RE: classloader problem
> 
> 
> Now we could read the property file with the J2EE classloader with
> 
>     void configureLog4j( String log4JConfigFile ) {
>               try {
>                       InputStream is =
> getClass().getResourceAsStream(log4JConfigFile);
>                       Properties theProperties = new Properties();
>                       theProperties.load(is);
>                       PropertyConfigurator.configure(theProperties);
>                       is.close();
>                 } ....
>     }
> 
> In this case the property file is in the same directory like 
> the source
> file.
> We can log using the ConsoleAppender, but we got an exception 
> when we tried
> it with 
> file appender:
> 
> java.security.AccessControlException: access denied 
> (java.io.FilePermission
> example.log write).
> Sun is very restrictive in the J2EE classloader.
> 
> Hardy
> 
> -----Original Message-----
> From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 19, 2002 11:24 AM
> To: 'Log4J Users List'
> Subject: RE: classloader problem
> 
> 
> Swami,
> 
> I tried -Dlog4j.configuration with the full path. The result was:
> 
> log4j: Trying to find [C:..our 
> path..\lib\classes\log4j.properties] using
> sun.misc.Launcher$AppClassLoader71732b class loader.
> log4j: Trying to find [C: ..our path.. 
> \lib\classes\log4j.properties] using
> ClassLoader.getSystemResource().
> log4j: Could not find resource: [C: ..our path..
> \lib\classes\log4j.properties].
> log4j:ERROR No appenders could be found for category (<our 
> package>.<our
> classes>).
> log4j:ERROR Please initialize the log4j system properly.
> 
> I think the classloader of J2EE on Windows cannot load the 
> property file.
> But what can we do? 
> Do you or does anybody work with the reference implementation 
> of Java's
> application server and log4j?
> 
> Hardy
> -----Original Message-----
> From: Swami Iyer [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 4:23 PM
> To: 'Log4J Users List'
> Cc: Buettner, Waltraud
> Subject: RE: classloader problem
> 
> 
> Hardy,
> So please try the -Dlog4j.configuration with the full path 
> where the file
> is. I am just trying to elimnate the factors that can cause 
> problems. If the
> -D option with full path name works then we can concentrate 
> on the classpath
> issue.
> 
> Swami
> 
> > -----Original Message-----
> > From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]]
> > Sent: August 15, 2002 3:09 AM
> > To: 'Log4J Users List'
> > Cc: Buettner, Waltraud
> > Subject: RE: classloader problem
> > 
> > 
> > Swami,
> > 
> > We gave only the file name without the path, but the file is 
> > located in a
> > directory which is in the Java CLASSPATH.
> > 
> > Hardy
> > 
> > -----Original Message-----
> > From: Swami Iyer [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 14, 2002 7:31 PM
> > To: 'Log4J Users List'
> > Subject: RE: classloader problem
> > 
> > 
> > When you tried the -Dlog4j.configuration, did you give the 
> > full path as to
> > where the properties file exists?
> > 
> > Swami
> > 
> > > -----Original Message-----
> > > From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]]
> > > Sent: August 14, 2002 12:14 PM
> > > To: 'Log4J Users List'
> > > Cc: Buettner, Waltraud
> > > Subject: RE: classloader problem
> > > 
> > > 
> > > Bhushan,
> > > 
> > > We tried both but without success.
> > > 
> > > Hardy
> > > 
> > > -----Original Message-----
> > > From: Bhangale, Bhushan [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 14, 2002 5:59 PM
> > > To: 'Log4J Users List'
> > > Subject: RE: classloader problem
> > > 
> > > 
> > > Then it is fine. It should work.
> > > 
> > > Is your log4j configuration file name is default 
> > > log4j.properties or you
> > > have given your own name? If you have given your own name 
> > > then you must
> > > specify that in java -Dlog4j.configuration=<your file 
> > name>.properties
> > > 
> > > -----Original Message-----
> > > From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]] 
> > > Sent: Wednesday, August 14, 2002 11:36 AM
> > > To: 'Log4J Users List'
> > > Cc: Buettner, Waltraud
> > > Subject: RE: classloader problem
> > > 
> > > 
> > > Hi Bhushan,
> > > 
> > > Thanks for your mail,
> > > but we start our component in a cmd file on windows with
> > > java -cp %J2EE_CLASSPATH% ...
> > > So the J2EE_CLASSPATH should be part of the java CLASSPATH.
> > > 
> > > Any other idea?
> > > 
> > > Hardy 
> > > 
> > > -----Original Message-----
> > > From: Bhangale, Bhushan [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 14, 2002 4:22 PM
> > > To: 'Log4J Users List'
> > > Subject: RE: classloader problem
> > > 
> > > 
> > > You are adding the log4j.properties path in J2EE_CLASSPATH 
> > > System variable
> > > whereas you need to add it in CLASSPATH system variable which 
> > > is a standard
> > > one. All the properties file reader in java looks for file in 
> > > CLASSPATH
> > > only.
> > > 
> > > Your J2EE_CLASSPATH is only for the application server you 
> > are using.
> > > 
> > > -----Original Message-----
> > > From: Kiefer, Hardy [mailto:[EMAIL PROTECTED]] 
> > > Sent: Wednesday, August 14, 2002 5:36 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: classloader problem
> > > 
> > > 
> > > 
> > > > Hello All,
> > > > can anybody help me.
> > > > I use the application server included in j2eesdk1.3.1 and 
> > > my component
> > > > uses log4j 1.1.3. The problem is, that log4j.properties can 
> > > never be 
> > > > loaded, but it is in the J2EE_CLASSPATH.
> > > > 
> > > > With -Dlog4j.ConfigDebug=true I got:
> > > > 
> > > > log4j: Trying to find [log4j.properties] using
> > > > sun.misc.Launcher$AppClassLoader@71732b class loader.
> > > > log4j: Trying to find [log4j.properties] using 
> > > > ClassLoader.getSystemResource().
> > > > log4j: Could not find resource: [log4j.properties]. 
> > log4j:ERROR No 
> > > > appenders could be found for category 
> > > > (com.<myCompany>.<myPackage>.AbstractConnectionFactory).
> > > > log4j:ERROR Please initialize the log4j system properly.
> > > > 
> > > > Has anybody any idea?
> > > > 
> > > > thanks,
> > > > Hardy
> > > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > > "The information in this e-mail, and any attachment therein, is 
> > > confidential and for use by the addressee only. If you 
> are not the 
> > > intended recipient, please return the e-mail to the sender 
> > and delete 
> > > it from your computer. Although The Bank of New York attempts to 
> > > sweep e-mail and attachments for viruses, it does not 
> > guarantee that 
> > > either are virus-free and accepts no liability for any damage 
> > > sustained 
> > > as a result of viruses." 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > > "The information in this e-mail, and any attachment therein, is 
> > > confidential and for use by the addressee only. If you 
> are not the 
> > > intended recipient, please return the e-mail to the sender 
> > and delete 
> > > it from your computer. Although The Bank of New York attempts to 
> > > sweep e-mail and attachments for viruses, it does not 
> > guarantee that 
> > > either are virus-free and accepts no liability for any damage 
> > > sustained 
> > > as a result of viruses." 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to