java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory;

Hibernate JIRA | Sam Duke | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    As {{XmlParserHelper}} is always loaded, also if actually there is no XML configuration, a {{NoClassDefFoundError}} is raised on Android, which does not have the {{javax.xml.stream.*}} package. Stacktrace: {code} 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory; 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.XmlParserHelper.<init>(XmlParserHelper.java:66) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.ValidationXmlParser.<init>(ValidationXmlParser.java:60) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214) {code} Java setup: {code} validator = Validation.byProvider(HibernateValidator.class).providerResolver(new ValidationProviderResolver() { @Override public List<ValidationProvider<?>> getValidationProviders() { List<ValidationProvider<?>> list = new ArrayList<ValidationProvider<?>>(); list.add(new HibernateValidator()); return list; } }).configure().buildValidatorFactory().getValidator(); {code} Gradle setup: {code} compile 'org.hibernate:hibernate-validator:5.1.3.Final' compile 'javax.el:javax.el-api:2.2.4' compile 'org.glassfish.web:javax.el:2.2.4' {code}

    Hibernate JIRA | 2 years ago | Sam Duke
    java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory;
  2. 0

    As {{XmlParserHelper}} is always loaded, also if actually there is no XML configuration, a {{NoClassDefFoundError}} is raised on Android, which does not have the {{javax.xml.stream.*}} package. Stacktrace: {code} 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory; 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.XmlParserHelper.<init>(XmlParserHelper.java:66) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.xml.ValidationXmlParser.<init>(ValidationXmlParser.java:60) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361) 02-19 12:19:40.202 6120-6120/com.myapp W/System.err﹕ at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214) {code} Java setup: {code} validator = Validation.byProvider(HibernateValidator.class).providerResolver(new ValidationProviderResolver() { @Override public List<ValidationProvider<?>> getValidationProviders() { List<ValidationProvider<?>> list = new ArrayList<ValidationProvider<?>>(); list.add(new HibernateValidator()); return list; } }).configure().buildValidatorFactory().getValidator(); {code} Gradle setup: {code} compile 'org.hibernate:hibernate-validator:5.1.3.Final' compile 'javax.el:javax.el-api:2.2.4' compile 'org.glassfish.web:javax.el:2.2.4' {code}

    Hibernate JIRA | 2 years ago | Sam Duke
    java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory;

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError

      Failed resolution of: Ljavax/xml/stream/XMLInputFactory;

      at org.hibernate.validator.internal.xml.XmlParserHelper.<init>()
    2. Hibernate Validator Engine
      ConfigurationImpl.buildValidatorFactory
      1. org.hibernate.validator.internal.xml.XmlParserHelper.<init>(XmlParserHelper.java:66)
      2. org.hibernate.validator.internal.xml.ValidationXmlParser.<init>(ValidationXmlParser.java:60)
      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