javaspring-booteclipsewildflywildfly-26

getting "java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException" when i run my java app on docker (wildfly)


I updated my wildfly version from 14.0.1 to 27.0.1 everything is working fine on mylocal environment. However, when i deploy it to the docker following errors come up. enter image description here

I have three persistence units using jakarta java 11 and eclipslink as persistence provider. please let me know what am i doing wrong?


Solution

  • The problem is related to the Eclipselink module in wildfly 27.0.1, which is not properly configured in the module.xml file. To fix this issue, you need to add dependencies to the module.xml file that are not present by default. Eclipselink uses these dependencies to function correctly.

    To do this, follow these steps:

    Open the module.xml file for the Eclipselink module, which is located at <WILDFLY_HOME>/modules/system/layers/base/org/eclipse/persistence/main/module.xml.

    Add the following dependencies to the dependencies section of the module.xml file:

    <module name="java.xml"/>
    <module name="java.rmi"/>
    <module name="java.desktop"/>
    

    Save the changes to the module.xml file and restart Wildfly.

    Here is an example of what the updated module.xml file should look like:

    <?xml version="1.0" encoding="UTF-8"?>
    <module name="org.eclipse.persistence" xmlns="urn:jboss:module:1.9">
        <properties>
            <property name="jboss.api" value="public"/>
        </properties>
    
        <resources>
            <resource-root path="jipijapa-eclipselink-27.0.1.Final.jar"/>
            <resource-root path="eclipselink-4.0.1.jar">
               <filter>
                  <exclude path="jakarta/**" />
               </filter>
            </resource-root>
        </resources>
    
        <dependencies>
            <module name="java.xml"/>
            <module name="java.rmi"/>
            <module name="java.desktop"/>
            <module name="java.logging"/>
            <module name="java.management"/>
            <module name="java.naming"/>
            <module name="jakarta.annotation.api"/>
            <module name="jakarta.enterprise.api"/>
            <module name="jakarta.json.api" optional="true"/>
            <module name="jakarta.persistence.api"/>
            <module name="jakarta.transaction.api"/>
            <module name="jakarta.validation.api"/>
            <module name="jakarta.xml.bind.api"/>
            <module name="org.antlr"/>
            <module name="org.jboss.as.jpa.spi"/>
            <module name="org.jboss.logging"/>
            <module name="org.jboss.vfs"/>
        </dependencies>
    </module>