diff --git a/engine/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java b/engine/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java index b7164aa1a8..3994fc5848 100644 --- a/engine/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java +++ b/engine/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java @@ -38,6 +38,7 @@ * @author Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI * @author Adam Stawicki * @author Guillaume Smet + * @author Yanming Zhou */ public class ResourceBundleMessageInterpolator extends AbstractMessageInterpolator { @@ -200,11 +201,16 @@ private static ExpressionFactory buildExpressionFactory() { // Finally we try the CL of the EL implementation itself. This is necessary for OSGi now that the // implementation is separated from the API. - run( SetContextClassLoader.action( ExpressionFactoryImpl.class.getClassLoader() ) ); - if ( canLoadExpressionFactory() ) { - ExpressionFactory expressionFactory = ELManager.getExpressionFactory(); - LOG.debug( "Loaded expression factory via com.sun.el classloader" ); - return expressionFactory; + try { + run( SetContextClassLoader.action( ExpressionFactoryImpl.class.getClassLoader() ) ); + if ( canLoadExpressionFactory() ) { + ExpressionFactory expressionFactory = ELManager.getExpressionFactory(); + LOG.debug( "Loaded expression factory via com.sun.el classloader" ); + return expressionFactory; + } + } + catch (NoClassDefFoundError err) { + // ignore } } catch (Throwable e) {