Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-885

Can't load custom appender from applet/JNLP

    XMLWordPrintableJSON

Details

    Description

      I have a JNLP-launched applet using log4j2. Built-in appenders such as RollingFileAppender work as expected, but it is unable to load a custom appender.

      Log4j2 with the custom appender works fine when the applet is launched from Eclipse (Run Configuration = Java Applet), but gives a CLASS_NOT_FOUND error when launched from a JNLP file on the web server.

      Logs when launched from web as a JNLP-based applet (non-working):

      2014-10-23 19:39:40,778 DEBUG Generated plugins in 0.005919 seconds, packages: [com.mycompany.myproduct.common.log4jext, org.apache.logging.log4j.core], preload: true.
      basic: JNLP2ClassLoader.findClass: org.apache.logging.log4j.core.config.xml.XmlConfiguration$Status: try again ..
      basic: JNLP2ClassLoader.findClass: org.apache.logging.log4j.core.config.xml.XmlConfiguration$ErrorType: try again ..
      2014-10-23 19:39:40,781 ERROR Error processing element SwHttp: CLASS_NOT_FOUND
      2014-10-23 19:39:40,782 INFO Scanning for classes in [http://neptune.domain.mycompany.com:9249/app/applets/log4j-core-2.0.2-signed.jar] matching criteria: annotated with @Plugin
      2014-10-23 19:39:40,782 ERROR Could not search jar file 'http:\neptune.domain.mycompany.com:9249\app\applets\log4j-core-2.0.2-signed.jar' for classes matching criteria: annotated with @Plugin file not found java.io.FileNotFoundException: http:\neptune.domain.mycompany.com:9249\app\applets\log4j-core-2.0.2-signed.jar (The filename, directory name, or volume label syntax is incorrect)
      	at java.io.FileInputStream.open(Native Method)
      	at java.io.FileInputStream.<init>(Unknown Source)
      	at org.apache.logging.log4j.core.config.plugins.util.ResolverUtil.loadImplementationsInJar(ResolverUtil.java:300)
      	at org.apache.logging.log4j.core.config.plugins.util.ResolverUtil.findInPackage(ResolverUtil.java:196)
      	at org.apache.logging.log4j.core.config.plugins.util.PluginManager.loadFromPackages(PluginManager.java:177)
      	at org.apache.logging.log4j.core.config.plugins.util.PluginManager.collectPlugins(PluginManager.java:156)
      	at org.apache.logging.log4j.core.config.plugins.util.PluginManager.collectPlugins(PluginManager.java:136)
      	at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:46)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:337)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:150)
      	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:364)
      	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:422)
      	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:146)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:85)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37)
      	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:474)
      	at com.mycompany.myproduct.applet.myproductApplet.<clinit>(myproductApplet.java:125)
      	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.newInstance(Unknown Source)
      	at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
      	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
      	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      	at java.awt.EventQueue.access$200(Unknown Source)
      	at java.awt.EventQueue$3.run(Unknown Source)
      	at java.awt.EventQueue$3.run(Unknown Source)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      	at java.awt.EventQueue$4.run(Unknown Source)
      	at java.awt.EventQueue$4.run(Unknown Source)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
      

      Logs when launched from Eclipse (working):

      2014-10-23 19:37:32,424 DEBUG Starting configuration XmlConfiguration[location=C:\Users\myuser\Documents\_mycompany\Dev\myproject\trunk\java\com.mycompany.myproduct.staticresources\bin\com\mycompany\myproduct\staticresources\applet\log4j2.xml]
      2014-10-23 19:37:32,429 INFO Scanning for classes in [/C:/Users/myuser/Documents/_mycompany/Dev/myproject/trunk/java/com.mycompany.myproduct.common/bin/com/mycompany/myproduct/common/log4jext] matching criteria: annotated with @Plugin
      2014-10-23 19:37:32,429 DEBUG Checking to see if class com.mycompany.myproduct.common.log4jext.LogQueue matches criteria [annotated with @Plugin]
      2014-10-23 19:37:32,429 DEBUG Checking to see if class com.mycompany.myproduct.common.log4jext.SwHttpAppender matches criteria [annotated with @Plugin]
      2014-10-23 19:37:32,430 DEBUG Checking to see if class com.mycompany.myproduct.common.log4jext.SwHttpAppenderRunnable matches criteria [annotated with @Plugin]
      2014-10-23 19:37:32,435 DEBUG Generated plugins in 0.010325 seconds, packages: [com.mycompany.myproduct.common.log4jext], preload: false.
      2014-10-23 19:37:32,437 DEBUG Found Plugin Map at jar:file:/C:/Users/myuser/Documents/_mycompany/Dev/myproject/trunk/java/com.mycompany.myproduct.common/src/lib/log4j-core-2.0.2.jar!/META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
      ...etc...
      

      I have examined the main applet .jar on the server. The custom appender's .class file does exist in the proper subfolder in the .jar.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Simon Wai Simon Wai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: