App Engine: jar in WEB-INF/lib but still getting java.lang.ClassNotFoundException

谁说胖子不能爱 提交于 2019-12-24 01:25:15

问题


During my App Engine application's runtime, I receive the following exception:

java.lang.ExceptionInInitializerError
at
org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(ResourceBundleMessageInterpolator.java:227)

... (removed for brevity)

Caused by: java.lang.ClassNotFoundException: de.odysseus.el.ExpressionFactoryImpl

I had seen this error on my dev server and fixed it by including juel-impl in my pom.xml

When I use appcfg.sh to pull my application from the server, I see that it has juel-impl-2.2.7-20130801.163115-1.jar included in the WEB-INF/lib

I'm really not sure what to make of this.


回答1:


Update: According to the GAE issue tracker, this has been fixed in version 1.9.7. For earlier versions, see below.


Hibernate Validator 5.x makes use of the Unified Expression Language. In particular, it uses a static API method that looks up an implementation of ExpressionFactory. A bug in App Engine 1.9.4 and earlier, however, seems to prevent the use of any expression factory implementation in production only.

Until this is fixed, there are two workarounds:

  1. If you don't need the Bean Validation 1.1 features, fall back to Hibernate Validator 4.3.1.Final. I have successfully tested this.

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.3.1.Final</version>
    </dependency>
    
  2. If you need Bean Validation 1.1, there have been reports to make this work with a repository snapshot of Apache BVal. I haven't tested this.


Update note: Specifying the expression language implementation as stated in my earlier response (Glassfish EL or JUEL) works fine in development and also in certain production use cases, but will still fail for some validations.




回答2:


I had the same problem. It helped to use hibernate-validator 4.3.1.Final instead of 5.0.1.Final. Ref: stackoverflow (avidD-s answer)



来源:https://stackoverflow.com/questions/19216495/app-engine-jar-in-web-inf-lib-but-still-getting-java-lang-classnotfoundexceptio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!