この例外を取得:
fr.opensagres.xdocreport.core.XDocReportException: java.lang.NoSuchMethodError: freemarker.template.Configuration.setTagSyntax(I)V
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:151)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:775)
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:703)
at com.altruista.mp.dao.ContactSyncImpl$1.processRow(ContactSyncImpl.java:231)
at org.springframework.jdbc.core.JdbcTemplate$RowCallbackHandlerResultSetExtractor.extractData(JdbcTemplate.java:1607)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:708)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:752)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:762)
at com.altruista.mp.dao.ContactSyncImpl.applyRemoteChanges(ContactSyncImpl.java:128)
at com.altruista.mp.sync.SyncController.run(SyncController.java:137)
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:634)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:652)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
at com.altruista.mp.sync.Application.main(Application.java:19)
Caused by: java.lang.NoSuchMethodError: freemarker.template.Configuration.setTagSyntax(I)V
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.setFreemarkerConfiguration(FreemarkerTemplateEngine.java:184)
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.getDefaultConfiguration(FreemarkerTemplateEngine.java:256)
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.getFreemarkerConfiguration(FreemarkerTemplateEngine.java:174)
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:110)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
... 19 more
CONTACT: Couchbase [7207d5b6-cea2-48ee-8464-bc73ce21aa5f] <= SQL [ 582375 ]
java.io.FileNotFoundException: Template fr.opensagres.xdocreport.document.odt.ODTReport@fbe57c!content.xml not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:441)
at freemarker.template.Configuration.getTemplate(Configuration.java:404)
at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:110)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:775)
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:703)
at com.altruista.mp.dao.ContactSyncImpl$1.processRow(ContactSyncImpl.java:231)
at org.springframework.jdbc.core.JdbcTemplate$RowCallbackHandlerResultSetExtractor.extractData(JdbcTemplate.java:1607)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:708)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:752)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:762)
at com.altruista.mp.dao.ContactSyncImpl.applyRemoteChanges(ContactSyncImpl.java:128)
at com.altruista.mp.sync.SyncController.run(SyncController.java:137)
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:634)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:652)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
at com.altruista.mp.sync.Application.main(Application.java:19)
これらの依存関係を使用して:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template.freemarker</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.core</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.odt</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter.odt.odfdom</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<optional>true</optional>
</dependency>
コード付き
InputStream in= new FileInputStream(new File("src/main/resources/demoOffice.odt"));
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(
in, TemplateEngineKind.Freemarker);
// 2) Create Java model context
IContext context = report.createContext();
context.put("name", "world");
// 3) Set PDF as format converter
Options options = Options.getTo(ConverterTypeTo.PDF);
// 4) Generate report by merging Java model with the ODT and convert it to PDF
OutputStream outputStream = new FileOutputStream(new File("src/main/resources/demoOffice_Out.odt"));
report.convert(context, options, outputStream);
demoOffice.odt で:
hello ${name}!