Google App Engine: local testing a simple hello world - google-app-engine

I'm trying to make a simple Hello World working in local via the Google App Engine plugin for Eclipse Helios.
The problem comes when want to launch the serveur with the eclipse tool (right-clic on my project -> Run As -> Web Application), the console always display these logs:
2012-04-17 19:01:09.126 java[4019:407] [Java CocoaComponent compatibility mode]: Enabled
2012-04-17 19:01:09.127 java[4019:407] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Usage: <dev-appserver> [options] <war directory>
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=root Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
--generated_dir=dir Set the directory where generated files are created.
The local server works when I use command bellow:
./appengine-java-sdk/bin/dev_appserver.sh appengine-java-sdk/demos/guestbook/war
Does anyone has some idee for making it working ?
Thanks by advice and sorry for my bad English...

i also got into the same problem. But my solution was deleting the existing launch configuration (in Run > Run configurations), close the dialog, and then try right-clicking on your project > Run As > Web Application.

For me it was the space in the Project Name, which coincides with the folder name in the workspace. Whoever is calling the dev server launcher didn't use quotes around the war directory.

Related

How can I debug a Dart AppEngine app

I'm now able to run a Dart app using
gcloud --verbosity debug preview app run app.yaml
and also to deploy and run on AppEngine
gcloud --verbosity debug preview app deploy app.yaml
but I haven't found a way to connect a debugger to the Dart app running on the development server.
I found http://dartbug.com/21067 but still couldn't find a way to make it work.
See also https://groups.google.com/a/dartlang.org/forum/#!topic/cloud/OK1nJtg7AjQ
Update 2015-02-27
The app can be run without Docker and then be debugged like any Dart command line application:
Source. https://groups.google.com/a/dartlang.org/d/msg/cloud/zrxgOHFz_lA/q5CdLLQPBAgJ
The API server is part of the App Engine SDK, and we are using it for
running tests in the appengine package. If you look at
https://github.com/dart-lang/appengine/blob/master/tool/run_tests.sh
you will see that it expects the environment variable
APPENGINE_API_SERVER.
The API server is in /platform/google_appengine/api_server.py
and takes a number of arguments. I just tested running it like this:
$ $CLOUD_SDK/platform/google_appengine/api_server.py \ -A
dev~test-application \ --api_port 4444 \ --high_replication \
--datastore_path /tmp/datastore
To run an app engine application outside the normal development server
requires that a number of environment variables are set. This worked
for my application:
$ GAE_LONG_APP_ID=test-application \ GAE_MODULE_NAME=default \
GAE_MODULE_VERSION=version \ GAE_PARTITION=dev \ API_PORT=4444 \
API_HOST=127.0.0.1 \ dart bin/server.dart
In the Dart Editor you cannot set environment variables for each
launch configuration, so they have to be set globally before starting
the Dart Editor. In WebStorm it is possible to have run configuration
specific environment variables.
This simple setup will of cause not support everything the normal
development server support. Some of the issues are:
Only one application at the time as it is always listening on port
8080 (can easily be made configurable) * The users API (mocking this
shouldn't be that difficult) * The modules API * No health-checks
(should not be a problem) * All HTTP headers are direct from the
client (no x-appengine- headers) * The admin web interface is not
available * Probably other stuff as well
This is all experimental, but it is one solution for a simpler
developer setup, which of cause does not match the deployment
environment as closely as the development server.
Running the API Server using Docker is also possible as the image
google/cloud-sdk with the Cloud SDK is on hub.docker.com.
Use the following Dockerfile
FROM google/cloud-sdk EXPOSE 4444 ENTRYPOINT
["/google-cloud-sdk/platform/google_appengine/api_server.py", \
"-A", "dev~test-application", \ "--api_port", "4444", \
"--high_replication", \ "--datastore_path", "/tmp/datastore"]
Build and run
$ docker build -t api_server . $ docker run -d -p 4444:4444 api_server
Change API_HOST above to 192.166.59.103 (of wherever your Docker
containers are) and run.
Regards, Søren Gjesse
Update 2014-11-27
Debugging from DartEditors debugger started working with the bleeding Dart build 1.8.0.edge_042017.
I assume that the next dev build (probably 1.9.0-dev1.0) will include the related fixes as well?
Detailed steps how this works can be found here: https://groups.google.com/a/dartlang.org/d/msg/cloud/OK1nJtg7AjQ/u-GzUDI-0VIJ
Build a custom Docker image with the latest Dart dev build 1.8.0-dev.4.6.
The Dart team is actually preparing an easy way to do this yourself (see https://github.com/dart-lang/dart_docker)
Installe the latest bleeding_edge on the host system (using this script https://gist.github.com/zoechi/d240f56a32ed5649797f or manual download from http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/editor/darteditor-linux-x64.zip)
Add this to the app.yaml file
env_variables:
DBG_ENABLE: 'true'
# disable health-checking because this is so annoying during debugging
vm_health_check:
enable_health_check: False
See How to disable health checking for `gcloud preview app run` for more details about customizing health checking.
Launch the server code of your app with glcoud --verbosity debug app run app.yaml or glcoud --verbosity debug app run app.yaml index.yaml
Wait until the Docker container is ready (check with docker ps if the Command column shows a value starting with /dart_runtime/dart_
Open DartEditor
Open Menu Run > Remote Connection...
Connect to: Command-line VM
Host: localhost if you dont use boot2dockeror the IP address returned by the commandboot2docker ip`
Port: 5005
Select Folder... select the directory which contains the source code of your project.
Click OK
Set breakpoints and continue as usual.
Old
A first step is using the Observatory which includes a browser based debugger UI.
To make this work add the following lines to the app.yaml file
network:
forwarded_ports: ["8181"]
This might be useful as well to make the server.dart wait until we had the chance to set breakpoints using the observatory.
env_variables:
DART_VM_OPTIONS: '--pause-isolates-on-start'
boot2docker gives us the Docker ip (192.168.59.103) and after starting with gcloud preview app run app.yaml we can connect to http://192.168.59.103:8181 which should open the Observatory GUI.

problems when installing kaazing websocket gateway

I use windows 7, apache 2.2.22 at port 80 and geoserver 2.1.3 at port 8080.
I download and run kaazing 3.5 msi x64 installer to install it locally on my laptop. I followed the official guidelines from the site. The msi succesfully installed the gateway.
But gets installed in C:\Applications Files\etc. not in C:\Program Filesx68\etc.
Anyhow, I tried to start the services, I ran the demo-services.start.bat and a notification came from windows saying that the Windows Fire Wall has blocked some of the features of java. So I hit "Allow" and wait. Command line says something like
"Sending data to ucd://localhost/50505, ucd://localhost/50506"
for over an hour, nothing happens. So I thought something went wrong with windows and java. I uninstall the kaazing, edit the Windows Fire Wall settings to allow java and re-install kaazing. The notification is not showing up now, but when I ran the demo-services.start.bat, still does nothing, just says the same thing. When I visit
http://localhost/8000
gives an 404 error.
I tried everything, chanching ports, uninstall and re-install a couple of times, installing while not connected to the internet, checking the windows fire wall settings, manually running demo-services.start.bat and gateway.start.bat . The gateway.start.bat actually runs ok and says that the gateway started, but still an 404 error when I visit localhost/8000. Installation through msi is always completed with no errors. But the Gateway does not work. Is it the fire wall, the demos bat file, I dont get it...
Tips/hints?
The first thing to do is get the Gateway running successfully first. So don't worry about running demo-services.start.bat yet.
From the Windows Services application, start Kaazing WebSocket Gateway. Then go to C:\Program Files\Kaazing, locate your installation and look in the log directory. Open error.log using a text editor and verify there are no errors.
If there are no errors, you should be able to open http://localhost:8001 from a browser. (Note, you had http://localhost/8000 in your example, but that last slash should be a colon.) You can use either port 8000 or 8001, but 8001 is where the samples are.
If you are using a firewall or something else that is intercepting ports, then you'll need to make sure ports 8000 and 8001 are accessible.
If you're not sure, start a different server process on port 8000 or 8001 (e.g. configure Apache to listen on port 8000 or 8001) and see if the browser can connect.
The msi succesfully installed the gateway. But gets installed in
C:\Applications Files\etc. not in C:\Program Filesx68\etc.
The Gateway is not an executable itself, but runs in a JVM. Therefore there is no 32bit code which constrains the application to be installed into C:\Program Files (x86). Thus C:\Program Files made the most sense.
You could use a 32-bit JVM which would reside in C:\Program Files (x86), but the Kaazing files are abstracted from that via Java, so C:\Program Files is a reasonable location for the Gateway.
BTW There is a forum on the Kaazing website for Kaazing questions.

Can't connect to localhost:8080 when trying to run Google App Engine program

I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs:
Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7
When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both.
How can I view Hello World in a browser? Is there some configuration I need to make on my machine?
I had the same problem. This seemed to fix it:
cd to google_appengine, run
python dev_appserver.py --port=8080 --host=127.0.0.1 /path/to/application
at this point there is a prompt to allow updates on running, I said Yes.
At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.
I have to manually start python and make it point to my app folder, for instance in a command line window on Windows I am using python. I installed python in C:\Python27 and my sample app is in c:\GoogleApps\guestbook
C:\Python27>dev_appserver.py c:\GoogleApps\guestbook
and then I can start my app in the Google App Engine Launcher and hit localhost 8080
How about specifying --host argument? You can find it at the bottom of following doc.
https://developers.google.com/appengine/docs/python/tools/devserver
This might be a little late. But still someone might find it useful.
When ever you go and try changing the port number from 8080 to something else, it will not get updated. So the best option is:
Go to your user directory: eg: C:\Username
There will be a Google folder. Go inside
Open the file google_appengine_projects.ini
Change your port number from 8080 to whatever you like 8081
Save it and close the file.
Launch the GAE Launcher again and you will find the changes reflected and the app runs without issues.
7: Access the application using: http://localhost:NewPort/
This can be used to change ports both run port and admin port for your individual projects running locally.
Hope this helps!
The 8080 portion of your url is a port number. Firefox disables visiting url's of other ports by default. You have to enable them by doing the following: http://blog.christoffer.me/post/2012-02-20-how-to-remove-firefoxs-this-address-is-restricted/
Paraphrasing that website:
Open firefox and visit about:conf
In the Filter box, type in network.security.ports.banned.override
If you can't find such a preference, right click to open up the pop-up menu and pick New and then String
As preference name type network.security.ports.banned.override and 8080 as the value.
Done!
It's likely if this continues to not work that your browser is behaving properly (8080 is a fairly standard port). That means that its a problem with the server and we'd have to do some more debugging.

deploying gae to development server stopped working

I'm working through a test GAE Java project which was working fine but I decided to look at adding GWT to the same project. I then decided to stick with the GAE stuff I was learning and decided to remove GWT. The problem is I can't now deploy to the development server as it gives the following in the Eclipse console pane. Anyone know please how I can reset appropriate settings to how my project had them originally?
terminated test [Web Application] C:\Program
Files\Java\jdk1.6.0_37\bin\javaw.exe Usage:
[options]
Options: --help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest -s SERVER SDK version. --address=ADDRESS The address of the interface on the local machine -a ADDRESS
to bind to (or 0.0.0.0 for all interfaces). --port=PORT
The port number to bind to on the local machine. -p PORT
--sdk_root=DIR Overrides where the SDK is located. --disable_update_check Disable the check for newer SDK versions. --generated_dir=DIR Set the directory where generated files are created. --jvm_flag=FLAG Pass FLAG as a JVM argument. May
be repeated to
supply multiple flags.
I seem to have found my own answer through setting up a new dummy gae project and having a poke around, found that the 'Run As' > 'Run Configurations...' > '(x)= Arguments' > 'Program arguments' had an additional port defined prior to the rest of the argument beginning '--port=8888'. I removed the mention of '-codeServerPort 9997 ' and it now deploys to dev server and appears to be working as before.
eg
new dummy project: --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\dummy\war"
project that wouldn't deploy to dev server: -codeServerPort 9997 --port=8888 "C:\Users\tech1\SSD Storage\Eclipse Projects\workspace\test\war"
I faced the same issue and you know what, Workaround is just pretty simple.
I created one new appengine project with only one jsp in WAR and 'Run As' > 'Run Configurations...' >Server Tab -> Unchecked then checked Run Built-In server and then checked Automatically select any port.
Server started ..on some fishy 25334 port..i stopped that using red button on Console Terminal.
then i changed it back to 8888 and WHOA project Ran.... :)
Then i did the same with old project. deleted this new one and all is working as expected.

Unable to use mvn gae:run with version maven-gae-plugin:0.9.4?

I am using maven gae plugin version 0.9.4 and whenever I use mvn gae:run I get the following error:
Usage: <dev-appserver> [options] <war directory>
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=root Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
--generated_dir=dir Set the directory where generated files are created.
Googling this turned up some old threads where this used to be a problem in 0.5 versions of the plugin but was fixed. Not sure why its happening for me and what are the work arrounds. Any ideas?
I also experienced this problem with maven-gae-plugin 0.9.4 and jdk1.6.0_23 on Windows 7. All I did to reproduce this was to create a project using the gae-archetype-jsp archetype and then use mvn gae:run.
However, I backed maven-gae-plugin down to 0.9.2 and the problem went away!

Resources