Google App Engine: Errors

Unable to update app: Error posting to URL

Problem Description

While using the Eclipse IDE and the Google App Engine Plugin for Eclipse, you select Deploy to App Engine and get an error similar to:

The App Id you selected, spragucm-spragucm, does not exist. Go to http://cloud.google.com/console to view existing App Ids or create a new App Id.

Unable to update app: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=spragucm-spragucm&version=1&
404 Not Found
This application does not exist (app_id=u’spragucm-spragucm’).

Problem 1: Typo

The most obvious problem is that you may have mistyped the projectId. To solve this:

  1. Sign into your developers account on console.developers.google.com
  2. You should see the DashBoard for all projects. If not, select the dropdown at the top of the screen -> Select Manage All Projects
  3. Locate the Project Name -> Copy the Project Id that is to the right of the project
  4. Return to Eclipse -> Right-click on the project -> Google -> App Engine Settings -> Paste the Project Id from above into the Application Id field under Deployment
  5. Verify that the project has updated the Project Id by selecting the war folder -> WEB-INF -> Open appengine-web.xml -> locate the application block and it will have the Project Id if everything updated

Problem 2: No Project Id

  1. You are not using a projectId from Google App Engine
  2. You are not signed into your Google account in Eclipse
  3. You are signed in to a Google account in Eclipse but it is not the account that holds the project with the projectId that you are using

Solution

  1. You mistyped the projectId

Windows http://localhost Port Conflict

I was trying to deploy a webpage on my Windows laptop using http://localhost:8888 but kept running into funky errors  – javascript libraries weren’t loading and the user interface wasn’t responding correctly. I stopped the local server (a Google App Engine app) and the following Error Echo Service page was displayed:

Since this wasn’t the Oops! could not connect to localhost page, I deduced that another app is running on port 8888. I didn’t have any clue what it could be or how to stop it so I Googled it and here’s the resolution:

  1. Locate the Command Prompt shortcut on your Windows PC (default is C:\Users\YourName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools)
  2. Right-Click on the shortcut -> Run As Administrator -> Select OK in the prompt
  3. Type netstat -> hit Enter
  4. You should be shown all active connection including port numbers. See if the port is being used
  5. If the port is being used type netstat -bano -> hit Enter
  6. A very detailed list of the active connections will now be shown including that applications using them.
  7. Note that localhost:8888 will be listed as 127.0.0.1:8888, and then find the application that is using that port.
  8. Now open the Task Manager (ctrl + alt + delete) -> locate the application -> select End Task
  9. Open a web browser -> enter http://localhost:8888 as the web address -> you should see the default Oops! could not connect to localhost page
  10. Try to run your local webpage server again

Note: If you prefer a GUI, which I certainly do, then download the following instead of using the Command Prompt: https://technet.microsoft.com/en-us/sysinternals/bb897437.aspx

Getting More Free Space on WordPress

If your WordPress blog has a lot of images then you may be running out of the free quota that WordPress gives you by default. Rather than buying a premium account for the current rate of $99 a year, just link your images to an image in a public folder on your Google Drive account. This will require a smidge of HTML coding, but very little and anybody can do it so long as you follow the steps below.

Setup a Public Folder in Your Google Drive Folder

  1. Locate your Google Drive folder on your computer (if you haven’t installed it then please Google it) (e.g. C:\Users\MyName\Google Drive\)
  2. Add a subfolder called WordPress (anything will work actually)
  3. Right-click on the new folder -> Google Drive -> Share -> Advanced Settings
  4. Under Who has access? -> Change the option to Public
  5. Under Access -> Can View -> Anyone (no sign-in required)
  6. Accept
  7. Now place whatever images you want into this folder
  8. Right-click on the image -> Google Drive -> View On Web
  9. When the image is showing online, right-click the image-> Copy Image Location.
  10. This image location will be used below.

Start using the images in WordPress

  1. Stop using WordPress t
  2. Click on the HTML Tab next to the Visual Tab
  3. Locate the position where the image should go and past the following

    <img class=” src=”image_location_from_previous_step”/>

  4. Publish the post.

That’s it! You now have expanded your WordPress drive size by many gigs using free space from a Google Drive account.

Google App Engine (GAE) Hello World Multiple Servlets

Basically the same as a single servlet but expanding to multiple to demystify a little bit more – make developer change a few things to highlight what each part is doing

If you were following the steps in Hello World with one servlet, then you won’t get a complaint about a server already running on the localhost. If you missed the step explaining how to stop the server then follow the instruction at (site address needed) and stop the previous app. Then try and run the app again

Errors

If you go to http://localhost:8888 and there is no webpage here are the possible problems:

  • Not running the server-so start running it. Here’s how to check if it’s running
  • justSomeIndexName.html isn’t added to the web.xml file under <welcome-file>
  • you can see justSomeIndex.html but a servlet’s page isn’t found when clicking on the link in the main page. The problem is likely that the servlet isn’t correctly linked in web.xml or isn’t named correctly or the linke in justSomeIndexName.html isn’t the same as in web.xml

Stop or Restart a previously started Google App Engine local server in Eclipse

  1. In Eclipse, find the Eclipse Console view (looks like below).
  2. If the console view is not showing then select Window -> Show View -> Console
  3. Select the arrow next to the little computer and select the server that is running from the drop-down menu
  4. Select the red square to stop the server
  5. Go to http://localhost:8888 and verify that the page no longer loads.Note: If a page is still showing then repeat the above steps for all of the servers listed in the drop-down menu next to the little computer in the console window. If that still doesn’t work, another application may be using the port so refer to https://spragucm.wordpress.com/2015/05/14/windows-httplocalhost-port-conflict/
  6. To restart, just run the Google App Engine project again (Right click -> Run As ->Web Application)

References

Google App Engine (GAE) Hello World

  1. Install the Google Product (more info)
  2. Register for a Google AppEngine Account(more info)
  3. Create a new project and copy the Project Id (e.g. mine is sturdy-mechanic-94316)
    1. if you can’t see it, select your project -> Overview -> Top of page should say “Project ID” ->Copy this id
  4. In Eclipse, right-click in Package Explorer -> New -> Web Application Project (has a blue g+ icon)
  5. Enter project Name: GAE-HelloWorld
  6. Enter package: com.spragucm.gae_helloworld
  7. Un-select “Use Google Web Toolkit” checkbox
  8. Check “Use Google App Engine”
  9. Under the “Identifiers for Google App Engine” section -> Select “Use Api Id” -> Paste the project id from above
  10. Under “Sample Code” -> Select “Generate Project Sample Code”
  11. Select “Finish”

To test the project locally:

  1. Right-click the new project inside of “Package Explorer” -> “Run as” -> select “Run Configurations”
  2. Scroll down to “Web Applications” -> Select “GAE-HelloWorld” -> select “Run”
  3. To see that it is running, open any internet browser -> enter “http://localhost:8888&#8221; as the web address ->hit enter
  4. Your application will be shown

To test a deployed project

  1. Right-click the project inside of “Package Explorer” -> “Google” -> “Deploy to App Engine”
  2. Project Name: GAE-HelloWorld
  3. Under “Select the front an backends to deploy -> Select “Frontend”
  4. Select “Launch app in browser after successful deploy”
  5. Select “Deploy”
  6. After everything successfully builds, you can go to http://1-dot-yourAppId.appspot.com/ (e.g. my app Id was sturdy-mechanic-94316 and the web address was http://1-dot-sturdy-mechanic-94316.appspot.com/)
  7. When you are done, STOP THE SERVER or else http://localhost:8888 will permanently have this app running on it. To stop the server follow the instructions at

That’s it, a hello world that’s up and running 🙂

Digging Deeper

Ok, things are at least working now, so let’s discuss what is going on…

  1. All of this is on the App Engine side, nothing is on Android yet
  2. Your project is running on App Engine. It is available to ANYBODY, on any device.
  3. There is absolutely no authentication (yet)
  4. src -> src.com.gae_helloworld -> GAE_HelloWorldServlet.java
    1. This is a servlet that simply creates a text page that displays hello world when GAE_HelloWorld is click on the http://1-dot-yourAppId.appspot.com
    2. Indicate that text will be used: resp.setContentType(“text/plain”);
    3. Indicate the message to be printed on the page: resp.getWriter().println(“Hello, world”);
  5. war -> index.html
    1. This is the webpage that is shown at http://1-dot-yourAppId.appspot.com
    2. When a user clicks the GAE_HelloWorld link in the main page they are brought to a simple page that says “Hello, world”. This is accomplished using the following line of html: GAE_HelloWorld
  6. war -> WEB-INF -> web.xml
    1. This file basically describes what servlets are used and what they map to. For example, href = “gae_helloworld” gets clicked so go to the GAE_HelloWorld servlet which is in turn has its actions outlined by the com.spragucm.gae_helloworld.GAE_HelloWorldServlet class
    2. Notice the is listed as index.html which simply means that index.html should be displayed as webpage when users navigate to http://1-dot-yourAppId.appspot.com/

Cross-Promoting Mobile Applications Using WordPress and GoDaddy

Helpful? Then DOWNLOAD and RATE my app!

Helpful? Then DOWNLOAD and RATE my app!

Promoting your app…

If you already have a WordPress blog and are willing to spend a few dollars, it’s super easy to promote your app through your blog. You should note that it’s against WordPress’s Terms and Conditions to advertise on a WordPress blog, but, you should be fine since you aren’t advertising…you are cross promoting your apps simply by showing your brand on pages that you provided (my personal opinion here).

I’ll explain how I did this with my app Panes (like the cross promotion there!)

  1. Create a Blog about your app so that you can help others understand how to code some of the stuff you coded. If it’s well done, developers will visit your blog, read your crap, steal your code, but will also be nice enough to click on your app link
  2. Call to action…ensure that your icon isn’t distracting and then have a call to action like “Helpful? Then download and RATE my app!
  3. Create a Google Site for your app
  4. Stick a reasonably sized image in the Google Site and reference it here
    1. If you want a monster size, 300px by 300px icon image straight from Google Play, then have the image link point to Google Play. If you are more reasonable then point to a smaller image on your Google Site
  5. The href should point to Google Play and not to the website for the app. This is because you already have the audience so don’t add a barrier between them and a download
  6. If you want to make this more useful, ie not have to change the href on every site every time you update the promo product, then get a GoDaddy account, register the cheapest website, and forward to the correct Url.
  7. NOTE: I tried the following and they worked in the WYSIWYG editor while editing the blog post but they didn’t work on the published page – no clue why

Helpful? Then DOWNLOAD and RATE my app!

Helpful? Then DOWNLOAD and RATE my app!