2
votes

I have spent the last day and a half searching the web for an answer, any help would be wonderful.

The question is how do we get the google app engine high replication data store (HRD) to work in our local environment in order for us to use/test Cross-Group transactions?

We are developing a new java app to run on GAE. We started with the 1.6.0 version Google sdk using Eclipse. We choose the High Replication Datastore setting. We are not use 1.6.5. We are using Objectify.

I noticed recently that both Google and Objectify fully support Cross-Group (XG) transactions with limitations.

I modified a portion of our code to make sure that would work for us but have run into a problem. When I run junit tests or run our application as a web application and it gives the error:

WARNING: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction.

When I run this code:

DatastoreService ds = DatastoreServiceFactory.getDatastoreService();

System.out.println(ds.getDatastoreAttributes().getDatastoreType());

I get MASTER_SLAVE.

I have not tried deploying the application to see if it works there. Probably not a good idea until I can get it to work in the local environment.

Here are some settings

Arguments, VM arguments:

-javaagent:/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.6.5/appengine-java-sdk-1.6.5/lib/agent/appengine-agent.jar -Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50 -Xmx512m -XstartOnFirstThread -Xbootclasspath/p:/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.6.5/appengine-java-sdk-1.6.5/lib/override/appengine-dev-jdk-overrides.jar

App Engine:

Use Google App Eninge checked

Use Default SDK (appengine-java-sdk-1.6.5 - 1.6.5) selected

Enable local HRD support checked

Use Datanucleus JDO/JPA to access the datastore checked

1

1 Answers

0
votes

It looks like you're not using Cross-Group (XG) transactions properly. Take a look at the transaction documentation and look at the code sample under the "Using Cross-Group Transactions" section. There is a good working code example to get you started.

https://developers.google.com/appengine/docs/java/datastore/transactions#Uses_for_Transactions