I created a Hello World sample app in Gluon, and include freemarker libraries for testing. It is running in desktop version, but when I run in iOS, during the freemarker template loading, it is throwing this error:
[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log4j.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log4j.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log4j.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log4j.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.apache.log.Logger'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.apache.log.Logger</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'freemarker.core._2_4_OrLaterMarker'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>freemarker.core._2_4_OrLaterMarker</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.zeroturnaround.javarebel.ClassEventListener'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.zeroturnaround.javarebel.ClassEventListener</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'org.python.core.PyObject'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>org.python.core.PyObject</pattern></forceLinkClasses> to your robovm.xml file to link it in.
java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode
at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
at java.lang.PathClassLoader.findClass(PathClassLoader.java:193)
at java.lang.ClassLoader.loadClass(ClassLoader.java:515)
at java.lang.ClassLoader.loadClass(ClassLoader.java:475)
at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
at java.lang.PathClassLoader.findClass(PathClassLoader.java:193)
at java.lang.ClassLoader.loadClass(ClassLoader.java:515)
at java.lang.ClassLoader.loadClass(ClassLoader.java:475)
at freemarker.core.FMParser.Setting(FMParser.java:3604)
at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:3684)
at freemarker.core.FMParser.MixedContentElements(FMParser.java:4006)
at freemarker.core.FMParser.Root(FMParser.java:4652)
at freemarker.template.Template.<init>(Template.java:252)
at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:549)
at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:439)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:292)
at freemarker.template.Configuration.getTemplate(Configuration.java:2798)
at freemarker.template.Configuration.getTemplate(Configuration.java:2647)
at com.gluonapplication.BasicView.test(BasicView.java:86)
at com.gluonapplication.BasicView$1.handle(BasicView.java:49)
at com.gluonapplication.BasicView$1.handle(BasicView.java:40)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
I see some post mentioned, need to add forceLinkClasses
for iOS, so I added:
'freemarker.**.*',
'javax.swing.**.*'
It still doesn't work.
The error happen at line:
Configuration cfg = new Configuration(Configuration.VERSION_2_3_29);
cfg.setTemplateLoader(new ClassTemplateLoader(Thread.currentThread().getContextClassLoader(), "/"));
cfg.getTemplate("xxx/xxx"); // error here
This code is totally valid. I thought TreeNode
doesn't include in Gluon, so I tried this:
TreeNode treeNode = null;
This is working fine. So TreeNode
should be in there.
Can anyone please help advise what is the issue?
Try to use org.freemarker:freemarker-gae
instead of org.freemarker:freemarker
. The GAE variant is the same, without the Swing dependency.