Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.0.Alpha1, 5.3.0.CR1, 5.3.0.Final
    • Fix Version/s: 5.3.1.Final
    • Component/s: engine
    • Labels:
      None

      Description

      With Hibernate 5.2.4.Final the following code successfully creates a Validator, even if no EL implementation is available on the classpath:

      private Validator getSimpleValidator() {
          final Configuration<?> cfg = Validation.byDefaultProvider().configure();
          cfg.messageInterpolator(new ParameterMessageInterpolator());
          return cfg.buildValidatorFactory().getValidator();
      }
      

      This is because the eager EL check introduced in HV-793 Closed is avoided by using ParameterMessageInterpolator, introduced in HV-853 Closed .

      But it seems to me HV-1039 Closed broke this feature in commit 6bfde6e, because the EL presence check is now part of the classloading of ResourceBundleMessageInterpolator, which is an unconditional side-effect of instantiating ConfigurationImpl, which is what HibernateValidator#createGenericConfiguration does.

      So with Hibernate 5.3.0.Final the code above throws this exception:

      Caused by: java.lang.ExceptionInInitializerError
      	at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:129)
      	at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:96)
      	at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:33)
      	at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276)
      	at com.exampe.Test.getSimpleValidator(Test.java:142)
      	at com.exampe.Test.<init>(Test.java:48)
      	... 30 more
      Caused by: javax.validation.ValidationException: HV000183: Unable to load 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
      	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<clinit>(ResourceBundleMessageInterpolator.java:40)
      	... 36 more
      

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: