iOS 的 Gluon 移动 NoClassDefFoundError
Gluon mobile NoClassDefFoundError for iOS
我在 Gluon 中创建了一个 Hello World 示例应用程序,并包含用于测试的 freemarker 库。它在桌面版本中是 运行ning,但是当我在 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.handle(BasicView.java:49)
at com.gluonapplication.BasicView.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)
我看到有人提到post,需要为iOS添加forceLinkClasses
,所以我添加了:
'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
应该在那里。
任何人都可以帮助告知问题是什么吗?
尝试使用 org.freemarker:freemarker-gae
而不是 org.freemarker:freemarker
。 GAE 变体是相同的,没有 Swing 依赖。
我在 Gluon 中创建了一个 Hello World 示例应用程序,并包含用于测试的 freemarker 库。它在桌面版本中是 运行ning,但是当我在 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.handle(BasicView.java:49)
at com.gluonapplication.BasicView.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)
我看到有人提到post,需要为iOS添加forceLinkClasses
,所以我添加了:
'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
应该在那里。
任何人都可以帮助告知问题是什么吗?
尝试使用 org.freemarker:freemarker-gae
而不是 org.freemarker:freemarker
。 GAE 变体是相同的,没有 Swing 依赖。