Showing posts with label GAE. Show all posts
Showing posts with label GAE. Show all posts

Sunday, September 06, 2009

GAE Revisted

Since I'm not gaming at the moment, see previous post, had another go getting the Polar Uploader to work, but still suffering with the same SimpleDateFormat problem that I described here.

Sunday, May 17, 2009

Java Google App Engine Updated.

A new version of the Java GAE is out. Whilst there is nothing specific that hints and fixing the problems with JSF, it might.

Wednesday, April 22, 2009

JSF 1.2 on Google App Engine

Seems like this guy has got it working. I'll have to try it when I get time.

Work sucks ;)

Friday, April 17, 2009

Field Initialisation in Google App Engine

Had a weird problem that took a while to resolve. I'm still not sure what the issue really was, perhaps its a problem with GAE itself. Here are the details:

I have a class that is packaged within a Jar and included in the applications WEB-INF/lib directory.

I was struggling with the following errors:

javax.servlet.ServletException: [Ljava.lang.String;
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:239)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:63)
...

Nested in javax.servlet.ServletException: [Ljava.lang.String;
:java.lang.ArrayStoreException: [Ljava.lang.String;
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
...

The class I was using has an instance field initialised as:
private SimpleDateFormat sdf = new SimpleDateFormat("MMddyyHHmmssSSS");

If I remove the field initialisation and initialise the field in a method, then all works fine.

I'm not sure what the problem is, it works fine under Tomcat, but is there some instance field initialisation issue within GAE? Or is it just SimpleDateFormat has a problem, perhaps a locale issue?

Anyway, thought I'd post it here as it took a lot of trial and error to find this issue. It may save someone else the time.

If there's an 'real' answer to the problem then it may appear here.

Tuesday, April 14, 2009

JSF Issues on the Google App Engine

Run this query to see the outstanding/requested JSF issues with the Google App Engine. Add your vote to the list :)

JSF and RichFaces on Google App Engine

A previous commenter noted that JBoss' RichFaces (Ajax4JSF) didn't work for them. I had a plan to use that so I initiated a simple test.

In fact, all I had to do was included the RichFaces 3.1.6SR1 jars and it blew up straight away with the following error:


org.apache.myfaces.webapp.StartupServletContextListener initFaces: Error initializing ServletContext
javax.faces.FacesException
at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:194)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:140)
...
Caused by: java.lang.NoClassDefFoundError: javax.imageio.ImageIO is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.apphosting.runtime.security.shared.stub.javax.imageio.ImageIO.<clinit>(ImageIO.java)
at org.ajax4jsf.resource.ResourceBuilderImpl.<clinit>(ResourceBuilderImpl.java:110)


Oh well, scrap that.

If you are interested in using RichFaces on GAE, then register a vote here and get Google to lift some of the restrictions on what classes can be used.

Thursday, April 09, 2009

JSF on Google App Engine with Facelets

Having tried JSF on Google Java App Engine, how about Facelets and JSF?

Works OK with MyFaces 1.1, see here for a test.

Wednesday, April 08, 2009

JSF on Google App Engine

OK, so Java on GAE is straight forward. See the previous post for a quick demo using GWT.

How about JSF? Hmm, not as straight forward if you are trying to use JSF 1.2 and MyFaces. In fact, I can't get it to work. I get as far as this error:

java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
at
org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:60)

Which would suggest that there is something wrong with the version of JSP that is being used? GAE uses Jetty under the covers, but I'm not sure which version. I would have thought it was a version that supports JSP 2.1, but who knows. The SDK comes with Geronimo JSP 2.1 and Servlet 2.5 jars, so you would think it would work.

Anyhoo, JSF works with MyFaces 1.1 and you can see a quick demo here. It doesn't do much at the moment, but I'll play around with it and see if I can do something a little better.

I have a Java/Swing application that uploads old Polar HRM data to the new Polar web site. This is an ideal application to convert to JSF/Facelets/RichFaces and host on GAE. Watch this space (well, come back in a few months ;) )

Java on Google App Engine

Cool. Google now host Java applications for free.

Here's my first app.

For more information, see this post for running Java in Eclipse. Very easy, very cool, very Google ;)