Я создал пример приложения Hello World в Gluon и включил библиотеки freemarker для тестирования. Он работает в настольной версии, но когда я запускаю iOS, во время загрузки шаблона freemarker он выдает следующую ошибку:
[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)
Я вижу упомянутое сообщение, необходимо добавить forceLinkClasses
для iOS, поэтому я добавил:
'freemarker.**.*',
'javax.swing.**.*'
Это все еще не работает.
Ошибка возникает в строке:
Configuration cfg = new Configuration(Configuration.VERSION_2_3_29);
cfg.setTemplateLoader(new ClassTemplateLoader(Thread.currentThread().getContextClassLoader(), "/"));
cfg.getTemplate("xxx/xxx"); // error here
Этот код полностью действителен . Я думал, что TreeNode
не входит в Gluon, поэтому попробовал следующее:
TreeNode treeNode = null;
Это работает нормально. Так что TreeNode
должно быть там.
Кто-нибудь, пожалуйста, помогите посоветовать, в чем проблема?