<-- Back

Error with SQL Server JDBC after upgrade to Mendix 10: NoClassDefFoundError: javax/xml/bind/DatatypeConverter

Issue

After upgrading to Mendix 10, the following error may occur during runtime:

java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

This error indicates that the application cannot find the javax.xml.bind.DatatypeConverter class, which is part of the Java Architecture for XML Binding (JAXB) API. This issue is often related to changes in Java versions and dependencies. Mendix 10 uses Java 11, which no longer includes the javax.xml.bind package as part of the JDK. Instead, the jakarta.xml.bind package is used in newer versions.

Environment

  • Studio Pro v10
  • Java 11 and above

Cause

The error occurs due to one or more of the following reasons:

  • Outdated SQL server JDBC driver: The JDBC driver being used may not be compatible with Java 11 and still relies on the javax.xml.bind package.
  • Conflicting JAR Files: The project may contain multiple versions of the JAXB API

The javax.xml.bind package was removed from Java 11 in favor of jakarta.xml.bind. However, if the project’s userlib folder contains conflicting libraries, the application might be trying to use classes from both namespaces, leading to the NoClassDefFoundError.

Example conflicted JAR library:

  •  
    • jakarta.xml.bind-api-4.0.0.jar(references jakarta.xml.bind)
    • jakarta.xml.bind-api-2.3.2.jar(references javax.xml.bind)

Solution/Workaround

Given the two possible causes listed above, firstly check if the JDBC drive version is compatible, then check if it contains duplicated jar files.

  • Update SQL server JDBC driver
    1. Navigate to the userlib folder in the project directory and locate the JDBC driver JAR file (e.g., mssql-jdbc-x.x.x.jrexx.jar for SQL Server)

    2. Check if the version is compatible with Java 11 through Release notes for the Microsoft JDBC Driver for SQL Server
    3. If not compatible, updating to the latest stable version
  • Resolve conflicting JAR Files:  
    1. Navigate to the userlib folder in the project directory.

    2. Check if it contains duplicate JAR files, e.g., jakarta.xml.bind-api-4.0.0.jar and jakarta.xml.bind-api-2.3.2.jar
    3. Remove duplicate JAR file, e.g.,jakarta.xml.bind-api-2.3.2.jar.
    4. Clean deployment directory

Internal information related

  • 207322, 240544 
  • C0TS72R9B/p1669736439455709

Additional information 

Stack Overflow:

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.