Submit Your Article
Home Articles News Tutorials Videos Add An Article
Topics: Design Photoshop Programming PHP CSS Java Database Web Development Javascript Ajax
– Close + Open

Find Out More About DevWebPro!

Sign up for the newsletter


» Terms & Conditions

Welcome to the New DevWebPro!

DevWebPro Includes:
  Hundreds Of Tutorials   Developer News
  Unique Gadget Videos   Tons of Topics to Discuss
  Expert Advice   We Will Publish Your Articles

Running The Google App Engine In Java

By: Pete Freitag
Tuesday, April 14th, 2009
Text: Decrease Font Size Increase Font Size | Print Print Article | Share: Delicious Digg StumbleUpon Post to Twitter Post to Facebook

I gained access to the Google App Engine for Java, early release program, and as any CFML developer would do, I tried getting a CFML server (both Railo and OpenBD) to run on it. I posted some of my experiences on twitter, unfortunately I was unsuccessful.

You may have noticed that I didn’t try running Adobe ColdFusion on there, there. I think it would be a license violation, since app engine runs on multiple servers I wouldn’t know how many licenses I would need in order to run it legally (ps – Adobe if you want to send me a couple hundred licenses, I am fine with that).

So why doesn’t it work?

Google has implemented a pretty tight security model on Google App Engine, as such you can’t write to the file system, it is readonly. You can only store data using the Google Datastore API. This seams like an awful restriction, but when you consider that the servers are clustered, it makes sense, as they would have some expensive replication processes going on constantly.

Both Railo and OpenBD assume that they can create temporary files, write configuration, etc.

When you deploy an app and try to run a CFM, google simply serves the CFML source code back to you, which means the Servlet mapping is not working. I am guessing that is because it couldn’t init() the CFML Servlet, but maybe there is also an issue with Servlet Mappings?

It’s interesting to note that Google App Engine does support JSP, which is typically compiled into class files dynamically written to a temp directory. Google App Engine pre-compiles JSP files into class files when you deploy your application, so this dynamic compilation step is eliminated.

How do we get around it?

There are a couple ways I see that you can get around these issues to get CFML running on Google App Engine:

  • Pre-Compiled CFM – ColdFusion 7 and 8 support sourceless deployment, which turns your CFM / CFC files into java class files. You should be able to get something like that working on App Engine.
  • Custom Classloader – You could write a custom class loader, which would reimplement all of the Java File IO classes to use the Google DataStore API. This would not be terribly easy, but I think it would be pretty useful, and I wonder why Google hasn’t provided such a mechanism? It could possibly be mapped to a special path, eg: /google-datastore/myfile.txt
  • Modify the CFML Engine – The final option would be to modify the CFML engine to not rely on the filesystem, or to use the Google Datastore API.

The Race is on

I have talked to Mark Drew at Railo, and Matt Woodward of OpenBD, both have investigating it. Who will be the first to get it running?

Comments

Topics: ,

About the Author:
Pete Freitag (http://www.petefreitag.com/) is a software engineer, and web developer located in central new york. Pete specializes in the HTTP protocol, web services, xml, java, and coldfusion. In 2003 Pete published the ColdFusion MX Developers Cookbook with SAMs Publishing. Pete owns a Firm called Foundeo (http://foundeo.com/) that specializes in Web Consulting, and Products for Web Developers.
DevWebPro is an iEntry Network ® publication - © 1998-2010 All Rights Reserved