javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml.

Hibernate JIRA | Jan Martiška | 1 year ago
  1. 0

    HV can't read validation.xml on IBM JDK, causing a failure during creation of a {{ValidatorFactory}} - the failure: {noformat} Exception in thread "main" javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml. at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:112) at org.hibernate.validator.internal.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:79) at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287) at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214) at org.jboss.as.ee.beanvalidation.TestingApp.main(TestingApp.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:495) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Caused by: java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:181) at java.io.BufferedInputStream.reset(BufferedInputStream.java:457) at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:109) ... 10 more {noformat} It looks like this is because {{XmlParserHelper}} (line 109) calls {{reset()}} on a {{xmlInputStream}} which was used for creating a {{XMLEventReader}} earlier - and for some reason, IBM JDK behaves in a way that it closes the input stream when creating a {{XMLEventReader}} out of it. So calling {{reset()}} ends with an {{IOException}}. How to reproduce - have any validation.xml on the classpath and run this code on IBM JDK: {noformat} ValidatorFactory factory = Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory(); {noformat}

    Hibernate JIRA | 1 year ago | Jan Martiška
    javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml.
  2. 0

    HV can't read validation.xml on IBM JDK, causing a failure during creation of a {{ValidatorFactory}} - the failure: {noformat} Exception in thread "main" javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml. at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:112) at org.hibernate.validator.internal.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:79) at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287) at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214) at org.jboss.as.ee.beanvalidation.TestingApp.main(TestingApp.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:495) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Caused by: java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:181) at java.io.BufferedInputStream.reset(BufferedInputStream.java:457) at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:109) ... 10 more {noformat} It looks like this is because {{XmlParserHelper}} (line 109) calls {{reset()}} on a {{xmlInputStream}} which was used for creating a {{XMLEventReader}} earlier - and for some reason, IBM JDK behaves in a way that it closes the input stream when creating a {{XMLEventReader}} out of it. So calling {{reset()}} ends with an {{IOException}}. How to reproduce - have any validation.xml on the classpath and run this code on IBM JDK: {noformat} ValidatorFactory factory = Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory(); {noformat}

    Hibernate JIRA | 1 year ago | Jan Martiška
    javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml.
  3. 0

    Attach the uploaded file as an email

    Stack Overflow | 4 years ago | user525146
    java.io.IOException: Stream closed
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Validate AND read with the same inputstream

    Stack Overflow | 3 years ago
    java.io.IOException: Stream closed
  6. 0

    Converting to Java - Java & XML Data Binding [Book]

    safaribooksonline.com | 3 months ago
    java.io.IOException: Stream closed

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      Stream closed

      at java.io.BufferedInputStream.getBufIfOpen()
    2. Java RT
      BufferedInputStream.reset
      1. java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:181)
      2. java.io.BufferedInputStream.reset(BufferedInputStream.java:457)
      2 frames
    3. Hibernate Validator Engine
      ConfigurationImpl.buildValidatorFactory
      1. org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:109)
      2. org.hibernate.validator.internal.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:79)
      3. org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287)
      4. org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361)
      5. org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214)
      5 frames
    4. JBoss Application Server: EE
      TestingApp.main
      1. org.jboss.as.ee.beanvalidation.TestingApp.main(TestingApp.java:25)
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      4. java.lang.reflect.Method.invoke(Method.java:495)
      4 frames
    6. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
      1 frame