You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2010/07/21 14:50:50 UTC

DO NOT REPLY [Bug 49628] New: log4j fails to work in an applet environment

https://issues.apache.org/bugzilla/show_bug.cgi?id=49628

           Summary: log4j fails to work in an applet environment
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: ilyabo@gmail.com


Created an attachment (id=25792)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25792)
The simplest possible example project for which the exception can be reproduced

When used within the simple applet below log4j throws a
NoClassDefFoundException and can even prevent the applet from working in the
browser _when opened from a website_ (it seems to work with no errors locally).
See the attachment for the whole project:

public class MyApplet extends JApplet {

  public static Logger logger = Logger.getLogger(MyApplet.class);

  public MyApplet() {
    logger.debug("MyApplet::constructor() start");
    JButton button = new JButton("Hello, world!");
    button.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        JOptionPane.showMessageDialog(MyApplet.this, "Hi there!");
      }
    });
    add(button);
    logger.debug("MyApplet::constructor() end");
  }

  @Override
  public void init() {
    logger.debug("MyApplet.init()");
  }

}


log4j:WARN Error during default initialization
java.lang.NoClassDefFoundError: IllegalName: <!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Strict//EN"
    at java.lang.ClassLoader.preDefineClass(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.getProviderClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
    at javax.xml.parsers.FactoryFinder.find(Unknown Source)
    at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
    at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:849)
    at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:773)
    at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
    at org.apache.log4j.Logger.getLogger(Logger.java:117)
    at MyApplet.<clinit>(MyApplet.java:12)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
log4j:WARN No appenders could be found for logger (MyApplet).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more
info.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 49628] log4j fails to work in an applet environment

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49628

Ilya Boyandin <il...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Ilya Boyandin <il...@gmail.com> 2010-07-21 09:23:08 EDT ---
I am closing the bug, because I realized that this problem is not log4j's fault
and it's not only occurring when using log4j. There is a bug submitted for the
JVM for the problem: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6506467

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org