ensure TCCL is preferred over bval loader (OSGi+EE)
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java
index 20ac2f8..aac4824 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java
@@ -411,14 +411,20 @@
private BootstrapConfiguration createBootstrapConfiguration() {
try {
if (!ignoreXmlConfiguration) {
- loader = ValidationParser.class.getClassLoader();
+ loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = ValidationParser.class.getClassLoader();
+ }
final BootstrapConfiguration xmlBootstrap =
ValidationParser.processValidationConfig(getProperties().get(Properties.VALIDATION_XML_PATH), this);
if (xmlBootstrap != null) {
return xmlBootstrap;
}
}
- loader = ApacheValidatorFactory.class.getClassLoader();
+ loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = ApacheValidatorFactory.class.getClassLoader();
+ }
return BootstrapConfigurationImpl.DEFAULT;
} finally {
participantFactory = new ParticipantFactory(loader);