United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4931321 Cannot specify java.util.logging.manager property using JWS
JDK-4931321 : Cannot specify java.util.logging.manager property using JWS

Details
Type:
Enhancement
Submit Date:
2003-10-02
Status:
Resolved
Updated Date:
2004-02-14
Project Name:
JDK
Resolved Date:
2003-11-17
Component:
core-libs
OS:
solaris_9
Sub-Component:
java.util.logging
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_01
Fixed Versions:
1.4.2_04 (04)

Related Reports
Backport:
Relates:

Sub Tasks

Description
LogManager class is located using the  java.util.logging.manager system property.  The call in 

LogManager.run()ClassLoader.getSystemClassLoader().loadClass(com.nortel.logging.LogManager) 

produces the exception :

Could not load Logmanager "com.nortel.logging.LogManager"
      java.lang.ClassNotFoundException: com.nortel.logging.LogManager

                                    

Comments
EVALUATION

The java.util.logger.LogManager class has static initialization with:
cname = System.getProperty("java.util.logging.manager");                         Class clz = ClassLoader.getSystemClassLoader().loadClass(cname);

This pre-supposes the LogManager will be initialized by code loded on the SystemClassLoader, and the class refered to by the property "java.util.logging.manager" can be loaded by the SystemClassLoader.

This will not work for browser plugin applets, Java Web Start applications, and any other coded loaded by any other class loader.

I believe the code int LogManager should be:
 Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);

###@###.### 2003-10-02

Use classloader fix and javadoc has been updated


###@###.### 2004-02-13
                                     
2003-10-02
WORK AROUND

A workaround for this is found from the Java forums.

Look at the Thread :

http://forum.java.sun.com/thread.jsp?forum=38&th


From this thread :

-----------------------------------------------------------------------------
My ugly hack was to lift the code out of the LogManager.readConfiguration() method and rework it to use the correct class loader.
eg:

public static void main(String[] args) {
displayJavaVersion();
setupLoggging();
// rest of application
}

private static void setupLoggging() {
// Under web start the property java.util.logging.config.class
// is set only after the logging has been created. So we need
// to force the logging manager to re-read its configuration.
// This code is copied from the
// LogonManager.readConfiguration() method, but the class loader
// is changed to be the one on the current thread. See java bug
// report 4452040 for more on this...
String cname = System.getProperty("java.util.logging.config.class");
if (cname != null) {
try {
// Instantiate the named class. It its contructor's
// repsonsibility to initialize the logging configuration, by
// calling readConfiguration(InputStream) with a suitable
// stream.
Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
clz.newInstance();
} catch (Exception ex) {
System.err.println("Logging configuration class \"" + cname
+ "\" failed");
System.err.println("" + ex);
}
}
}

The downside of this is that under web start the default logging configuration get called with a class file not known to the system, so you always get an error message written to System.err. Outside of the web start environment, the class will be loaded twice. Further, if under web start, if you call LogManager.readConfiguration(), all your settings will vanish.... 

-----------------------------------------------------------------------------

Based on this workaround we did modify the test case and it seems to work but is very crude and really would need a better solution.

You can look at the files related to the workaround at:

/net/warriors.sfbay/export/home4/shridhar/nortel/825503/new


We see these exceptions still after using the workaround.

Java Web Start 1.4.2_01 Console, started Wed Oct 01 18:33:38 PDT 2003
Java 2 Runtime Environment: Version 1.4.2_01 by Sun Microsystems Inc.
Could not load Logmanager "LogManagerC"
java.lang.ClassNotFoundException: LogManagerC
	at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
	at java.util.logging.LogManager$1.run(LogManager.java:147)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.logging.LogManager.<clinit>(LogManager.java:141)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at java.lang.Class.newInstance0(Class.java:308)
	at java.lang.Class.newInstance(Class.java:261)
	at LoggingMain.setupLoggging(LoggingMain.java:53)
	at LoggingMain.main(LoggingMain.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.sun.javaws.Launcher.executeApplication(Launcher.java:837)
	at com.sun.javaws.Launcher.executeMainClass(Launcher.java:797)
	at com.sun.javaws.Launcher.continueLaunch(Launcher.java:675)
	at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:390)
	at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:199)
	at com.sun.javaws.Launcher.run(Launcher.java:167)
	at java.lang.Thread.run(Thread.java:534)
Logging Manager class "LogManagerC" success
Oct 1, 2003 6:33:53 PM LoggingMain main
SEVERE: my severe message
Oct 1, 2003 6:33:53 PM LoggingMain main
SEVERE: my severe message
Oct 1, 2003 6:33:53 PM LoggingMain main
WARNING: my warning message
Oct 1, 2003 6:33:53 PM LoggingMain main
WARNING: my warning message
Oct 1, 2003 6:33:53 PM LoggingMain main
INFO: my info message
Oct 1, 2003 6:33:53 PM LoggingMain main
INFO: my info message
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_04
generic
tiger-beta

FIXED IN:
1.4.2_04
tiger-beta2

INTEGRATED IN:
1.4.2_04
tiger-beta2


                                     
2004-06-14



Hardware and Software, Engineered to Work Together