You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug is happened in following environment - Spring Boot 3 + Tomcat + hibernate + Ehcache
Cause:
In such configuration Tomcat override a list of URL handlers by registering itself as URLStreamHandlerFactory. as a result a new handler for protocol 'classpath' is adding to list of handlers in java.net.URL
and as following result hibernate is calling ehcache with Url(classpath://ehcache.xml). In 'normal' situation Ehcache would be called with full path to file ehcache.xml
When Ehcache is starting processing Url(classpath://ehcache.xml) for unknown reason stream contains rubbish data instead of actual content of ehcache.xml
This bug is happened in following environment - Spring Boot 3 + Tomcat + hibernate + Ehcache
Cause:
In such configuration Tomcat override a list of URL handlers by registering itself as URLStreamHandlerFactory. as a result a new handler for protocol 'classpath' is adding to list of handlers in java.net.URL
As a result the following code in hibernate isn't generating MalformedURLException for classpath://ehcache.xml because 'classpath' now is a correct protocol
https://github.com/hibernate/hibernate-orm/blob/8461ba2078657caf58930b9485020fe89aff4afe/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java#L134
and as following result hibernate is calling ehcache with Url(classpath://ehcache.xml). In 'normal' situation Ehcache would be called with full path to file ehcache.xml
When Ehcache is starting processing Url(classpath://ehcache.xml) for unknown reason stream contains rubbish data instead of actual content of ehcache.xml
there is a simple project for reproducing a bug:
https://github.com/sergmain/ehcache-bug-3195
java.vendor.version: Temurin-17.0.7+7
The text was updated successfully, but these errors were encountered: