How to test my application with local database

2,450 views
Skip to first unread message

mobject

unread,
Jan 2, 2010, 3:04:34 AM1/2/10
to Google App Engine
Hello,

I would like to test my app with local db before deploying to
APPEngine but I could not config my jdo to connect to my local Mysql
database.

Could anyone help me on this ?

Thank you in advance,

mobject

Nickolas Daskalou

unread,
Jan 3, 2010, 4:01:04 AM1/3/10
to Google App Engine
You can't use MySQL or any other traditional RDBMS with App Engine,
you'll need to use Google's Datastore:

http://code.google.com/appengine/docs/java/datastore/

David Sowerby

unread,
Jan 3, 2010, 4:26:07 AM1/3/10
to Google App Engine
You may also find this useful, it describes setting up a datastore
test environment

http://code.google.com/appengine/docs/java/howto/unittesting.html

Ian Marshall

unread,
Jan 4, 2010, 8:56:50 AM1/4/10
to Google App Engine
Hi mobject,

I use MySQL for developer testing when running my app on a development
web server before unleashing it onto my GAE developer web server
(using BigTable)!

I give you the contents of my "jdoconfig.xml" file below. You will be
able to see that I have two persistence manager factory names; I use
one for GAE (dev server and production) and the other for my local
MySQL dev testing.

One warning though: I have found that JDO behaviour differs when using
MySQL and BigTable. So until it works on BigTable, it doesn't
necessarily work!

Enjoy,

Ian

jdoconfig.xml
-------------
<?xml version="1.0" encoding="UTF-8"?>
<jdoconfig>
<persistence-manager-factory name="big-table">
<property
name="javax.jdo.PersistenceManagerFactoryClass"

value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"
/>

<property name="javax.jdo.option.ConnectionURL" value="appengine"/
>

<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="true"/>
<property name="datanucleus.autoStartMechanism" value="None"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="true"/>
<property name="datanucleus.validateConstraints" value="true"/>
<property name="datanucleus.validateColumns" value="true"/>
<!--<property name="datanucleus.persistenceByReachabilityAtCommit"
value="false"/>-->
<property name="datanucleus.DetachAllOnCommit" value="true"/>
<!--<property name="datanucleus.detachAsWrapped" value="true"/>-->

<!-- The default value is 1 -->
<property name="datanucleus.maxFetchDepth" value="1"/>

<!-- The default value is "JDO2" -->
<!--<property name="datanucleus.deletionPolicy" value="DataNucleus"/>--
>
</persistence-manager-factory>

<persistence-manager-factory name="mysql">
<property
name="javax.jdo.PersistenceManagerFactoryClass"

value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"
/>

<!-- Settings for connection to a local MySQL database -->
<property
name="datanucleus.ConnectionDriverName"
value="com.mysql.jdbc.Driver"
/>
<property
name="datanucleus.ConnectionURL"
value="jdbc:mysql://localhost:3306/[...]"
/>
<property name="datanucleus.ConnectionUserName" value="[...]"/>
<property name="datanucleus.ConnectionPassword" value="[...]"/>

<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="true"/>
<property name="datanucleus.autoStartMechanism" value="None"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="true"/>
<property name="datanucleus.validateConstraints" value="true"/>
<property name="datanucleus.validateColumns" value="true"/>
<!--<property name="datanucleus.persistenceByReachabilityAtCommit"
value="false"/>-->
<property name="datanucleus.DetachAllOnCommit" value="true"/>
<!--<property name="datanucleus.detachAsWrapped" value="true"/>-->

<!-- The default value is 1 -->
<property name="datanucleus.maxFetchDepth" value="1"/>

<!-- The default value is "JDO2" -->
<!--<property name="datanucleus.deletionPolicy" value="DataNucleus"/>--
>

<!--
<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.autoCreateTables" value="true"/>
<property name="datanucleus.autoCreateColumns" value="true"/>
<property name="datanucleus.autoCreateConstraints" value="true"/>

<property name="datanucleus.cache.collections.lazy" value="true"/>
<property name="datanucleus.RetainValues" value="true"/>
-->
</persistence-manager-factory>
</jdoconfig>

Minh Tran

unread,
Jan 3, 2010, 4:54:19 AM1/3/10
to google-a...@googlegroups.com
Yes, thank you all.

mobject

--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.





--
MObject mobject = new MObject("Minh Tran");

ivanceras

unread,
Jan 11, 2010, 5:32:20 AM1/11/10
to Google App Engine
BTW, I forgot the error log:

Here is it:

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
at
org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException
(NucleusJDOHelper.java:354)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration
(JDOPersistenceManagerFactory.java:544)
at
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory.getPersistenceManagerFactory
(DatastoreJDOPersistenceManagerFactory.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke
(Runtime.java:100)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
(JDOHelper.java:1159)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
803)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
1086)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
914)
at com.ivanceras.server.PMF.<clinit>(PMF.java:9)
... 37 more
Caused by: 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
at org.datanucleus.store.FederationManager.initialiseStoreManager
(FederationManager.java:197)
at org.datanucleus.store.FederationManager.<init>
(FederationManager.java:70)
at org.datanucleus.ObjectManagerFactoryImpl.initialiseStoreManager
(ObjectManagerFactoryImpl.java:153)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration
(JDOPersistenceManagerFactory.java:526)
... 51 more

Have you confgured yours successfully?. I tried also postgresql but
still similar error continually emerge.

Regards,
ivanceras

ivanceras

unread,
Jan 11, 2010, 5:30:04 AM1/11/10
to Google App Engine
Hi!,

I tried configuring my jdoconfig.xml but always with an error.

Here is my configuration

<persistence-manager-factory name="mysql">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/
>

<property name="datanucleus.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>

<property name="datanucleus.ConnectionURL" value="jdbc://mysql://
localhost:3306/jdo"/>
<property name="datanucleus.ConnectionUserName" value="jdo"/>
<property name="datanucleus.ConnectionPassword" value="jdo"/>


<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="true"/>
<property name="datanucleus.autoStartMechanism" value="None"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="true"/>
<property name="datanucleus.validateConstraints" value="true"/>
<property name="datanucleus.validateColumns" value="true"/>

<property name="datanucleus.DetachAllOnCommit" value="true"/>

<property name="datanucleus.maxFetchDepth" value="1"/>

<property name="datanucleus.storeManagerType" value="rdbms"/>
</persistence-manager-factory>

I appreciate if you could help me on this.
Thanks,

On Jan 4, 9:56 pm, Ian Marshall <ianmarshall...@gmail.com> wrote:

Ian Marshall

unread,
Jan 11, 2010, 1:54:52 PM1/11/10
to Google App Engine
Hello ivanceras,


YOUR PROPERTY "datanucleus.ConnectionURL"
-----------------------------------------
I do not know what your dev environment is. I use NetBeans; this has a
connection set up to use my local MySQL database. I noticed an extra
"//" between the "jdbc:" and "mysql" parts of your connection URL. But
you might need this for your environment. You might want to verify
your value for this property.


YOUR PROPERTY "datanucleus.storeManagerType"
--------------------------------------------
I personally do not use this property. As you will probably know, the
relevant DataNucleus documentation describes this property as:

'Type of the StoreManager to use for this PMF/EMF. This has typical
values of "rdbms", "db4o". If it isn't specified then it falls back to
trying to find the StoreManager from the connection URL. The
associated DataNucleus plugin has to be in the CLASSPATH when
selecting this. When using data sources (as usually done in a JavaEE
container), DataNucleus cannot find out the correct type automatically
and this option must be set.'

I assume that your set-up requires this property (otherwise I would
suggest omitting it as I do). All I can suggest here is to verify that
you have the relevant DataNucleus plug-in and that it can be found
from your class path. I do not speak from experience about this
property since I have never used it.

Don't make the mistake I have made: ensure that you use the same
DataNucleus plug-in version number as is used by the version of GAE
that you use!


Cheers,

Ian

ivanceras

unread,
Jan 11, 2010, 10:22:05 PM1/11/10
to Google App Engine
Hello ian,

Thanks for your reply.

BTW, im using eclipse 3.5 (Galileo) and had just configured the
datasource for mysql successfully.
I edited my configuration like this(commented out storeManagerType)
and the connectionURL:
I had also replaced the datanucleus jars with version 1.1.5 as its the
version GAE uses.
I used Mysql server 5.1.

<persistence-manager-factory name="mysql">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/
>
<property name="datanucleus.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>

<property name="datanucleus.ConnectionURL" value="jdbc:mysql://
localhost:3306/jdo"/>
<property name="datanucleus.ConnectionUserName" value="root"/>
<property name="datanucleus.ConnectionPassword" value="[*****]"/>


<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="true"/>
<property name="datanucleus.autoStartMechanism" value="None"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="true"/>
<property name="datanucleus.validateConstraints" value="true"/>
<property name="datanucleus.validateColumns" value="true"/>
<property name="datanucleus.DetachAllOnCommit" value="true"/>
<property name="datanucleus.maxFetchDepth" value="1"/>

<!-- <property name="datanucleus.storeManagerType" value="rdbms"/>
-->
</persistence-manager-factory>

But still the error persist.
Here is the error logs:

Caused by: 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
at org.datanucleus.store.FederationManager.initialiseStoreManager
(FederationManager.java:197)
at org.datanucleus.store.FederationManager.<init>
(FederationManager.java:70)
at org.datanucleus.ObjectManagerFactoryImpl.initialiseStoreManager
(ObjectManagerFactoryImpl.java:153)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration
(JDOPersistenceManagerFactory.java:526)
... 51 more

Here is my PMF.java class. I guess there are still more configurations
to make. I created the database jdo. I guess there will be no need to
create a table?

public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("mysql");
//JDOHelper.getPersistenceManagerFactory("postgresql");
//JDOHelper.getPersistenceManagerFactory("transactions-
optional");

private PMF() {}

public static PersistenceManagerFactory get() {
return pmfInstance;
}
}


Hope someone could help me with this.

Thanks,
ivanceras

Ian Marshall

unread,
Jan 12, 2010, 5:15:19 AM1/12/10
to Google App Engine
Exception
---------
I searched for "NucleusUserException: No available StoreManager found
for the datastore URL key" on Google. The first search result finishes
with the entry:

'Problem Solved!

In eclipse, package explorer -> [project]->war->web-inf->lib

click right mouse button and import all relevant library.

It will work!'


I haven't used Eclipse for years, so this might work(?). I think the
fundamental problem may be with your ".jar" files and the fact that
your IDE cannot find them at run-time. For NetBeans I have added the
following sets of files to my app's set of libraries:

datanucleus-rdbms-1.1.5.jar
mysql-connector-java-5.1.10-bin.jar
[Many other datanucleus-*.jar files incl. datanucleus-
appengine-1.0.4.1.final.jar]
jdo2-api-2.3-eb.jar
[others]

Otherwise, I cannot think of anything.


I guess there will be no need to create a table?

------------------------------------------------
With my settings, all the (enhanced!) tables are constructed for me at
first-connection-time if they do not exist already.


Cheers,

Ian

ivanceras

unread,
Jan 13, 2010, 6:20:02 AM1/13/10
to Google App Engine
Hi ian,

I followed your suggestion to put the librarries in war/ WEF-INF/lib
since before I had it only referenced in the classpath but located
somewhere in the filesystem.

I then run my application with that set-up. Thank you for that. At
least im having a progress here.
However another error arises, this time I am sure it already reaches
to the mysql driver classes already.

Here is the error logs:

Caused by: javax.jdo.JDOFatalInternalException: Unexpected exception
caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
(JDOHelper.java:1186)


at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
803)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
1086)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
914)

at com.ivanceras.server.PMF.<clinit>(PMF.java:8)
... 37 more
Caused by: java.lang.reflect.InvocationTargetException


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke
(Runtime.java:100)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
(JDOHelper.java:1159)

... 41 more
Caused by: java.lang.ExceptionInInitializerError
at com.mysql.jdbc.NonRegisteringDriver.connect
(NonRegisteringDriver.java:284)
at
org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection
(DriverManagerDataSource.java:142)
at
org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection
(DriverManagerDataSource.java:118)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl
$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:539)
at org.datanucleus.store.rdbms.RDBMSManager.<init>(RDBMSManager.java:
297)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_
(Runtime.java:112)
at
com.google.appengine.tools.development.agent.runtime.Runtime.newInstance
(Runtime.java:120)
at
org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension
(NonManagedPluginRegistry.java:572)
at org.datanucleus.plugin.PluginManager.createExecutableExtension
(PluginManager.java:300)
at org.datanucleus.store.FederationManager.initialiseStoreManager
(FederationManager.java:108)


at org.datanucleus.store.FederationManager.<init>
(FederationManager.java:70)
at org.datanucleus.ObjectManagerFactoryImpl.initialiseStoreManager
(ObjectManagerFactoryImpl.java:153)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration
(JDOPersistenceManagerFactory.java:526)

at
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory.getPersistenceManagerFactory
(DatastoreJDOPersistenceManagerFactory.java:127)
... 50 more
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkPermission(DevAppServerFactory.java:151)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkAccess(DevAppServerFactory.java:176)
at java.lang.ThreadGroup.checkAccess(Unknown Source)
at java.lang.Thread.init(Unknown Source)
at java.lang.Thread.<init>(Unknown Source)
at java.util.TimerThread.<init>(Unknown Source)
at java.util.Timer.<init>(Unknown Source)
at java.util.Timer.<init>(Unknown Source)
at com.mysql.jdbc.ConnectionImpl.<clinit>(ConnectionImpl.java:258)
... 68 more


I also struggled testing it against the other database (Postgresql)
and an error of java.net.socket exception is spat. Due to maybe it is
not allowed in app engine white list.
Do you modify the google's appengine library to bypass this exception?
Or do we need to reorder the library? I am sure with the database urls
and credentials.

Here is the Postgresql Error log:

Caused by: javax.jdo.JDOFatalInternalException: Unexpected exception
caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
(JDOHelper.java:1186)


at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
803)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
1086)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
914)

at com.ivanceras.server.PMF.<clinit>(PMF.java:10)
... 37 more
Caused by: java.lang.reflect.InvocationTargetException


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke
(Runtime.java:100)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
(JDOHelper.java:1159)

... 41 more
Caused by: java.lang.NoClassDefFoundError: java.net.Socket is a
restricted class. Please see the Google App Engine developer's guide
for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject
(Runtime.java:51)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl
(ConnectionFactoryImpl.java:77)
at org.postgresql.core.ConnectionFactory.openConnection
(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
(AbstractJdbc2Connection.java:124)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>
(AbstractJdbc4Connection.java:29)
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:
24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
at
org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection
(DriverManagerDataSource.java:142)
at
org.datanucleus.store.rdbms.datasource.DriverManagerDataSource.getConnection
(DriverManagerDataSource.java:118)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl
$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:539)
at org.datanucleus.store.rdbms.RDBMSManager.<init>(RDBMSManager.java:
297)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_
(Runtime.java:112)
at
com.google.appengine.tools.development.agent.runtime.Runtime.newInstance
(Runtime.java:120)
at
org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension
(NonManagedPluginRegistry.java:572)
at org.datanucleus.plugin.PluginManager.createExecutableExtension
(PluginManager.java:300)
at org.datanucleus.store.FederationManager.initialiseStoreManager
(FederationManager.java:108)


at org.datanucleus.store.FederationManager.<init>
(FederationManager.java:70)
at org.datanucleus.ObjectManagerFactoryImpl.initialiseStoreManager
(ObjectManagerFactoryImpl.java:153)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration
(JDOPersistenceManagerFactory.java:526)

at
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory.getPersistenceManagerFactory
(DatastoreJDOPersistenceManagerFactory.java:127)
... 50 more


Best Regards,
ivanceras

Ian Marshall

unread,
Jan 14, 2010, 4:54:01 AM1/14/10
to Google App Engine
Hi ivanceras,


At least I'm having a progress here
-----------------------------------
Good!


Here is the Postgresql error log
--------------------------------
Sorry, I know nothing about Postgresql. I shall leave comments about
this part of your post to others.


Here is the error logs

----------------------
I think that the clue is in your own statement "Due to maybe it is not
allowed in app engine white list." Examining your stake trace, we have
the DataNucleus RDBMS making a connection with/using the MySQL Java
connector. This is fine, but Google AppEngine (GAE) code is also
involved here. It shouldn't be.

As you know, GAE will not allow use of MySQL directly as the
datastore. Somehow you are involving GAE, when I guess that instead
you want to run your web app in Eclipse whilst connecting to your
MySQL database. In that case, you cannot run this app in GAE.

When I use NetBeans, I launch my web app from within NetBeans with my
MySQL connection configured as per my "jdoconfig.xml" file using a
development Persistence Manager Factory (PMF) name. When I am ready to
run the web app from within my local GAE development server, I change
the PMF name used in my code by configuration and rebuild my app. My
builder constructs my \war folder every time, so now after building I
simply launch my GAE server (using a command in a Windows command
prompt window) whilst pointing to the correct folder. There is now no
MySQL involvement with the web app, and my datastore is now a local
BigTable database.

Am I on the right lines, and does this help you?


Conclusion
----------
If anyone out there uses Eclipse and a MySQL database for developer
testing before unleashing on a local GAE development server, I am sure
that ivanceras would welcome your contribution.


Cheers,

Ian

Ikai L (Google)

unread,
Jan 14, 2010, 2:07:33 PM1/14/10
to google-a...@googlegroups.com
Hey everyone,

I can't see this ending well. App Engine's datastore is NOT an RDBMS. It is schemaless. There are already enough differences between using the local datastore mock and the production datastore. Introducing MySQL as the local development backend is just going to introduce a lot of unnecessary risk in your project and a lot of wackiness as soon as you go into production. I'm not even sure how your indexes can be generated, or how you can catch all the hard errors that will be thrown when you work with transactions for entities not in an entity group, or indexed List properties.

I'm sure you have a good reason for wanting to do this, but the bad really outweigh the good here.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.






--
Ikai Lan
Developer Programs Engineer, Google App Engine

Ian Marshall

unread,
Jan 14, 2010, 3:55:51 PM1/14/10
to Google App Engine
Thanks for that warning, Ikai. Noted. I am aware of many of the
difference between MySQL and the GAE datastore (mock or production).
And when I see your reasons all at once, it does make me cringe at my
choice of MySQL as my local dev back-end datastore. Regular runs under
my local GAE dev server should catch most issues early (here's
hoping).

Can you think of suitable local datastores that I could use when
running my Java web app from my NetBeans IDE under Tomcat whilst
coding?

Regards,

Ian

Ikai L (Google)

unread,
Jan 15, 2010, 1:22:55 PM1/15/10
to google-a...@googlegroups.com
My recommendation is to use the datastore mock that ships with the SDK as well as the version of Jetty that ships with the SDK. This is going to be the closest thing you'll get to what's in production. You're likely looking at MySQL because the local datastore does not meet some development need of yours - I'd recommend opening an issue rather than replacing it in dev mode.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



Ian Marshall

unread,
Jan 21, 2010, 9:16:33 AM1/21/10
to Google App Engine
Thanks for that, Ikai.

I like being able to step through my code whilst debugging, but since
I cannot do that using the local datastore, I'll have to lump it and
rely on logging. (This reminds me of writing apps for embedded devices
where I couldn't step through code either.)

I won't open an issue on this since I guess that this is an obvious
limitation.

Ikai L (Google)

unread,
Jan 21, 2010, 2:00:43 PM1/21/10
to google-a...@googlegroups.com
Being able to use Java's excellent debugger is one of the selling points of Java App Engine. I'm not quite sure I understand what you mean when you say you can't do that with the datastore. Is there something preventing you from setting breakpoints, triggers, etc?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



Ian Marshall

unread,
Jan 21, 2010, 2:31:45 PM1/21/10
to Google App Engine
1. Let me know if I should continue this thread on the GAE/J group
since we're talking Java. I so, I'll open one up.

2. I launch my app during my local dev server and datastore using the
Microsoft Windows commands:

cd "\Program Files\Google\App Engine\appengine-java-
sdk-1.3.0\bin"

dev_appserver.cmd "\Documents and Settings\[path elements]
\Google App Engine\war"

where the "war" folder contains all my built deploy-ready stuff
(including my enhanced persistence classes). My IDE is NetBeans 6.7.1
(using Java). I don't think that I can run the GAE dev web server in
the NetBeans debugger, since there is no NetBeans GAE plug-in of which
I am aware - just one for Eclipse.

If I am wrong, I would be delighted to hear it!

Ikai L (Google)

unread,
Jan 21, 2010, 2:38:03 PM1/21/10
to google-a...@googlegroups.com
Hey,

1. Nope, I don't see any problem with discussing it now. We're already talking about it, so it'd be more confusing if we moved the thread to a different group.

2. There IS a Netbeans GAE plugin! It's not "officially" supported, but I've used this in the past with great success: 



With Netbeans, just "Debug" your project. This'll allow you to hot reload classes, set breakpoints, watches, etc. Netbeans, like Eclipse, supports incremental compile on save, which is amazing. In my experience, Netbeans also has an awesome HTML JavaScript editor and probably the best profiler of all the IDEs. I'm honestly surprised it's not more popular.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



ivanceras

unread,
Jan 21, 2010, 9:32:58 PM1/21/10
to Google App Engine
Hi everyone,

I've find a way from security error that app engine doesn't allow the
use of java.net.socket which is used in connection to a database by
deploying the WAR files into tomcat /webapp folder.

I think I have successfully set-up my app to use either postgresql and
mysql as my local database server. I can see that it is making a table
"NUCLEUS_TABLES" on my database, but I don't see any record written on
it.
What am I missing?

BTW, I am trying to make my application to be deployable not just on
google app engine, coz it may come that a client choose to deploy the
app in their corporate server which of course don't use "Big-Table" as
their database, and I don't want to create separate codes for the two
target platforms.
WDYT?

On Jan 22, 3:38 am, "Ikai L (Google)" <ika...@google.com> wrote:
> Hey,
>
> 1. Nope, I don't see any problem with discussing it now. We're already
> talking about it, so it'd be more confusing if we moved the thread to a
> different group.
>
> 2. There IS a Netbeans GAE plugin! It's not "officially" supported, but I've
> used this in the past with great success:
>
> http://kenai.com/projects/nbappengine/pages/Home
>

> <http://kenai.com/projects/nbappengine/pages/Home>http://rocky.developerblogs.com/tutorials/getting-started-google-app-...
>
> <http://rocky.developerblogs.com/tutorials/getting-started-google-app-...>With


> Netbeans, just "Debug" your project. This'll allow you to hot reload
> classes, set breakpoints, watches, etc. Netbeans, like Eclipse, supports
> incremental compile on save, which is amazing. In my experience, Netbeans
> also has an awesome HTML JavaScript editor and probably the best profiler of
> all the IDEs. I'm honestly surprised it's not more popular.
>

> On Thu, Jan 21, 2010 at 11:31 AM, Ian Marshall <ianmarshall...@gmail.com>wrote:
>
>
>
>
>
> > 1.  Let me know if I should continue this thread on the GAE/J group
> > since we're talking Java. I so, I'll open one up.
>
> > 2.  I launch my app during my local dev server and datastore using the
> > Microsoft Windows commands:
>
> >      cd "\Program Files\Google\App Engine\appengine-java-
> > sdk-1.3.0\bin"
>
> >      dev_appserver.cmd "\Documents and Settings\[path elements]
> > \Google App Engine\war"
>
> > where the "war" folder contains all my built deploy-ready stuff
> > (including my enhanced persistence classes). My IDE is NetBeans 6.7.1
> > (using Java). I don't think that I can run the GAE dev web server in
> > the NetBeans debugger, since there is no NetBeans GAE plug-in of which
> > I am aware - just one for Eclipse.
>
> > If I am wrong, I would be delighted to hear it!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-a...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib e...@googlegroups.com>

Ian Marshall

unread,
Jan 22, 2010, 11:59:20 AM1/22/10
to Google App Engine
IKAI
----
Thank you for letting me know about the NetBeans support for Google
App Engine on Sun's Project Kenai. I'm glad that this worked for you.
Unfortunately, I couldn't get this to work for me.

Installing the NetBeans plug-in broke my app building, and I couldn't
get the NetBeans GAE web server to run. My NetBeans project's "ant-
deploy.xml" had been automatically altered to point to my "C:\[...]
\appengine-java-sdk-1.3.0\config\user\ant-macros.xml", which needed
its "appengine.sdk.home" property amending (as one would expect since
this is an example file only). I also could not see how to amend the
plug-in's ".jar" file list, in order to stop double-jar contention
during building.

The long and short of it is is that I have now uninstalled this plug-
in, repaired most of the minor damage left after the uninstall, and
will press on debugless-on-GAE for now (dipping into debugging-with-
MySQL-and-Tomcat when needed). Oh well.

Should Google launch an official NetBeans GAE plug-in in the future, I
would welcome that!


IVANCERAS
---------
... but I don't see any record written on it. What am I missing?
----------------------------------------------------------------
I presume that you expected to make some objects persistent using JDO.
Do you have any idea which part(s) of your config or code could be
responsible?


I am trying to make my application to be deployable not just on google
app engine

---------------------------------------------------------------------------------
I use Key as Encoded String for for all my persistent entities. As the
GAE documentation states:

"Similar to Key, but the value is the encoded string form of the key.
Encoded string keys allow you to write your application in a portable
manner and still take advantage of App Engine datastore entity
groups."

I trust that my app is not BigTable dependent, but any other non-
Google datastore would have to be "Java-and-JDO-friendly" for my app
to work without major changes. (As I said before, there are some
differences between MySQL and BigTable for JDO data exchange (for
example: finding an object by ID). I have overcome these in config-
directed code.)

ivanceras

unread,
Jan 24, 2010, 10:30:53 PM1/24/10
to Google App Engine
Hello Ian,

>I presume that you expected to make some objects persistent using JDO.
>Do you have any idea which part(s) of your config or code could be
>responsible?

Yes, I am using JDO and I find a way to make the objects persistent
already. They saved into a table with the same name as their className
in the persistent class. I guess what I missed was coding the closing
of the persistent manager.

>I use Key as Encoded String for for all my persistent entities. As the
>GAE documentation states:

in my case, I used Long as the datatype for my primary keys since
using Key as the datatype for your primary key field loose the ability
of your models to be serializable to be used in the client side(using
GWT) since Key is not emulated in GWT. As a benefit I have the same
unified model object to be used in the client side and in the server
side. And if you really have to use Key you could use gilead which I
chose not since I didn't figure out how they do things.

One more thing I notice is that:
In google app engine, the BigTable JDO implementation is that when you
create an instance of a persistent object the object is automatically
assigned with a primary key field value, while in datanucleus rdbms
implementation assigned the primary key field values just when the
object is persisted in the database.

Ian Marshall

unread,
Jan 25, 2010, 12:06:45 PM1/25/10
to Google App Engine
Hello Ivanceras,

Data type for primary keys (PKs)
--------------------------------
When I use Key as Encoded String for my PKs, the data type of the PK
is java.lang.String! I give a snippet below to demonstrate this for
me:


@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class NoticePageHome implements Serializable
{
private static final long serialVersionUID = 1L;


/*
//////////////////////////////////////////////////////////////////////////////
// This block is required since this entity has an entity group
root.
// It does not work with MySQL, so we use an alternative for that
database.
// We have the getter method for getting the encoded key here for
convenience.
//

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String sEncodedKey;

@Persistent
@Extension(vendorName="datanucleus", key="gae.pk-id", value="true")
private Long loID;

public String getEncodedKey()
{
return sEncodedKey;
}

//
//////////////////////////////////////////////////////////////////////////////
*/


//////////////////////////////////////////////////////////////////////////////
// This block is required for MySQL only, and will not work
// for Google BigTable.
//

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long loID;

//
//////////////////////////////////////////////////////////////////////////////


/*
Data fields, getters and setters...
*/


Please note:
1. I switch PK blocks depending on whether I am using GAE or MySQL.
2. Using GAE (with Key as Encoded String), I have both the String
encoded key and the Long ID produced automatically by GAE.
3. I trust that this PK method would be easily portable to non-GAE
datastores, should the need ever arise in the future.


I would prefer to use BigTable as much as possible, but I need to use
MySQL when running my Apache Wicket web app in development mode, which
is useful to catch silly mark-up mismatch bugs, amongst others.

Reply all
Reply to author
Forward
0 new messages