Issue 5: Hibernate Validator
Status:  Accepted
Owner:
Project Member Reported by antti.le...@foyt.fi, Feb 16, 2012
What steps will reproduce the problem?
1. Added Hibernate Validator jars into project
2. Added some validation annotation to at least one of the entity properties 
3. Deploy to AppEngine and try to initialize Hibenate

Application throws exception with following stack trace:

java.lang.IllegalAccessException: Class com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1 can not access a member of class org.hibernate.cfg.beanvalidation.TypeSafeActivator with modifiers "public static"
	at com.google.appengine.runtime.Request.process-54f2a838834d47ae(Request.java)
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95)
	at java.lang.reflect.Method.invoke(Method.java:43)
	at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
	at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
	at fi.foyt.fni.cloud.utils.hibernate.HibernateUtils.<clinit>(HibernateUtils.java:31)
	at fi.foyt.fni.cloud.ServletCtxListener.<clinit>(ServletCtxListener.java:47)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at java.lang.Class.newInstance0(Class.java:372)
	at java.lang.Class.newInstance(Class.java:325)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.newListenerInstance(WebXmlConfiguration.java:650)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:631)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:368)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
	at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:449)
	at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:455)
	at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:333)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:325)
	at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:453)
Feb 16, 2012
Project Member #1 antti.le...@foyt.fi
Issue seems to be related to following App Engine issue https://code.google.com/p/googleappengine/issues/detail?id=6593
Jun 24, 2012
Project Member #2 ronish.c...@gmail.com
Got the same issue - exactly the same trace.

For me Everything works fine with GAE Eclipse plugin, but java.lang.IllegalAccessException: is thrown when 
I deploy it in the GAE production server.


Jul 17, 2012
#4 sunita.m...@gmail.com
I am also facing the same issue. Please let me know if any of you were able to find some solution to it.
Nov 2, 2012
#5 larry...@gmail.com
I'm also facing same problem and its very frustrating. Has anyone found a solution for this?
Any help is appreciated.
Dec 11, 2012
#6 l...@google.com
might have a solution for 1.7.5
Feb 22, 2013
#7 david.to...@gmail.com
I found a workaround disabling validation and some configuration
Include those lines to hibernate.cfg.xml:
     	<property name="javax.persistence.validation.mode">none</property>
     	<property name="hibernate.validator.apply_to_ddl">false</property>
        <property name="hibernate.validator.autoregister_listeners">false</property>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>

Tested with:
- GAE 1.7.5 
- GWT 2.5.0
- Hibernate 4.1.4
- Driver JDBC com.google.appengine.api.rdbms.AppEngineDriver
- Connect thru internal hibernate pooling system with pool size = 0 (test)
- Dialect org.hibernate.dialect.MySQL5InnoDBDialect


Jun 3, 2013
#8 l...@google.com
This issue was fixed in a recent App Engine version (1.7.7 and after). Please retry with the latest app engine version
Jul 23, 2013
#9 etay5995...@gmail.com
This issue appears to have popped up again. I recently received the same error using AppEngine 1.8.2 and Hibernate Validator 5.0.1 Final. 
Aug 6, 2013
#10 byorn.de...@gmail.com
Please fix this issue!
Aug 6, 2013
#11 byorn.de...@gmail.com
In GAE 1.8.2 I added the following, 

<property name="javax.persistence.validation.mode">none</property>
     	<property name="hibernate.validator.apply_to_ddl">false</property>
        <property name="hibernate.validator.autoregister_listeners">false</property>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>

it connected to database but in my sql it refers to an non existing column

select user0_.id as id1_2_, user0_.email as email2_2_, user0_.firstname as firstnam3_2_, user0_.jdoDetachedState as jdoDetac4_2_, user0_.lastname as lastname5_2_, user0_.password as password6_2_, user0_.username as username7_2_, user0_.version as version8_2_ from tt_user user0_


see: jdoDetachedState ,  

I think GAE is interfering


Aug 6, 2013
#12 byorn.de...@gmail.com
To get rid of jdoDetachedState state in eclipse, right click project properties , google app engine, and uncheck jpd/jdo.  All is well! huray!
Dec 4, 2013
#13 rix3.e...@gmail.com
I also encountered this error. I tried 1.7.7 and later versions to no avail.
Dec 5, 2013
#14 l...@google.com
Can you attach a small reproducible web app?
Which version did you use? 1.8.8?
Dec 17, 2013
#15 sjepsenm...@gmail.com
Also tried 1.7.7 to 1.8.8 version, and experience the same problem.

Dec 19, 2013
#16 etay5995...@gmail.com
Am I dreaming or did any actual Google employee post a response in an attempt to help resolve an issue?

If so, perhaps you could also take a look at https://code.google.com/p/googleappengine/issues/detail?id=9634, which may shed some light on this issue.
Dec 19, 2013
#17 l...@google.com
Sure, we will and we are looking at the issues.
Dec 19, 2013
#18 etay5995...@gmail.com
I've got to take this rare opportunity to correspond with a Google employee and ask about another heavily starred, nearly 4 year old issue: https://code.google.com/p/googleappengine/issues/detail?id=3091

Can we please just get a straight answer on this issue. Is there anyone actively working on it? At some point a Google employee chimed in about certain requested features being developed for the Backends service, but there is no mention regarding those features without the use of Backends. 

There are currently around 360 people following this issue so I would hope that it has enough of a following to at least warrant periodic updates...
Jan 14, 2014
#19 etay5995...@gmail.com
Here we go again, someone from Google chimes in like they are actually going to try and resolve an issue and then disappears back into oblivion. I guess the standard operating procedure is to once a year post one vague reply like "we are looking into it" and then move on, rather than getting the AppEngine Java SDK up to spec. If this was related to AdWords im pretty sure it would have been resolved by now. 
Jan 29, 2014
#20 kchobant...@gmail.com
I have opened a new issue that points where the problem is and what is the solution

https://code.google.com/p/googleappengine/issues/detail?id=10539