How to debug server code in eclipse on deployed appengine database? - java

I have a Google AppEngine (Java) project in Eclipse. I want to debug my local code in Eclipse but use the deployed database on AppEngine. Until now I use Remote API with username/password (old way)
This method will be deprecated and I want to use OAuth but when I try to use it, it throws an exception:
java.lang.IllegalStateException: OAuth-based authorization not supported for clients running on App Engine
at com.google.appengine.tools.remoteapi.RemoteApiOptions.getOrCreateHttpTransportForOAuth(RemoteApiOptions.java:359)
at com.google.appengine.tools.remoteapi.RemoteApiOptions.useApplicationDefaultCredential(RemoteApiOptions.java:162)
Everthing is fine when I run a simple Java client app that uses remote api in Eclipse. But if the client is AppEngine development environment in Eclipse, it doesn't work.
How can I debug the server code in eclipse using appengine database?
Bug report: https://code.google.com/p/googleappengine/issues/detail?id=12556

This is expected, as value returned by ApiProxy.getCurrentEnvironment() will not be null, but com.google.appengine.tools.development.LocalHttpRequestEnvironment object. For development server you'll have to use old style (username/password) for now.

According to the documentation, you need to add appengine-remote-api.jar from ${SDK_ROOT}/lib/appengine-remote-api.jar to your WEB-INF/lib directory (or add it to your Maven dependencies) before this will work.
Update: Indeed, it looks like OAuth from App Engine with Remote API has not yet been implemented. I would assume this will change before ClientLogin is fully deprecated, but for now I would recommend opening a feature request on the public issue tracker.
One possible workaround would be to create a regular console application that connects to the Remote API (as per the example in the docs) and can act as a proxy for your App Engine application running on the development server.

In addition to what my colleagues Adam and Nikita previously said, I can officially confirm that the Google Cloud Engineering Team is determined to provide a solution to all reasonable use-cases which are affected by the ClientLogin shutdown before its deadline.
Presumably, the Remote API solution will be available in the upcoming releases 1.9.31/32, although this is just an assumption and there's no ETA for it yet.
As an alternative, you can access Cloud Datastore using Protobufs remotely using service account credentials, which might fit your needs for the moment.
UPDATE 2016/01/21:
The team has extended the ClientLogin shutdown deadline to April 12, 2016.
UPDATE 2016/04/12:
As mentioned before, the fix was properly applied and available in the latest versions of the SDK and gcloud. Remote API can now be used again with OAuth for app-to-app (or devserver-to-app) connection.

Related

Actions On Google Deployment using webhook

I am using Java Client Library to use google Dialogflow. My questions is what happens when we use "appEnginedeploy" using gradle? Where is the code stored and more importantly how the implemented database and other files of code stored and accessed by our agent?
Thanks!
appEngineDeploy is setup to deploy the code to App Engine, a computing platform on Google Cloud. Code and associated project files are stored as they are in your project.
It's not entirely a VM, so you shouldn't necessarily think of App Engine as locating filepaths. If the project can make the links locally, then it should behave the same way in App Engine.
With regards to databases, it would depend if you're using an embedded database or using a hosted solution through another Google Cloud service. Presumably you'd use the database APIs for a Cloud service as shown in the documentation.

How can New Relic keep my Java site up?

Is it possible to use New Relic on my Java site? I built it with JHipster Yeoman generator and deployed the WAR file to Heroku. I setup New Relic. I looked at the default policy. It appears to have a pinging service, but I am wondering if I have to do something in addition to keep my site up. Maybe create a route for the pinging service?
From looking at the Jhipster site, it says it creates a Spring boot backend: https://jhipster.github.io/
Providing the version of spring used is v3 or v4 it should work. (I was unable to verify what version boot actually uses)
https://docs.newrelic.com/docs/agents/java-agent/getting-started/new-relic-java
This looks like it should work to me, trying it is the only way to know for sure. Here is the heroku-newrelic-java install doc:
https://devcenter.heroku.com/articles/newrelic#java-installation-and-configuration
The ping service will attempt to connect to your site over http/https from external locations, to verify that it can be reached. You shouldn't need to do any additional configuration on your site.

Docker support - Google App Engine (Java)

I recently learned about Docker and from a press release that Google App Engine supports it.
The question is,
Does it mean that we can now "package" our app using Docker (may it contain non-GAE white-listed jars) and expect it to work with Google App Engine?
How a docker app can access the Datastore API, the TaskQueue API is there a way, or this question is irrelevant?
If I package with Docker, say, a Spring app that access MongoDB, MySQL or whatever would it work GAE, if yes how come?
Or otherwise if this idea is not correct,
What is the integration of Docker and Google App Engine?
This is part of an ongoing Limited Preview Managed VMs, you can subscribe to it with the following form
Does it mean that we can now "package" our app using Docker (may it contain non-GAE white-listed jars) and expect it to work with Google App Engine?
Yes
How a docker app can access the Datastore API, the TaskQueue API is there a way, or this question is irrelevant?
Using the regular API jars.
If I package with Docker, say, a Spring app that access MongoDB, MySQL or whatever would it work GAE, if yes how come?
Because the underlying container run on a Google Compute Engine VMs, see the Managed VMs documentation referenced earlier for more details.

Where to get latest Google Cloud Storage Client

I have a GAE app that uses Google Cloud Storage. On development machine I'm getting following WARNING when trying to use Storage API:
WARNING: Class com.google.appengine.tools.cloudstorage.RetryHelper
loaded from target/webapp-1.0-SNAPSHOT/WEB-INF/lib/appengine-gcs-client-0.3.2.jar
has a dependency on class com.google.appengine.tools.cloudstorage.ExceptionHandler
loaded from (target/webapp-1.0-SNAPSHOT/WEB-INF/lib/appengine-gcs-client-0.3.2.jar <no signer certificates>),
which is not part of App Engine's supported API.
You are strongly discouraged from using this class - your app may
stop working in production at any moment.
What should I do? Does it mean that my version of GCS client is outdated?
I'm using version 0.3.2, it's a latest that I can find in Maven (see). Official site have a different naming scheme, and latest version is r127, but I cannot find this version in Maven.
Is there any other (unofficial?) repo for GCS client library?
I was concerned by the log messages in my development server as well. I looked up the source for ExceptionHandler, and I saw the log message on the latest commit (r120) said:
Remove the use of #AppEngineInternal
as dev appserver complains about it.
Here's a link to it. It seems like the dev server just doesn't like the annotation, and no functionality was changed with the commit.
A fix for this was committed to the library. The fix is what d2013 suggested.
I just tested with version 0.3.3 and can confirm that upgrading the dependency will resolve the issue.

How to create the build using Eclipse 3.6

I am developing an web app using java/j2ee as middle ware and Mysql 5.1 as database. I have to deploy it on AWS-EC2 server.
My questions are:
How do I create the build
How do I deploy on ec2 server?
I am using Apache Tomcat-6. Should I use any other server like Apache2 as web-server?
Use WTP to create a Dynamic Web Module project.
Use AWS Toolkit for Eclipse
That's pretty terse, but you'll need so many more details that it's pointless to list them here. Read the docs, then come back with specific questions :)
Whether you need Apache2 in front of Tomcat depends on your requirements. If you need it you'll know it :) Things that you might want to punt off on Apache2:
SSL
Static content
URL rewriting
If you are just planning to do every thing manually. You should read this manual http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
Basically,
You need to create an AMI instance of platform of your choice. (Win/Unix-based).
Configure it with the software that you need. In your case, Tomcat-6 and MySQL-5.1. Configure them. Set Schema etc.
Upload your WAR file to the instance and deploy to Tomcat-6.
Make sure Tomcat port (8080 or whatever you've configured) is open. You can configure this from AWS console's Security Group setting.
Use the instance's Public DNS to access your app. Public DNS can be found from AWS console.
There are many freely available, pre-configured AMI available. Since your setting is one of the most common one. I am sure you will get one and skip Step#2.

Categories