Deploy the app on Google App Engine - java

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.

Related

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

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.

Run Java App Locally - How to start appengine-try-java server?

I'm just starting with App Engine, and am trying to get a basic Hello World running locally on my machine to test. I've been trying to follow the tutorial for Java here.
I get as far as running the following commands:
cd appengine-try-java
mvn package
At which point the tutorial insists that the server should be built and run and I should be ready to go, except I just get a "build success" and the server isn't running (The terminal output doesn't hang and wait for Ctrl+C, and I can't access localhost:8080).
I've tried figuring out myself how to use the .war file it gives me to run the server using the Apache Maven, but without any luck. I followed the rest of the tutorial exactly. Any advice on what I'm missing?
Thanks!
I think you forgot to run the last command:
dev_appserver.sh target/appengine-try-java-1.0
with cd you go to the folder, with mvn package you will build the project and with the dev_appserver.sh you will start the actual project.

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.

How to display changes in web browser when Building a RESTful Web Service using Spring?

I am following this tutorial:
https://spring.io/guides/gs/rest-service/
After completing the tutorial I run everything in my web browser on my local host and everything seems to work.However when I make changes in the java code (I made errors on purpose) I can still run everything in the web browser. What do I need to do in order for it to change due to my code changes? I guess I should mention that I am using eclipse and have installed maven as a plugin.
You are changing the source code, but not the compiled files. Your service is using the created "gs-rest-service-0.1.0.jar" file. This is not affected by your code changes.
Jump into the tutorial again where it says:
"Build an executable JAR"
This will rebuild your jar file. Afterwards you will have to restart your service like you did in the chapter "Run the service".
Instead of using maven as a plugin a choose to install it in order to use the command prompt.

Running Jspresso Human Resources sample application

I have downloaded Jspresso Human Resource sample appplication from here:
http://www.jspresso.org/page/jspresso-download-area
I don't know about Jspresso framework. I just want to run this downloaded Human Resource Sample application and see how it works. But from the downloaded content I don't know how to make it run. It would be nice if I can run it from command prompt because later I want to profile the application with Java profiler (the profiler I use is command line tool). I already have JDK and Tomcat installed.
Does somebody know how to run this Human Resource sample application from Jspresso?
I found how to install and make it run here:
http://www.jspresso.org/page/jspresso-10-minutes

Categories

Resources