Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-21093

Regression: validation.xml no longer found during startup due to context classloader change (WildFly 30 → 37)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Bean Validation
    • None
    • Hide
      • Create an EAR with a single WAR module.
      • Place validation.xml in WEB-INF/classes (or inside a JAR in WEB-INF/lib).
      • Use debug logging for hibernate-validator: e.g. via CLI
        /subsystem=logging/logger=org.hibernate.validator:add(level=DEBUG)
        
      • Deploy the EAR to WildFly 37.

       

      If you see

      "Trying to load META-INF/validation.xml via Hibernate Validator's class loader"
      

      loading via context classloader has not been successful.

       

      Show
      Create an EAR with a single WAR module. Place validation.xml in WEB-INF/classes (or inside a JAR in WEB-INF/lib). Use debug logging for hibernate-validator: e.g. via CLI /subsystem=logging/logger=org.hibernate.validator:add(level=DEBUG) Deploy the EAR to WildFly 37.   If you see "Trying to load META-INF/validation.xml via Hibernate Validator's class loader" loading via context classloader has not been successful.  
    • ---
    • ---

      We’re observing a behavioral change when upgrading from WildFly 30 to WildFly 37 regarding the context classloader used during initializing extensions.
      In our case, this change prevents the Hibernate Validator CDI extension from finding validation.xml within the deployed WAR.

      Environment:

      • WildFly version: 37
      • Previously working version: 30
      • Deployment: EAR with a single WAR

      Steps to Reproduce (see below)

      Expected Behavior:

      • During startup, when org.hibernate.validator.cdi.ValidationExtension is built,
        the validation.xml resource should be found from within the WAR file (as it was in WildFly 30).
      • The validator system should initialize correctly.

      Actual Behavior:

      • In WildFly 37, the resource is not found because the
        Thread Context ClassLoader is now set to the EAR classloader,
        which does not (yet?) see resources within the WAR.
      • This causes the validator system to fail initialization.

      Relevant Reference:

      Additional Notes:

      • We rely on CDI-aware ValidatorFactory creation since we use CDI-managed validators, message interpolators, etc.
      • If this is an intentional classloading change, we’d appreciate guidance on how to restore the previous behavior via configuration.

       

      Any help/hint/workaround apprecciated!

              jaslee@redhat.com Jason Lee
              jens.borrmann@msg.group Jens Borrmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: