Running Data Nucleus JDO 3.0.x with Google Cloud SQL

951 views
Skip to first unread message

J N

unread,
Oct 23, 2011, 5:11:47 PM10/23/11
to Google Cloud SQL discuss
Hi
I am trying to figure out how to run Data Nucleus with Google Cloud
SQL. I am running into trouble due to class conflicts with the built
in app-engine JDO (which also uses data nucleus for persistence to the
google data store.

Has anyone of you tried this. I am hoping that there is a way to make
this work. If you have worked on this I will appreciate it very much
if you share your experience. A working example would obviously be the
best thing :-) Thanks in advance.

Regards

Study

unread,
Oct 26, 2011, 12:27:02 PM10/26/11
to Google Cloud SQL discuss
You can try my jdoconfig.xml

it works with built-in GAE JDO without using newer version JDO

<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/
jdoconfig">

<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.jdo.JDOPersistenceManagerFactory"/>
<property name="javax.jdo.option.ConnectionDriverName"
value="com.google.appengine.api.rdbms.AppEngineDriver"/>
<property name="javax.jdo.option.ConnectionURL"
value="jdbc:google:rdbms://instance_name/database_name"/>
<property name="javax.jdo.option.NontransactionalRead"
value="true"/>
<property name="javax.jdo.option.NontransactionalWrite"
value="true"/>
<property name="javax.jdo.option.RetainValues" value="true"/>

<property name="datanucleus.metadata.validate" value="false"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="false"/>
<property name="datanucleus.validateConstraints" value="false"/
>
<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="true"/>
</persistence-manager-factory>
</jdoconfig>

dt

unread,
Dec 7, 2011, 12:55:43 PM12/7/11
to google-cloud...@googlegroups.com
thank you so much.  This is exactly what i've been looking for.  It would be nice if they post this on the Cloud sql's main page.

Christoph

unread,
Mar 2, 2012, 9:51:03 AM3/2/12
to google-cloud...@googlegroups.com
Dear Study,

thank you for posting your jdoconfig.xml. However I run into the problem that the code doesn't run on Google App Engine. It creates the following error message:

Caused by: javax.jdo.JDOFatalUserException: No available StoreManager found for the datastore URL key "jdbc". Please make sure you have all relevant plugins in the CLASSPATH (e.g datanucleus-rdbms?, datanucleus-db4o?), and consider setting the persistence property "datanucleus.storeManagerType" to the type of store you are using e.g rdbms, db4o
NestedThrowables:
org.datanucleus.exceptions.NucleusUserException: No available StoreManager found for the datastore URL key "jdbc". Please make sure you have all relevant plugins in the CLASSPATH (e.g datanucleus-rdbms?, datanucleus-db4o?), and consider setting the persistence property "datanucleus.storeManagerType" to the type of store you are using e.g rdbms, db4o

However directly accessing the database via JDBC and SQL works!

So it seems that something for datanucleus is missing within the app engine libraries. I added no special libraries and used version 1.6.3.

Thank you very much for your help in advance.

Christoph

Feliks Khantsis

unread,
Mar 26, 2012, 11:50:27 AM3/26/12
to google-cloud...@googlegroups.com
Yes, you must download datanucleus access platform 1.1.5 rdbms, and add the datanucleus-rdbms-1.1.5.jar to your classpath 

Alan

unread,
Apr 24, 2012, 1:09:15 PM4/24/12
to Google Cloud SQL discuss
Thanks to this Thread, I am successfully using DataNucleus JDO with
Google Cloud.

I am having one problem:

If I try to use SQL directly for a query:
Query query = pm.newQuery("javax.jdo.query.SQL", querySQL);

DataNucleus tries to spawn a Thread to execute the query.

Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
323)
at
java.security.AccessController.checkPermission(AccessController.java:
546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:
532)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkPermission(DevAppServerFactory.java:252)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkAccess(DevAppServerFactory.java:277)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:299)
at java.lang.Thread.init(Thread.java:332)
at java.lang.Thread.<init>(Thread.java:391)
at org.datanucleus.store.query.Query.performExecuteTask(Query.java:
1669)
at
org.datanucleus.store.rdbms.query.SQLQuery.performExecute(SQLQuery.java:
259)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at
org.datanucleus.store.query.AbstractSQLQuery.executeWithArray(AbstractSQLQuery.java:
287)
at org.datanucleus.store.query.Query.execute(Query.java:1344)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)


This is not a problem with the default JDOQL queries.

Anyone have a solution for this? I have one query that I need to use
mysql SQL with that won't work with JDOQL.

Rob Clevenger

unread,
May 22, 2012, 10:39:14 PM5/22/12
to google-cloud...@googlegroups.com
That's odd, I wonder if there's a flag or setting to disable using a new thread for this...

Rob

Alan

unread,
May 23, 2012, 10:27:13 AM5/23/12
to Google Cloud SQL discuss
Well, I've searched high and low for such a flag and haven't found
it.

I've managed to convert all my queries to JDOQL, but there is one that
I would still like to use SQL, as there is some optimization that I
can't seem to accomplish with JDOQL.
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages