Google Java AppEngine environment from one line of code
When working on web projects, I always find it useful to capture the ‘environment’ of where the application is being hosted and document it. I’ve found this particularly applicable for .NET projects rather than Java, especially when the application suddenly breaks with no warning! This is more often than not due to a service pack install, security fixes or some software install.
What version information can be gathered from the AppEngine? There’s a handy function getProperties() that will return all the system properties available to a Java app. The list that is available from the AppEngine JVM is restricted as outlined in the ‘Environment’ section of this page. So…. running the following line of code… System.getProperties().list(resp.getWriter());….what do we get?
– listing properties –
java.vendor=Sun Microsystems Inc.
java.specification.version=1.6
line.separator=
java.class.version=50.0
java.util.logging.config.file=WEB-INF/logging.properties
java.specification.name=Java Platform API Specification
java.vendor.url=http://java.sun.com/
java.vm.version=1.6.0_13
os.name=Linux
java.version=1.6.0_13
java.vm.specification.version=1.0
user.dir=/base/data/home/apps/versionapp/1.3327…
java.vm.specification.name=Java Virtual Machine Specification
java.specification.vendor=Sun Microsystems Inc.
java.vm.vendor=Sun Microsystems Inc.
file.separator=/
path.separator=:
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.vendor=Sun Microsystems Inc.
file.encoding=ANSI_X3.4-1968
No real surprises, running Java version 6 – update 13 on Linux. Admittedly, this doesn’t tell the full story as the ‘readme’ file included with the App Engine SDK reveals more.
Google App Engine SDK for Java
Copyright (c) Google, Inc. 2009. All rights reserved.
Visit Google Code (http://code.google.com/appengine/).
This product includes software developed by:
- The Apache Software Foundation (http://www.apache.org/).
- The servlet specification classes: servlet-api-2.5.jar, jsp-api-2.1.jar, el-api-2.1.jar
- Apache Ant (http://ant.apache.org/)
- Jakarta Commons Logging (http://commons.apache.org/logging/)
- Jakarta Commons HttpClient (http://jakarta.apache.org/commons/httpclient/)
- Jakarta Commons Codec (http://commons.apache.org/codec/)
- Jakarta Commons EL (http://commons.apache.org/el/)
- Jakarta Jasper (http://tomcat.apache.org/svn.html)
- Jakarta Taglibs (http://jakarta.apache.org/taglibs/)
- The Apache Geronimo Project (http://geronimo.apache.org/)
- javax/mail with modifications
- javax/activation
- geronimo-servlet_2.5_spec-1.2.jar, geronimo-jsp_2.1_spec-1.0.1.jar, geronimo-el_1.0_spec-1.0.1.jar
- Mort Bay Consulting (http://www.mortbay.org)
- Jetty web server
We can see that Jetty web server and the Geronimo project are used.
Before anybody complains, that technically more than one line of code was used as there is no declaration function for the servlet… here’s the full one line!
package com.test; public class versionServlet extends javax.servlet.http.HttpServlet { public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException { System.getProperties().list(resp.getWriter()); } }
leave a comment