I would say freemarker sucks.
Yes it does. A template engine has dependency on javax.swing !!
Isnt that surprising?
Today, I was trying to deploy a Stripe/Freemarker hello world app on GAE and I got following.
java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode is a restricted class. Please see the Google App Engine developer's guide for more details.
Yes, you can not use freemarker on GAE, at least not without hacking it.
I found a patch here, seems that it would solve above exception.
Who knows that it wouldn’t have dependency on more classes. we can just hope for good.
Nope, above solution isn’t going to work all the time.
I had a quick look at the code, I think that the culprit is here.
abstract public class TemplateElement extends TemplateObject implements TreeNode
From the code, it seems that TemplateElement implements TreeNode
Just because it needs contract similar to TreeNode but it does not have any thing to do with swing API. (You already knew that)
Instead of implementing TreeNode, author could have created a new interface which exposes similar contract.
Do we implement any interface which exposes similar contract that we need? Context matters. EJB spec has some interface with methods that a servlet want doesn’t mean it can be implemented by a servlet.
Hope, devs would fix it in next release.
The issue is discussed in mailing list here http://n4.nabble.com/Dependeny-on-javax-swing-td978818.html
At the end, I would like to say, I like freemarker and that’s why I wrote even a hello world stripe application in freemarker.
Friends at freemarker has released a Freemarker GAE prerelease which can be downloaded here. It should work on GAE. Any one interested in running freemarker on GAE should try it and report issues if any.
see freemarker on GAE too.
No, still freemarker-gae-pre2 will not work on GAE, I have tested it on GAE 1.3.2. You will get one or both of the following exceptions
java.lang.VerifyError: (class: freemarker/ext/jsp/FreeMarkerJspApplicationContext, method: signature: ()V) Incompatible argument to function
java.lang.NoClassDefFoundError: Could not initialize class freemarker.ext.jsp.PageContextFactory
Waiting for the freemarker or GAE team to come up with explanation/solution.