We're updating the issue view to help you get more done. 

Avoid accessing package javax.xml.stream.* when not working with XML descriptors

Description

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:

1 2 3 4 5 6 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)

Java setup:

1 2 3 4 5 6 7 8 9 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();

Gradle setup:

1 2 3 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'

Environment

None

Status

Assignee

Gunnar Morling

Reporter

SD

Components

Fix versions

Priority

Major