Jmix Reports Add-on causes Hazelcast/Xalan startup error in Jmix 3.0.2

Hi Jmix Team,

I am migrating my application to Jmix 3.0.2 and I am facing a startup issue when I add the Jmix Reports add-on.

Environment

  • Jmix: 3.0.2

  • Spring Boot: 4.0.8

  • Spring Framework: 7.0.9

  • Java: 21.0.12

  • Hazelcast: 5.6.0

  • Xalan: 2.7.3

  • OS: Ubuntu
    Problem

    The application starts successfully when the Jmix Reports add-on is not included.

    However, after adding the Jmix Reports add-on, the application fails during startup with the following exception:

    java.lang.IllegalArgumentException:
    Not supported: 
    http://javax.xml.XMLConstants/property/accessExternalDTD
    
        at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(
            TransformerFactoryImpl.java:571
        )
        at com.hazelcast.internal.util.XmlUtil.setAttribute(
            XmlUtil.java:199
        )
        at com.hazelcast.internal.util.XmlUtil.getTransformerFactory(
            XmlUtil.java:86
        )
        at com.hazelcast.config.AbstractXmlConfigHelper.schemaValidation(
            AbstractXmlConfigHelper.java:107
        )
        at com.hazelcast.config.XmlConfigBuilder.parseAndBuildConfig(
            XmlConfigBuilder.java:170
        )
    

    This then results in:

    Failed to instantiate [javax.cache.CacheManager]
    
    Factory method 'jCacheCacheManager' threw exception with message:
    Error opening URI [hazelcast]
    

    Dependency chain

    From the stack trace, the failure occurs approximately in this flow:

    Spring Boot JCache configuration
            ↓
    Hazelcast JCache CacheManager
            ↓
    Hazelcast XML configuration
            ↓
    Xalan 2.7.3 TransformerFactory
            ↓
    accessExternalDTD
            ↓
    IllegalArgumentException
    

    Because the JCache CacheManager cannot be created, this subsequently causes failures while creating Jmix beans such as the EntityManagerFactory and related dependencies.

    Important observation

    The same application starts successfully when the Jmix Reports add-on is removed.

    The problem appears only after adding the Reports add-on.

    The important part is that the failure is:

    Not supported:
    http://javax.xml.XMLConstants/property/accessExternalDTD
    

    inside:

    org.apache.xalan.processor.TransformerFactoryImpl
    

    while Hazelcast is creating its configuration.

    Any guidance on the correct dependency/configuration change would be appreciated.

    Warm Regards,
    Naveen

    java lang IllegalArgumentException.txt (67.5 KB)

Hi @naveen.mokka.javadev!

Thank you for your question.

I investigated the issue and found that Reports places outdated XML libraries on the classpath using META-INF/services, these become the default XML factories for the entire application.

I created an issue to fix it: Application fails to start with Reports add-on when Hazelcast is used for shared cache · Issue #5755 · jmix-framework/jmix · GitHub

As a temporary workaround you can pass the following system properties:

javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory

Best regards,
Dmitriy

Hi,@d.kremnev

Thank you for investigating the issue and providing the workaround. I added the suggested system properties, and it is working fine now. I really appreciate your help!

Warm Regards,
Naveen

1 Like