1

I have a java applet application running with java plugin2. The applet configuration is using a JNLP file, as supported by the next-generation java plugin architecture.

Sun states that you should not use Class.forName in the context of a java webstart (or java applet) application.

But I guess Log4j is doing it to configure the loggers, according to my log4j.properties configuration. So I'm getting a lot of nesty exceptions which I'm almost sure is related to this.

  1. Is it possible to change log4j behavior not to use Class.forName?
  2. I'm actually using slf4j backed by log4j. If I change to logback will I have the same kind of problems?
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
tuler
  • 3,339
  • 7
  • 34
  • 44
  • Log4j is doing it correctly, not calling Class.forName. So it's something else. – tuler Jan 13 '10 at 17:09
  • Class.forname is fine in an applet, at least I've used it consistently without errors in several Applets over a few years. Why not add the exception? – Pool Jan 13 '10 at 20:34
  • I think the restriction is only when you use a JNLP file to declare the applet jar resources (which is only possible in the new java plugin 6u10+) – tuler Jan 13 '10 at 22:52

1 Answers1

0

We had the same issue in Stendhal. As workaround you can set the log4j.ignoreTCL system property before you initialize log4j:

System.setProperty("log4j.ignoreTCL", "true");
Hendrik Brummermann
  • 8,242
  • 3
  • 31
  • 55