You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2026/05/18 13:40:08 UTC
[Bug 70049] New: Error in WebappClassLoaderBase.getResources
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Bug ID: 70049
Summary: Error in WebappClassLoaderBase.getResources
Product: Tomcat 9
Version: 9.0.118
Hardware: PC
OS: Linux
Status: NEW
Severity: regression
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: robert.rodewald@kopsis.com
Target Milestone: -----
We are using MyBatis to register some TypeAliases.
This worked perfectly well for Tomcat 9.0.117 (and before) and stopped working
in Tomcat 9.0.118. Going back to 9.0.117 confirmed that this is a bug
introduced in exactly this version.
The war is perfectly fine (no subfolder under Absence.class, class can be
extracted from it just fine, no inner classes, just a plain data holder).
Here is the stacktrace:
2026-05-18 11:28:19,779 [][] ERROR InitializerContextListener Init failed!
java.lang.IllegalArgumentException: The resource path
[/WEB-INF/classes/com/<redacted>/bo/Absence.class/����^@^@^@A^@/] has been
normalized to [null] which is not valid
at
org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:259)
at
org.apache.catalina.webresources.StandardRoot.getResources(StandardRoot.java:303)
at
org.apache.catalina.webresources.StandardRoot.getClassLoaderResources(StandardRoot.java:227)
at
org.apache.catalina.loader.WebappClassLoaderBase.findResources(WebappClassLoaderBase.java:952)
at
org.apache.catalina.loader.WebappClassLoaderBase.getResources(WebappClassLoaderBase.java:1047)
at org.apache.ibatis.io.VFS.getResources(VFS.java:199)
at org.apache.ibatis.io.DefaultVFS.list(DefaultVFS.java:110)
at org.apache.ibatis.io.DefaultVFS.list(DefaultVFS.java:158)
at org.apache.ibatis.io.VFS.list(VFS.java:240)
at org.apache.ibatis.io.ResolverUtil.find(ResolverUtil.java:250)
at
org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:138)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #3 from Mark Thomas <ma...@apache.org> ---
That would be a question for MyBatis.
I'm not seeing anything that points to a Tomcat bug or regression here.
Feel free to re-open if you have valid path that triggers this check.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
--- Comment #5 from agharta <ag...@gmail.com> ---
Sorry for intrusion.
I can only add a +1 because I have the same exact problem.
To completeness, an issue has been filled to Mybatis:
https://github.com/mybatis/mybatis-3/issues/3689
Thanks,
Agharta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Robert Rodewald <ro...@kopsis.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #2 from Robert Rodewald <ro...@kopsis.com> ---
The redacted part contains 7-bit ascii characters only.
I may be misled but I suppose the "error" has been introduced by the check for
0 bytes in this commit:
https://github.com/apache/tomcat/commit/3ac1c7b0a8c7d2fec42bc050843b7f68fc2c9098
So the question may be where this "bad" path commes from - I mean the stuff
after the class name.
The class is extremely simple, a pure data holder only with getters and
setters. No inner class or anything remotely complex.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Mark Thomas <ma...@apache.org> ---
Given the parent class loader returns an empty enumeration in this case, it
seems reasonable for the web application class loader to do the same.
Fixed in:
- 11.0.x for 11.0.23 onwards
- 10.1.x for 10.1.56 onwards
- 9.0.x for 9.0.119 onwards
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Remy Maucherat <re...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Remy Maucherat <re...@apache.org> ---
Well, unredact and give us a full path that would not be normalized correctly
(while you think it should be).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 70049] Error in WebappClassLoaderBase.getResources
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70049
Robert Rodewald <ro...@kopsis.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |---
Status|RESOLVED |REOPENED
--- Comment #4 from Robert Rodewald <ro...@kopsis.com> ---
I investigated the matter a little further and looked into the source code of
MyBatis.
The explanation is in this comment form DefaultVFS class:
/*
* Some servlet containers allow reading from directory resources like a text
file, listing the child
* resources one per line. However, there is no way to differentiate between
directory and file resources
* just by reading them. To work around that, as each line is read, try to look
it up via the class loader
* as a child of the current resource. If any line fails then we assume the
current resource is not a
* directory.
*/
So MyBatis discovers the directory content by reading from a file: URL which
points to a directory. This works (at least on my system) and gives the
directory content line by line.
In the next step MyBatis reads from each directory entry it found (which is the
class file Absence.class in my case), appends it's first line to the path and
tries to get this "resource" from the class loader. This is where the new
validation from
https://github.com/apache/tomcat/commit/3ac1c7b0a8c7d2fec42bc050843b7f68fc2c9098
yields null and then subsequently an IllegalArgumentException. MyBatis only
handles InvalidPathException and FileSystemException but not
IllegalArgumentException and this breaks the discovery mechanism.
Perhaps throwing InvalidPathException instead of IllegalArgumentException in
StandardRoot.java:259 or just returning null would be a better (more backwards
compatible) option?
Otherwise, I can open a bug report with MyBatis and/or work around the
discovery mechanism of MyBatis entirely.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org