You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code :
InputStream in = new FileInputStream("DocxProjectWithVelocityList.docx");
/* InputStream in = DocxProjectWithVelocityList2PDF.class
.getResourceAsStream("DocxProjectWithVelocityList.docx");*/
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(
in, TemplateEngineKind.Velocity);
// 2) Create fields metadata to manage lazy loop (#foreach velocity) for table row.
FieldsMetadata metadata = report.createFieldsMetadata();
// Old API
/*
metadata.addFieldAsList("developers.Name");
metadata.addFieldAsList("developers.LastName");
metadata.addFieldAsList("developers.Mail");
*/
// NEW API
metadata.load( "developers", Developer.class, true );
// 3) Create context Java model
IContext context = report.createContext();
// Register project
Project project = new Project("XDocReport");
I am facing exception below 👍
Exception:
java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
at fr.opensagres.xdocreport.template.velocity.discovery.VelocityTemplateEngineDiscovery.createTemplateEngine(VelocityTemplateEngineDiscovery.java:51)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:78)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:42)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:76)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.getTemplateEngineKinds(TemplateEngineRegistry.java:118)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.onEndInitialization(TemplateEngineInitializerRegistry.java:166)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:87)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.getTemplateEngine(TemplateEngineInitializerRegistry.java:84)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:339)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:317)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:302)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:204)
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.context.Context
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
Dec 27, 2016 1:22:51 PM fr.opensagres.xdocreport.core.registry.AbstractRegistry initializeIfNeeded
WARNING: Error while registration of Discovery instance fr.opensagres.xdocreport.template.freemarker.discovery.FreemarkerTemplateEngineDiscovery@9d04653
java.lang.NoClassDefFoundError: freemarker/template/ObjectWrapper
at fr.opensagres.xdocreport.template.freemarker.discovery.FreemarkerTemplateEngineDiscovery.createTemplateEngine(FreemarkerTemplateEngineDiscovery.java:42)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:78)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:42)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:76)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.getTemplateEngineKinds(TemplateEngineRegistry.java:118)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.onEndInitialization(TemplateEngineInitializerRegistry.java:166)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:87)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.getTemplateEngine(TemplateEngineInitializerRegistry.java:84)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:339)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:317)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:302)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:204)
Caused by: java.lang.ClassNotFoundException: freemarker.template.ObjectWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
fr.opensagres.xdocreport.core.XDocReportException: Cannot find serializer. Please set the template engine FieldsMetadata#setTemplateEngineKind(String templateEngineKind) before calling this method.
at fr.opensagres.xdocreport.template.formatter.FieldsMetadata.load(FieldsMetadata.java:568)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:216)
The text was updated successfully, but these errors were encountered:
Hi,
My code :
InputStream in = new FileInputStream("DocxProjectWithVelocityList.docx");
/* InputStream in = DocxProjectWithVelocityList2PDF.class
.getResourceAsStream("DocxProjectWithVelocityList.docx");*/
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(
in, TemplateEngineKind.Velocity);
I am facing exception below 👍
Exception:
java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
at fr.opensagres.xdocreport.template.velocity.discovery.VelocityTemplateEngineDiscovery.createTemplateEngine(VelocityTemplateEngineDiscovery.java:51)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:78)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:42)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:76)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.getTemplateEngineKinds(TemplateEngineRegistry.java:118)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.onEndInitialization(TemplateEngineInitializerRegistry.java:166)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:87)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.getTemplateEngine(TemplateEngineInitializerRegistry.java:84)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:339)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:317)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:302)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:204)
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.context.Context
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
Dec 27, 2016 1:22:51 PM fr.opensagres.xdocreport.core.registry.AbstractRegistry initializeIfNeeded
WARNING: Error while registration of Discovery instance fr.opensagres.xdocreport.template.freemarker.discovery.FreemarkerTemplateEngineDiscovery@9d04653
java.lang.NoClassDefFoundError: freemarker/template/ObjectWrapper
at fr.opensagres.xdocreport.template.freemarker.discovery.FreemarkerTemplateEngineDiscovery.createTemplateEngine(FreemarkerTemplateEngineDiscovery.java:42)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:78)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.registerInstance(TemplateEngineRegistry.java:42)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:76)
at fr.opensagres.xdocreport.template.registry.TemplateEngineRegistry.getTemplateEngineKinds(TemplateEngineRegistry.java:118)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.onEndInitialization(TemplateEngineInitializerRegistry.java:166)
at fr.opensagres.xdocreport.core.registry.AbstractRegistry.initializeIfNeeded(AbstractRegistry.java:87)
at fr.opensagres.xdocreport.document.registry.TemplateEngineInitializerRegistry.getTemplateEngine(TemplateEngineInitializerRegistry.java:84)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:339)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:317)
at fr.opensagres.xdocreport.document.registry.XDocReportRegistry.loadReport(XDocReportRegistry.java:302)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:204)
Caused by: java.lang.ClassNotFoundException: freemarker.template.ObjectWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
fr.opensagres.xdocreport.core.XDocReportException: Cannot find serializer. Please set the template engine FieldsMetadata#setTemplateEngineKind(String templateEngineKind) before calling this method.
at fr.opensagres.xdocreport.template.formatter.FieldsMetadata.load(FieldsMetadata.java:568)
at fr.opensagres.xdocreport.samples.docxandvelocity.DocxProjectWithVelocityList2PDF.main(DocxProjectWithVelocityList2PDF.java:216)
The text was updated successfully, but these errors were encountered: