如何在Google App Engine中创建javax.el.E​​xpressionFactory以使用Hibernate Validator [英] How to create javax.el.ExpressionFactory in Google App Engine to use Hibernate Validator

查看:53
本文介绍了如何在Google App Engine中创建javax.el.E​​xpressionFactory以使用Hibernate Validator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的Google App Engine应用程序上升级到休眠验证器版本6,该版本

I'm trying to upgrade to hibernate validator version 6 on my Google App Engine app, which needs javax.el, so I added org.glassfish:javax.el:jar:3.0.1-b10 to my dependencies.

但是,这是不使用的:

在本地开发环境中,我可以使用ExpressionFactory.newInstance()创建一个新的ExpressionFactory. ExpressionFactory来自本地Jetty安装jetty93/jetty-distribution/lib/apache-jsp/org.mortbay.jasper.apache-el-8.0.33.jar,它从同一jar返回实现org.apache.el.ExpressionFactoryImpl.

In the local dev environment, I can create a new ExpressionFactory with ExpressionFactory.newInstance(). The ExpressionFactory is from the local Jetty installation jetty93/jetty-distribution/lib/apache-jsp/org.mortbay.jasper.apache-el-8.0.33.jar and it returns the implementation org.apache.el.ExpressionFactoryImpl from the same jar.

在已部署的GAE环境中,ExpressionFactory来自java8_runtime/runtime-shared.jar!/javax/el/ExpressionFactory.class,但是ExpressionFactory.newInstance()仍然尝试获取org.apache.el.ExpressionFactoryImpl,即使存在com.sun.el.ExpressionFactoryImpl.

In the deployed GAE environment, the ExpressionFactory is from java8_runtime/runtime-shared.jar!/javax/el/ExpressionFactory.class but ExpressionFactory.newInstance() still tries to get a org.apache.el.ExpressionFactoryImpl, even though com.sun.el.ExpressionFactoryImpl is present.

在两种环境中,我都可以从WEB-INF/lib/javax.el-3.0.1-b10.jar手动加载com.sun.el.ExpressionFactoryImpl,因此它出现在类路径中:

In both environments, I can manually load a com.sun.el.ExpressionFactoryImpl from WEB-INF/lib/javax.el-3.0.1-b10.jar, so it is present in the classpath:

final Constructor<ExpressionFactoryImpl> constructor = com.sun.el.ExpressionFactoryImpl.class.getConstructor();
final ExpressionFactoryImpl expressionFactory = constructor.newInstance();

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆