java.lang.IllegalArgumentException: name

QOS.ch JIRA | David Riseley | 7 years ago
  1. 0

    When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )

    QOS.ch JIRA | 7 years ago | David Riseley
    java.lang.IllegalArgumentException: name
  2. 0

    When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )

    QOS.ch JIRA | 7 years ago | David Riseley
    java.lang.IllegalArgumentException: name
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Call Java function in XSLT

    Stack Overflow | 2 years ago | rohit31dec91
    java.lang.IllegalArgumentException: name

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      name

      at sun.misc.URLClassPath$Loader.findResource()
    2. Java RT
      CompoundEnumeration.hasMoreElements
      1. sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458)
      2. sun.misc.URLClassPath$1.next(URLClassPath.java:195)
      3. sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205)
      4. java.net.URLClassLoader$3$1.run(URLClassLoader.java:393)
      5. java.security.AccessController.doPrivileged(Native Method)
      6. java.net.URLClassLoader$3.next(URLClassLoader.java:390)
      7. java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415)
      8. sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
      9. sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
      10. sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
      11. sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
      11 frames
    3. Logback Core Module
      Loader.getResourceOccurenceCount
      1. ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58)
      1 frame
    4. Logback Classic Module
      ContextInitializer.autoConfig
      1. ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131)
      2. ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154)
      3. ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88)
      4. ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97)
      5. ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119)
      5 frames
    5. SLF4J LOG4J-12 Binding
      StaticLoggerBinder.<clinit>
      1. org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83)
      2. org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54)
      2 frames
    6. SLF4J API Module
      LoggerFactory.getLogger
      1. org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230)
      2. org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
      3. org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
      4. org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
      5. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248)
      6. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261)
      6 frames
    7. com.example.csp
      KernelActivatorImpl.start
      1. com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74)
      2. com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51)
      3. com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61)
      4. com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207)
      5. com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93)
      6. com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58)
      7. com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101)
      7 frames
    8. Apache Felix Framework
      StartLevelImpl.run
      1. org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
      2. org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
      3. org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
      4. org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
      4 frames
    9. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame