remote connect to appengine datastore

47 views
Skip to first unread message

Yepelinux

unread,
Feb 12, 2013, 2:40:54 PM2/12/13
to Siena
Hi, i need to connect my development environment to google appengine
datastore. Im currently using PlayFramework 1.2.5 with GAE module and
Siena Module.

Im running this job onStartup, but even it seems it connects ok, it's
still reading data from local storage.


@OnApplicationStart(async=false)
public class Boot extends Job{

@Override
public void doJob() throws Exception {
RemoteApiOptions options = new RemoteApiOptions()
.server("na-engage-test.appspot.com", 443).credentials(
"devel...@domain.com.ar", "password");

RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(options);

}

}

This is my controller


public static void users() throws IOException {
List<Object> fetch = UserProfileDTO.all().limit(10).fetch();
renderJSON(fetch);
}


And this is my class

public class UserProfileDTO extends EnhancedModel {

@Id
public String userID;
public Long dateCreatedLong = 0l;
public String userEmail;
}


This is my webserver's log.

~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.5, http://www.playframework.org
~
~ Ctrl+C to stop
~
CompilerOracle: exclude jregex/Pretokenizer.next
Listening for transport dt_socket at address: 8000
16:00:37,340 INFO ~ Starting D:\Desarrollo\workspace
\GoogleEngageOfficePlay
16:00:37,346 INFO ~ Module gae is available (D:\Desarrollo\play
\modules\gae-1.6.0)
16:00:37,347 INFO ~ Module siena is available (D:\Desarrollo\workspace
\GoogleEngageOfficePlay\modules\siena-2.0.7)
16:00:38,100 WARN ~
16:00:38,100 WARN ~ Google App Engine module
16:00:38,101 WARN ~ ~~~~~~~~~~~~~~~~~~~~~~~
16:00:38,102 WARN ~ No Google App Engine environment found. Setting
up a development environement
16:00:38,134 WARN ~
16:00:38,135 WARN ~ You're running Play! in DEV mode
16:00:38,256 INFO ~ Listening for HTTP on port 9000 (Waiting a first
request to start) ...
16:00:47,181 INFO ~ GAE environment detected
16:00:47,227 INFO ~ Application 'GoogleEngageOfficePlay' is now
started !
16:00:47,652 INFO ~ Local Datastore initialized:
Type: Master/Slave
Storage: D:\Desarrollo\workspace\GoogleEngageOfficePlay\tmp
\datastore
16:00:47,653 INFO ~ The backing store, D:\Desarrollo\workspace
\GoogleEngageOfficePlay\tmp\datastore, does not exist. It will be
created.

Any ideas why it doesnt connect to appengine remote datastore?

Yepelinux

unread,
Feb 17, 2013, 2:57:48 PM2/17/13
to Siena
I made this work by putting the doJob() method code on my Controller
and checking not to run twice.

I still dont know why, but my Boot Job does not run on Startup


On Feb 12, 4:40 pm, Yepelinux <marianoye...@gmail.com> wrote:
> Hi, i need to connect my development environment to google appengine
> datastore. Im currently using PlayFramework 1.2.5 with GAE module and
> Siena Module.
>
> Im running this job onStartup, but even it seems it connects ok, it's
> still reading data from local storage.
>
> @OnApplicationStart(async=false)
> public class Boot extends Job{
>
>         @Override
>         public void doJob() throws Exception {
>                 RemoteApiOptions options = new RemoteApiOptions()
>                         .server("na-engage-test.appspot.com", 443).credentials(
>                                 "develop...@domain.com.ar", "password");
>
>                 RemoteApiInstaller installer = new RemoteApiInstaller();
>                 installer.install(options);
>
>         }
>
> }
>
> This is my controller
>
>         public static void users() throws IOException {
>                 List<Object> fetch = UserProfileDTO.all().limit(10).fetch();
>                 renderJSON(fetch);
>         }
>
> And this is my class
>
> public class UserProfileDTO extends EnhancedModel {
>
>         @Id
>         public String userID;
>         public Long dateCreatedLong = 0l;
>         public String userEmail;
>
> }
>
> This is my webserver's log.
>
> ~        _            _
> ~  _ __ | | __ _ _  _| |
> ~ | '_ \| |/ _' | || |_|
> ~ |  __/|_|\____|\__ (_)
> ~ |_|            |__/
> ~
> ~ play! 1.2.5,http://www.playframework.org

Alex

unread,
Feb 25, 2013, 11:29:44 AM2/25/13
to siena-...@googlegroups.com
Hello,
 i would like to do the same (connect my local instance to my online database), which settings should i set on the appengine dashboard / web.xml file please ? I'm stuck with the following error :

IOException occured : can't get appId from remote api; status code = 404

Best regards,

Alex

PS : My setup : Play! 1.2.5 + Siena module + GAE module


--
You received this message because you are subscribed to the Google Groups "Siena" group.
To unsubscribe from this group and stop receiving emails from it, send an email to siena-discus...@googlegroups.com.
To post to this group, send email to siena-...@googlegroups.com.
Visit this group at http://groups.google.com/group/siena-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Yepelinux

unread,
Feb 26, 2013, 4:25:20 PM2/26/13
to Siena
Hi Alex, I finally made that work by executing this, before any
request i receive.

package controllers;

import java.io.IOException;

import play.Play;
import play.mvc.Before;
import play.mvc.Controller;
import play.mvc.Http.Header;

import com.google.appengine.api.datastore.EntityNotFoundException;
import com.google.appengine.tools.remoteapi.RemoteApiInstaller;
import com.google.appengine.tools.remoteapi.RemoteApiOptions;

public class MyController extends Controller {

static boolean firstTime = true;

@Before
public static void remoteConnect() throws IOException,
EntityNotFoundException {

try {
if (firstTime && Play.mode.isDev()) {
RemoteApiOptions options = new
RemoteApiOptions().server("myapp.appspot.com", 443).credentials(
"admi...@domain.com", "adminPassword");

RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(options);
firstTime = false;
}
} catch (IllegalStateException e) {
e.printStackTrace();
}
}

}

Hope this work for you too.

Yepes


On Feb 25, 1:29 pm, Alex <zakapa...@gmail.com> wrote:
> Hello,
>  i would like to do the same (connect my local instance to my online
> database), which settings should i set on the appengine dashboard / web.xml
> file please ? I'm stuck with the following error :
>
> *IOException* occured : can't get appId from remote api; status code = 404
Reply all
Reply to author
Forward
0 new messages