Skip to content

ClassNotFoundException: javax.xml.bind.ValidationEventHandler happening even though jakarta.xml.bind-api 4.x.x installed #3301

@xldai

Description

@xldai
CacheManager accountCacheManager = CacheManagerBuilder.newCacheManager(new XmlConfiguration(xmlUrl));

Then got ClassNotFoundException: javax.xml.bind.ValidationEventHandler when running:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
	at org.ehcache.xml.XmlConfiguration.<init>(XmlConfiguration.java:116)
	at org.ehcache.xml.XmlConfiguration.<init>(XmlConfiguration.java:92)
	at org.ehcache.xml.XmlConfiguration.<init>(XmlConfiguration.java:78)

Here: https://repo1.maven.org/maven2/org/ehcache/modules/ehcache-xml/3.10.8/ehcache-xml-3.10.8.pom

    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>[2.2,3)</version>
      <scope>compile</scope>
    </dependency>
	
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <version>[3,4)</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

Both javax.xml.bind and jakarta.xml.bind-api are declared as dependencies of it.

Any chance the ehcache is working with ONLY jakarta jaxb ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions