Couldn't deploy GAE (Google App Engine) application (Java SDK) - java

I was trying this quick start but I couldn't deploy the app. I made Google Cloud Platform account, cloud platform project and app engine application.
I used mvn appengine:update command.
Result was
[INFO] Running -A masas-first-project -V masas-first-project1 --oauth2 update /home/masa/Code/googleAppEngine/java-docs-samples/appengine/helloworld/target/appengine-helloworld-1.0-SNAPSHOT
The following URL can be used to authenticate:
https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=550516889912.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/appengine.admin%20https://www.googleapis.com/auth/cloud-platform
Attempting to open it in your browser now.
And it was like
I don't know where to paste code

At last could deploy...
By using command "gcloud app create".
Maybe I made gcp project, but not gcloud app yet.
First I went along with Japanese quick start but I tried English one next.
cloud.google.com/appengine/docs/standard/java/quickstart
And I got same similar error but I read error message of maven
mvn appengine:deplpy
ERROR: (gcloud.app.deploy) The current Google Cloud project [testproject-218805] does not contain an App Engine application. Use gcloud app create to initialize an App Engine application within the project.
Here is another good resource... github.com/GoogleCloudPlatform/getting-started-java/issues/371 Thanks LOL.
By the way I wrote about this at my weblog. But in Japanese..
I have also English contents. Visit https://lavilleeternelle.wordpress.com/2018/10/08/gae-google-app-engine%e3%81%a7%e9%81%8a%e3%81%b6/

You have to paste that code into your terminal in order to authenticate.

Related

How to run google test-analytics project on appEngine using eclipse

I am working on google test-analytics project and I am able to build the project successfully using maven through command line and deploy on google appEngine locally.But I couldn't figure out how to deploy the project on appengine using eclipse. when I right click on the project, Its not showing any option to "run on appEngine".
Any help would be appreciated.
Follow this documentation.
To upload an app created with the the appengine-skeleton-archetype:
Change directory to the top level of your project (for example, myapp)
and invoke Maven as follows:
mvn appengine:update
You will be prompted for an authorization code in the terminal window
and your web browser will launch with a consent screen which you must
accept in order to be authorized. Follow the prompts to copy any codes
from the browser to the command line.

Deploy the app on Google App Engine

I am following this tutorial to see how Google App Engine (Java) works. I was able to successfully build the app:
cd appengine-try-java-master
mvn clean install
The issues happens at the last (deployment) stage on Windows. The tutorial says that it's necessary to run this command (the number 1111 is not the original one due to security reasons):
appcfg.cmd -A master-scanner-1111 update target\appengine-try-java-1.0
I opened cmd and pasted this command. The following message appears:
appcfg.cmd is not recognized...
Then I executed just update target\appengine-try-java-1.0, however this did not deploy the app.
The problem is that in the previous steps they give you instructions to download the Google App Engine SDK, but this is just a package of directories and not an installer (much like how java is packaged). The appcfg.cmd exists within that set of directories, so the user will need to add the "bin" folder in that package to their path (or, as suggested, use the full path in the command). The Google documentation is not specific enough for a person just starting out IMHO. I had the same problem.

Google Cloud Debug not working with jar file "File was not found in the executable"

I have been trying google cloud Debugger, i was able to get debugger hooked up in my source code, but whenever i put a breakpoint it throws as error "File was not found in the executable". I have also attached the screenshot for the same.
Screenshot for Cloud Debug in Action
For testing i am using Dropwizard Example, i am running below command to deploy my jar file on Google compute instance.
java $( sudo ./format_env_gce.sh --app_class_path=path/to/jarfile --version=1.0.0 ) -jar -Done-jar.silent=true path/to/jarfile server config.yml
For above command i have been following link https://cloud.google.com/tools/cloud-debugger/setting-up-on-compute-engine
Please help me understand what am i missing here.
Thanks.
This problem was more specific to my jar which i built using gradle, i have tried another way by using maven to create the jar and it works now.

How to deploy tutorial project on GAE

I am completely new to GAE and maybe this question could be quite trivial, anyway I present my case.
I followed the "Try Google App Engine Now" tutorial without any problems (I choose the java project and I use Chrome).
When I try to deploy the project on GAE something goes wrong, I can create the project on GAE but I don't know what to do next:
What command should I use to deploy?
Thanks
Assuming that you have been able to create your application and have been successful in running it locally, please follow the instructions over here for uploading your application.
https://developers.google.com/appengine/docs/java/tools/uploadinganapp#Uploading_the_App
Basically, you should do some configuration such as filling the project-ID at app.yaml.
Then you can use the terminal to change to your project directory, afterwards you can invoke Maven as 'mvn appengine:update'
You can follow the instructions at the following link:
https://cloud.google.com/appengine/docs/java/gettingstarted/uploading

How to auto reload app engine dev server?

Im following the tutorial on the App Engine website for 'Google Cloud Endpoints' in Java. Everything works fine and I can run the development server using mvn appengine:devserver. The problem is that when I make any changes to a file (for example, any java file) the dev server doesnt automatically recompile. I need to ctrl-c to kill the dev server and restart it for every code change I make.
Is there a way to have maven automatically detect changes to any files in my project and have it automatically rebuild and restart the dev server?
Unfortunately no. If you want this behavior on your dev server, you need to use Python.
I run in the same issue and there is no real workaround provided by the App Engine to help you doing this.
From the "Using The Google plugin for Eclipse":
With Eclipse, you can leave the server running in the debugger while you make changes to source code, JSPs, static files and appengine-web.xml. When you save changes to source code, Eclipse compiles the class automatically, then attempts to insert it into the running web server dynamically. In most cases, you can simply reload the page in your browser to test the new version of the code. Changes to JSPs, static files and appengine-web.xml are recognized by the development server automatically, and also take effect without restarting the server. If you change web.xml or other configuration files, you must stop and start the server for the changes to take effect.
(https://developers.google.com/appengine/docs/java/tools/eclipse#Running_the_Project)
There is NOTHING comparable in Java (link from "The Java Development Server") (https://developers.google.com/appengine/docs/java/tools/devserver)
There's currently nothing in the App Engine SDK to automatically restart when files change, but that's not to say you can't do it. I ran into the same problem and wrote up a script to listen for file changes as triggers to restart App Engine. It's in JavaScript, so you'll need to install Node.js if you haven't already.
// Install watch-exec
$ npm install -g watch-exec
// Watch the current directory
$ watch-exec --command "mvn appengine:devserver" --watch .
This will immediately start App Engine, and then restart it any time a file changes. If the app crashes for some reason, the script will wait for your next edit before trying to restart.
P.S. That entire script is about 40 lines of code, and you could probably do the same thing in other scripting languages. If you haven't tried writing your own automation before, I'd definitely recommend checking out the source code to see how this works.
I've found using Gradle, GAE, and Spring MVC, the assemble command will put the correct artifacts in place, and the server will re-init the app. It's a little quicker than a server restart.
Using App Engine standard with the cloud.tools appengine-maven-plugin hot swap works fine (most of the time, can be problems when setting up the workspace).
For a multi-module maven project: no need to stop the server or browser,
just push the code changes (maven command package -pl *-server)
& refresh the browser.
Debugging with a debug client currently works perfectly for changing / adding code within methods.

Categories

Resources