Reputation: 73
I'm trying to use Hibernate JPA with Google AppEngine to talk to my Google Cloud SQL instance. I'm seeing the following exception in the appengine logs when creating the entity manager factory for persisting my data:
javax.persistence.PersistenceException: Unable to build entity manager factory
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
...
com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:724)
**Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")**
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:375)
at java.security.AccessController.checkPermission(AccessController.java:565)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermission(CustomSecurityManager.java:56)
at com.google.apphosting.runtime.security.CustomSecurityManager.checkAccess(CustomSecurityManager.java:131)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
at java.lang.Thread.init(Thread.java:378)
at java.lang.Thread.<init>(Thread.java:654)
at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:572)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:591)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:922)
...
I followed the https://developers.google.com/appengine/articles/using_hibernate in creating my persistence.xml and code, but still I get the RunTimeException for modifyThreadGroup. I'm using Hibernate 4.3.1.Final. Does anyone know how to fix this ? I looked at the existing solutions for modifyThreadGroup exception but those don't apply to me because I'm not running locally, I'm running on the GAE instances so I can't uncheck "use GAE" in the eclipse project.
Upvotes: 2
Views: 446
Reputation: 1602
I run today in the same problem and I found another question with a answer that worked for me. According to this answer you have to use the 4.2.0.Final version of Hibernate, because in newer versions the DriverManagerConnectionProvider tries to create new threads.
Upvotes: 1