NPE with logging when starting webstart on jre7 update 40

My application worked fine until I updated my jre to 7u40. When my application initializes, it executes Logger.getLogger ("ClassName"), and I get the following exception.

java.lang.ExceptionInInitializerError at java.util.logging.Logger.demandLogger(Unknown Source) at java.util.logging.Logger.getLogger(Unknown Source) at com.company.Application.Applet.<clinit>(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at java.util.logging.Logger.setParent(Unknown Source) at java.util.logging.LogManager$6.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.doSetParent(Unknown Source) at java.util.logging.LogManager.access$1100(Unknown Source) at java.util.logging.LogManager$LogNode.walkAndSetParent(Unknown Source) at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source) at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source) at java.util.logging.LogManager.addLogger(Unknown Source) at java.util.logging.LogManager$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.<clinit>(Unknown Source) 

The exception comes from this line:

 private static Logger logger = Logger.getLogger(Applet.class.getName()); 

Could this be due to any side effects with the fix http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8017174 ?

The workaround is to open the java control center and enable logging. This is a concern since the Enable Logging option is not set by default. If I select Enable Logging, the application will start normally.

+8
java logging java.util.logging
source share
2 answers

This issue seems to be fixed in java7 45 update.

+1
source share

Try packing java.util.logging.* With your application in the JAR and make sure it is in the classpath. Thus, it is always available. Also, what does your logging.properties look like?

0
source share

All Articles