Jasper iReport - export report to DOCX from Java servlet (problem)

0

Hi,

 

I tried to generate report in DOCX format from Java servlet, using Jasper iReport and the next code:

JRDocXExporter exporter = new JRDocxExporter(); exporter.setParameter(JRDocxExporterParameter.OUTPUT_FILE, new File(outFileName)); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.exportReport();

I am using Jasper iReport 3.7.3 and JBoss 5.0 server. Datasource for the report is a XML file.

In the last line (call exportReport()), JBoss generates this exception:

Caused by: java.net.URISyntaxException: Illegal character in path at index 115: vfszip:/D:/jboss-5.1.0.GA/server/default/lib/jasperreports-3.7.3.jar/net/sf/jasperreports/engine/export/ooxml/docx/[Content_Types].xml at java.net.URI$Parser.fail(URI.java:2809) at java.net.URI$Parser.checkChars(URI.java:2982) at java.net.URI$Parser.parseHierarchical(URI.java:3066) at java.net.URI$Parser.parse(URI.java:3014) at java.net.URI.<init>(URI.java:578) at org.jboss.virtual.VFSUtils.toURI(VFSUtils.java:505) at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.getFile(DefaultVFSRegistry.java:140)  ... 34 more

 

Generate PDF report is OK (without errors). Generate DOCX report directly from iReport is OK too.

I've tried to generate the report from standalone Java application and it's OK, but from servlet error happens.

Maybe, the problem is in some JBoss libraries - maybe there are some conflicts....

Also, the file in exception ([Content_Types].xml) consists invalid url as xml schema, but this file is in all jar archives which Jasper is using.

 

Does anyone have the same problem or any comments and/or suggestions?

 

Thanks,

Dragan

 

narancic's picture
Joined: Nov 10 2010 - 12:51am
Last seen: 2 months 1 week ago

1 Answer:

0

Hi, this was fixed by Teodor just a couple of weeks ago, if you can use jasperreports-4.0.0.jar and you will be fine.

dvm's picture
dvm
11
Joined: May 27 2010 - 3:31am
Last seen: 4 years 5 months ago
Feedback