java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.ClassNotFoundException
- All Implemented Interfaces:
- Serializable
- See Also:
- Top Examples, Source Code,
Throwable.getCause()
, getException()
, Class.forName(java.lang.String)
,
ClassLoader.findSystemClass(java.lang.String)
,
ClassLoader.loadClass(java.lang.String, boolean)
public ClassNotFoundException()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1101]Make sure the same classloader loads your singletons
By Anonymous on 2004/11/05 17:46:15 Rate
// Because multiple classloaders are commonly used in many situations
// including servlet containers. you can wind up with multiple
// singleton instances no matter how carefully you've implemented
// your singleton classes. If you want to make sure the same
// classloader loads your singletons, you must specify the
// classloader yourself; for example:
private static Class getClass ( String classname )
throws ClassNotFoundException {
ClassLoader classLoader = Thread.currentThread ( ) .getContextClassLoader ( ) ;
if ( classLoader == null )
classLoader = Singleton.class.getClassLoader ( ) ;
return ( classLoader.loadClass ( classname ) ) ;
}
}
public class Singleton {
// a singleton class
}
public ClassNotFoundException(String s)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ClassNotFoundException(String s,
Throwable ex)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Throwable getCause()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Throwable getException()
- See Also:
Throwable.getCause()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void printStackTrace()
- See Also:
System.err
, Throwable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void printStackTrace(PrintStream ps)
- See Also:
- Throwable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void printStackTrace(PrintWriter pw)
- See Also:
- Throwable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples