ehcache / ehcache3

Ehcache 3.x line
http://www.ehcache.org
Apache License 2.0
2k stars 578 forks source link

Deprecated javax.xml API is used to parse configuration in Ehcache3 #3224

Closed radistao closed 4 months ago

radistao commented 4 months ago

javax.xml.bind » jaxb-api v2 is outdated for 6 years already and migrated to jakarta.xml.bind » jakarta.xml.bind-api v4, but Ehcache still depends on the old API and implementation, in particular https://github.com/ehcache/ehcache3/blob/561af430d76847a2c8aa1ba507cf3e142ad9185e/ehcache-xml/src/main/java/org/ehcache/xml/ConfigurationParser.java#L43

For example, having:

The application throws exception

org.springframework.beans.factory.BeanCreationException: Error creating bean XXXXX: javax/xml/bind/ValidationEventHandler ... Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler at org.ehcache.xml.XmlConfiguration.(XmlConfiguration.java:116) at org.ehcache.xml.XmlConfiguration.(XmlConfiguration.java:92) at org.ehcache.jsr107.EhcacheCachingProvider$ConfigSupplier.getConfiguration(EhcacheCachingProvider.java:328) at org.ehcache.jsr107.EhcacheCachingProvider.getCacheManager(EhcacheCachingProvider.java:134) at org.ehcache.jsr107.EhcacheCachingProvider.getCacheManager(EhcacheCachingProvider.java:85) at org.ehcache.jsr107.EhcacheCachingProvider.getCacheManager(EhcacheCachingProvider.java:194) at org.hibernate.cache.jcache.internal.JCacheRegionFactory.resolveCacheManager(JCacheRegionFactory.java:208) ... Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler

javax.xml.bind.ValidationEventHandler defined in javax.xml.bind:jaxb-api but jakarta.xml.bind:jakarta.xml.bind-api defines jakarta.xml.bind.ValidationEventHandler

Will the be migrated to jakarta.xml any time soon?

Thank you.

chrisdennis commented 4 months ago

Please use the Jakarta variant library that depends on the new artifacts.

radistao commented 4 months ago

Thank you very much Chris! I didn't know it's possible by the classifier. Shame on me: i needed to suspect that as there are both javax and jakarta dependencies in the code

But still it would be nice to have it more explicitly to mention in a doc. i haven't found it in https://www.ehcache.org/documentation/ or Hibernate Guide , but maybe i overlooked...

radistao commented 4 months ago

@chrisdennis BTW, do you think it has sense in the future to make jakarta version as default and javax by classifier?

chrisdennis commented 4 months ago

It's something we're considering for the next time we do a major release (i.e. Ehcache 4)... but it's not something we can do in a minor/dot and it's not really motivating a major bump in isolation.

radistao commented 4 months ago

clear, thank you Chris