https://bz.apache.org/bugzilla/show_bug.cgi?id=58519
Bug ID: 58519
Summary: org.apache.catalina.loader.WebappClassLoaderBase.check
StateForClassLoading throwing
java.lang.IllegalStateException: Can't overwrite cause
Product: Tomcat 8
Version: trunk
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Hi,
Recently I had catalina log grow in few seconds to enormous sizes, partially
due to problems with mentioned method. Instead of creating and declared
ClassNotFoundException it throws "java.lang.IllegalStateException: Can't
overwrite cause".
Looking into the code I found here:
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/8.0.23/org/apache/catalina/loader/WebappClassLoaderBase.java#WebappClassLoaderBase.checkStateForClassLoading%28java.lang.String%29
1309 protected void checkStateForClassLoading(String className) throws
ClassNotFoundException {
1310 // It is not permitted to load new classes once the web application
has
1311 // been stopped.
1312 try {
1313 checkStateForResourceLoading(className);
1314 } catch (IllegalStateException ise) {
1315 ClassNotFoundException cnfe = new ClassNotFoundException();
1316 cnfe.initCause(ise);
1317 throw cnfe;
1318 }
1319 }
I belive the problem is caused by setting initcause on created class when
constructor
new ClassNotFoundException()
has explicty stated:
71 public ClassNotFoundException() {
72 super((Throwable)null); // Disallow initCause
73 }
Which during initCause is producing mentioned exception:
454 public synchronized Throwable initCause(Throwable cause) {
455 if (this.cause != this)
456 throw new IllegalStateException("Can't overwrite cause with " +
457 Objects.toString(cause, "a
null"), this);
458 if (cause == this)
459 throw new IllegalArgumentException("Self-causation not
permitted", this);
460 this.cause = cause;
461 return this;
462 }
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]