Jump to content
We've recently updated our Privacy Statement, available here ×

Earn 50 USD-Genuine! help 2fix a SubReport issue!


benoitx

Recommended Posts

Dear All,

Issue with XML and subReports in a JAR: SubReports are EMPTY (but not when running with iReport).

We’re stuck… so we’re calling upon the community again… but this time, we will give 50 USD to the first one who help us to find the answer (payment via PayPal).  If we find a solution before you, we will share it here and cancel our offer…

We have a rather weird problem:

·         1 Master report (billing-confirm.jrxml) calling a subReport (billing-per-txn.jrxml) that itself calls a subReport (billing-txn-accruals.jrxml).

·         DataSource is XML (billing3.xml)

·         The report is working fine with iReport 3.0.0 (see billing-ireport.pdf)

·         Using JasperReports 3.1.3 and the reports under a JAR, the Master report is filled in but the subsequent reports are NOT filled and left empty (using the same data source file 'billing3.xml', see billing-jboss.pdf).

The actual files are attached under forum.zip.

Why?

The reports are generated in com/appendium/pf/server/jasper directory in our JAR file. They are also compiled in such a directory structure with iReport. The Master report can find each subReport.

Could you have a look at our JRXML files and how they create a subDataSource? Are these correct?  I’d think that the problem is in identifying the datasource for the subreports…

MANY THANKS in advance and Good luck!

best regards from London

Benoit

 

We are filling the report this way:

String xml =…

InputStream resourceAsStream = ABaseClass.class.getResourceAsStream(“billing-confirm.jasper”);

final Object o = JRLoader.loadObject(resourceAsStream);

JasperReport reportTemplate = (JasperReport) o;

JRDataSource ds = new JRXmlDataSource(new ByteArrayInputStream(xml.getBytes()));              

JasperPrint report =JasperFillManager.fillReport(reportTemplate, new HashMap(), ds);

In the Master report we have:

<queryString language="xPath"><![CDATA[/list/correspondenceContent]]></queryString>

<subreport  isUsingCache="true">

<reportElement  mode="Opaque" x="1" y="57"  width="534" height="59" backcolor="#FFCCFF"

                key="subreport-1"/>

                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/correspondenceContent/trade/accrualsPerTransactions/accrualsPerTxn")]]></dataSourceExpression>

                <subreportExpression

 class="java.lang.String"><![CDATA["com/appendium/pf/server/jasper/billing-per-txn.jasper"]]></subreportExpression>

</subreport>

Link to comment
Share on other sites

  • Replies 19
  • Created
  • Last Reply

Top Posters In This Topic

I think the problem may be the way you are including the subreport.  I had a similar problem.

You are using a string
<subreportExpression class="java.lang.String"><![CDATA["com/appendium/pf/server/jasper/billing-per-txn.jasper"]]></subreportExpression>

</subreport>


when you should be using a report object..

<subreportExpression  class="net.sf.jasperreports.engine.JasperReport">
<![CDATA["com/appendium/pf/server/jasper/billing-per-txn.jasper"]]>
</subreportExpression>

Give that a try.

Good luck to both of us!

Link to comment
Share on other sites

Dear Blarsen,

Thanks for your contribution. Unfortunately, it seems that the report does not compile when using your suggestion.

    [jrc] net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:

    [jrc] C:projectsafemargin-protoservertargetclassesbilling45confirm_1232531302078_523922.java:259: inconvertible types
    [jrc] found   : java.lang.String
    [jrc] required: net.sf.jasperreports.engine.JasperReport
    [jrc]                 value = (net.sf.jasperreports.engine.JasperReport)("com/appendium/pf/server/jasper/billing-per-txn.jasp
er"); //$JR_EXPR_ID=19$
 

Should the expression be different that the CDATA[.... ?

Regards

Benoit
 

Code:
compileJasperReports:    [jrc] Compiling 1 report design files.    [jrc] File : C:projectsafemargin-protoserversrcmainjasperreportscomappendiumpfserverjasperbilling-confirm.jrxml ... FAILED.    [jrc] Error compiling report design : C:projectsafemargin-protoserversrcmainjasperreportscomappendiumpfserverjasperbilling-confirm.jrxml    [jrc] net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:    [jrc] C:projectsafemargin-protoservertargetclassesbilling45confirm_1232531302078_523922.java:259: inconvertible types    [jrc] found   : java.lang.String    [jrc] required: net.sf.jasperreports.engine.JasperReport    [jrc]                 value = (net.sf.jasperreports.engine.JasperReport)("com/appendium/pf/server/jasper/billing-per-txn.jasper"); //$JR_EXPR_ID=19$    [jrc]                                                                   ^    [jrc] C:projectsafemargin-protoservertargetclassesbilling45confirm_1232531302078_523922.java:377: inconvertible types    [jrc] found   : java.lang.String    [jrc] required: net.sf.jasperreports.engine.JasperReport    [jrc]                 value = (net.sf.jasperreports.engine.JasperReport)("com/appendium/pf/server/jasper/billing-per-txn.jasper"); //$JR_EXPR_ID=19$    [jrc]                                                                   ^    [jrc] C:projectsafemargin-protoservertargetclassesbilling45confirm_1232531302078_523922.java:495: inconvertible types    [jrc] found   : java.lang.String    [jrc] required: net.sf.jasperreports.engine.JasperReport    [jrc]                 value = (net.sf.jasperreports.engine.JasperReport)("com/appendium/pf/server/jasper/billing-per-txn.jasper"); //$JR_EXPR_ID=19$    [jrc]                                                                   ^    [jrc] 3 errors    [jrc]    [jrc]       at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:195)    [jrc]       at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:219)    [jrc]       at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:135)    [jrc]       at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:117)    [jrc]       at net.sf.jasperreports.ant.JRAntCompileTask.compile(JRAntCompileTask.java:413)    [jrc]       at net.sf.jasperreports.ant.JRAntCompileTask.execute(JRAntCompileTask.java:259)    [jrc]       at org.apache.tools.ant.Task.perform(Task.java:364)    [jrc]       at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)    [jrc]       at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)    [jrc]       at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:83)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:116)    [jrc]       at org.apache.maven.werkz.Goal.fire(Goal.java:691)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:623)    [jrc]       at org.apache.maven.werkz.WerkzProject.attainGoal(WerkzProject.java:209)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:115)    [jrc]       at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)    [jrc]       at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)    [jrc]       at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)    [jrc]       at org.apache.maven.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:110)    [jrc]       at org.apache.maven.werkz.Goal.firePostGoalCallbacks(Goal.java:763)    [jrc]       at org.apache.maven.werkz.Goal.fire(Goal.java:705)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:623)    [jrc]       at org.apache.maven.werkz.Goal.attainPrecursors(Goal.java:526)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:621)    [jrc]       at org.apache.maven.werkz.Goal.attainPrecursors(Goal.java:526)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:621)    [jrc]       at org.apache.maven.werkz.Goal.attainPrecursors(Goal.java:526)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:621)    [jrc]       at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:712)    [jrc]       at org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)    [jrc]       at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:370)    [jrc]       at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)    [jrc]       at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:83)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:116)    [jrc]       at org.apache.maven.werkz.Goal.fire(Goal.java:691)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:623)    [jrc]       at org.apache.maven.werkz.WerkzProject.attainGoal(WerkzProject.java:209)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:115)    [jrc]       at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)    [jrc]       at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:83)    [jrc]       at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:116)    [jrc]       at org.apache.maven.werkz.Goal.fire(Goal.java:691)    [jrc]       at org.apache.maven.werkz.Goal.attain(Goal.java:623)    [jrc]       at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:712)    [jrc]       at org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)    [jrc]       at org.apache.maven.cli.App.doMain(App.java:307)    [jrc]       at org.apache.maven.cli.App.main(App.java:217)    [jrc]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    [jrc]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)    [jrc]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    [jrc]       at java.lang.reflect.Method.invoke(Method.java:585)    [jrc]       at com.werken.forehead.Forehead.run(Forehead.java:551)    [jrc]       at com.werken.forehead.Forehead.main(Forehead.java:581)------------------------------------------------------------------------------->> Unable to obtain goal [app:build]>> Unable to obtain goal [java:compile]>> Errors were encountered when compiling report designs.-------------------------------------------------------------------------------
Link to comment
Share on other sites

If I run you packed sample within iReport I get error "could not load object from location" because my iReport can't find the JasperFiles you referenced within the SubReport-Expressions.

So if your sample zip runs fine within iReport, it seems, that you have your jar or ear within iReports-Classpath. Otherwise you couldn't load the jasper-files from folder!??!?!

So I changed your sample with introducing a paramater "$P{package}" that has as default value "com/appendium/pf/server/jasper/" and made this parameter interactive... so I can run it from iReport with current directory and if you want to run it from JBoss you must just pass the parameter "package" with the correct value ("com/appendium/pf/server/jasper/")  (i even wouldn't use the default value, if your package structure will change when refactoring, you might forget to change the default values also).

But this is just the loading of jasper files -  that works now with the package parameter.

As I never worked with XML DataSources i can't give you good hints but as it works in iReport but not in JBoss I would check:

- same libs (XPath!?)

- JBoss security issues when local files are used (Try to include the xml (just for test) into the jar and load it from there before filling - just to see if JBoss blocks when calling the SubReport (don't know if the XML file is used a second time when SubReport starts)

- preload the SubReport data into a "net.sf.jasperreports.engine.data.JRXmlDataSource" and pass this as parameter and use this parameter for datasourceexpression instead creating it at runtime (just to see if the expression ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/accrualsPerTxn/details/accrualTxnDetails") causes the error.

good luck + regards from rainy Germany

C-Box

 

Link to comment
Share on other sites

Hi,

 

I suspect the problem is not with the datasource or the subreport files (because we would have seen an error being raised), but rather a more common font metrics problem.

Do you have JBoss running on Linux? Or in any case, a platform that is different than the one you are running iReport (Windows?).

In case you indeed run the report on different platforms, fonts become an issue, as explained in this FAQ here:

http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/faq.html?group_id=252#FAQ25

 

Try make all the text fields in those subreports stretchWithOverflow="true".

 

I hope this helps.

Teodor

 

 

Link to comment
Share on other sites

Hi Teodor,

Thanks for pointing this to me, it will be useful but unfortunately at the moment, we're using windows XP 32bit for both iReport and JBoss.

I have however changed all textfields as follow:

<textField isStretchWithOverflow="true"

But it does not change the issue. See the log from JBoss, it keeps saying:

Fill 27349545: no data

Any suggestion?

thanks

Benoit

Code:
11:37:23,578 DEBUG [ExtensionsEnvironment][correspondenceMDPListenerContainer-1] Instantiating extensions registry class net.sf.jasperreports.extensions.DefaultExtensionsRegistry11:37:23,593 DEBUG [DefaultExtensionsRegistry][correspondenceMDPListenerContainer-1] Loading JasperReports extension properties resource jar:file:/C:/java/jboss-4.0.5.GA/server/default/tmp/deploy/tmp24292appendium-ear-1.0.ear-contents/appendium-ejb-1.0.jar-contents/jasperreports-3.1.3.jar!/jasperreports_extension.properties11:37:23,593 DEBUG [DefaultExtensionsRegistry][correspondenceMDPListenerContainer-1] Instantiating extensions registry for default using factory class net.sf.jasperreports.extensions.DefaultExtensionsRegistryFactory11:37:23,953 DEBUG [JRBaseFiller][correspondenceMDPListenerContainer-1] Fill 11439156: created for billing-confirm11:37:24,140 DEBUG [JRBaseFiller][correspondenceMDPListenerContainer-1] Fill 11439156: filling report11:37:24,187 DEBUG [JRBaseFiller][correspondenceMDPListenerContainer-1] Fill 11439156: adding page 111:37:24,187 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: title11:37:24,312 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: page header11:37:24,312 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: column header11:37:24,312 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: detail11:37:24,343 DEBUG [JRFillSubreport][correspondenceMDPListenerContainer-1] Fill 11439156: creating subreport filler11:37:24,343 DEBUG [JRBaseFiller][correspondenceMDPListenerContainer-1] Fill 27349545: created for billing-per-txn11:37:24,359 DEBUG [JRFillSubreport][correspondenceMDPListenerContainer-1] Fill 11439156: starting 2734954511:37:24,359 DEBUG [JRThreadSubreportRunner][correspondenceMDPListenerContainer-1] Fill 27349545: starting thread Thread[billing-per-txn subreport filler,5,jboss]11:37:24,359 DEBUG [JRBaseFiller][billing-per-txn subreport filler] Fill 27349545: filling report11:37:24,359 DEBUG [JRThreadSubreportRunner][correspondenceMDPListenerContainer-1] Fill 27349545: waiting for fill result11:37:24,359 DEBUG [JRVerticalFiller][billing-per-txn subreport filler] Fill 27349545: no data11:37:24,359 DEBUG [JRVerticalFiller][billing-per-txn subreport filler] Fill 27349545: no pages11:37:24,359 DEBUG [JRBaseFiller][billing-per-txn subreport filler] Fill 27349545: ended11:37:24,359 DEBUG [JRThreadSubreportRunner][billing-per-txn subreport filler] Fill 27349545: notifying of completion11:37:24,359 DEBUG [JRThreadSubreportRunner][correspondenceMDPListenerContainer-1] Fill 27349545: notified of fill result11:37:24,359 DEBUG [JRFillSubreport][correspondenceMDPListenerContainer-1] Fill 11439156: subreport 27349545 finished11:37:24,375 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: summary11:37:24,375 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: column footer11:37:24,375 DEBUG [JRVerticalFiller][correspondenceMDPListenerContainer-1] Fill 11439156: last page footer11:37:24,375 DEBUG [JRBaseFiller][correspondenceMDPListenerContainer-1] Fill 11439156: ended11:37:24,421 DEBUG [serverProperties][correspondenceMDPListenerContainer-1] using client-agnostic entry for property confirmations.outputDir
Link to comment
Share on other sites

Hi, Benoit

 

I take back what I said about fonts, because then I looked at the PDFs and they indeed seemed to use the exact same fonts, so no font metrics was involved.

In this case, I can only suggest what C-Box mentioned earlier. The most probable cause is that iR and JBoss use different versions of the XPath interpreter (Xalan?), which causes the sub-queries to return different results. Seems like under JBoss the sub-query returns nothing, silently. What you can do is to make the subreport template whenNoDataType="NoDataSection" and put something in the <noData> section of the subreport templates.

This way it should be obvious the subreport is empty.

 

I hope this helps.

Teodor



Post Edited by Teodor Danciu at 01/21/09 11:57
Link to comment
Share on other sites

Dear C-Box,

Thanks for your input. I should have said that we did change the iReport build directory to match the package structure, com/appendium/pf/server/jasper

I really do not think that the issue is related to not finding the subreport as we used to get exceptions on this matter (see other thread under 'subreport in a JAR' subject). This was fixed thanks to a few suggestions.

Your post however made me realise that although the JRXML files are IDENTICAL in both situation, the iReport does compile the files to java and then Jasper and so does our build process using Maven.

I enclose the way we do the Maven Build...

Unfortunately, we I do check if the java files are different, they are hardly so... certainly not in any way that would justify the issue I would think.

I did put the .jasper files generated by iReport in our JAR directly but the issue is the same... I enclose 2 sets of java files, is there any issue between the files?

We're using iReport 3.0.0 and JasperReports 3.1.3

This is really spooky issue...

Thanks a lot

Benoit

Code:
<goal name="compileJasperReports">	<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">		<ant:classpath>			<ant:path refid="maven.dependency.classpath" />		</ant:classpath>	</taskdef>	<ant:jrc srcdir="${basedir}/src/main/jasperreports" destdir="${maven.build.dest}" tempdir="${maven.build.dest}" keepjava="true" xmlvalidation="true">		<ant:classpath>			<ant:path refid="maven.dependency.classpath" />			<ant:pathelement path="${maven.build.dest}" />		</ant:classpath>		<ant:include name="**/*.jrxml" />	</ant:jrc></goal>
Link to comment
Share on other sites

Hi Teodor,

Thanks for your reply. I have now added a noData section (see below) in my FIRST sub report.

This does not seem to have made any difference... Where should it be put? staright after </summary>? This does not seem to have generated anything by the compiler (I enclose the java code generated).. Is this a new feature? Does the JasperReports 3.1.3 compile this?

Is there a way to figure out / print which compiler is used?

I've started to investigate the Xalan suggestion and it seems that iReport may be using Xalan 2.6 whislt JBoss/lib/endorsed is using Xalan 2.7.

I then put the JBOSS versions of xalan.jar, xercesImpl.jar, xml-apis.jar in iReport-3.0.0/lib assuming that it should now fail to run the report... but no, the report is ok...

I have also put the xalan.jar in my JAR file (inside the EAR) and inside the ejb.manifest.classpath... no change!

It is getting weirder by the minute... I must be doing something very very stupid...

Your help is appreciated

Thanks

Benoit

Code:
  <noData>   <band height="150"  isSplitAllowed="true" >    <ellipse>     <reportElement      x="134"      y="9"      width="276"      height="31"      key="ellipse-1"/>     <graphicElement stretchType="NoStretch"/>    </ellipse>    <staticText>     <reportElement      x="198"      y="14"      width="172"      height="16"      key="staticText-1"/>     <box></box>     <textElement>      <font/>     </textElement>    <text><![CDATA[NOTHING TO SHOW, GO AWAY...]]></text>    </staticText>   </band>  </noData>
Link to comment
Share on other sites

Hi Teodor,

I noticed that problem just AFTER posting the reply... typical.

Yes, it now shows the noDataSection (see attached).

So, we have now proved that the sub report is called but that the dataSource is empty.

This seems to point to XALAN issue... so:

1/ is it only xalan.jar ? or should I also try with xml-apis.jar and xercesImpl.jar? What about xml-apis-ext.jar? it is in iReport/lib but not Jboss

2/ if I replace the iReport/lib with the versions from Jboss, the report still works... why?

3/ How could I force my JAR inside my EAR only to use a specific version of xalan?

So many questions.. so little time...

Any suggestions?

Thanks

Benoit

Link to comment
Share on other sites

I can't put the iReport xalan.jar, xml-apis.jar and xercesImpl.jar in the JBoss/lib/endorsed (JBoss 4.0.5) as it will not start JBoss.

 

Any suggestion? Is there some login we could add to detect more on the xpath issue? I'm willing to run a 'debug' version of JasperReport to get to the bottom of this...

 

I have also replaced JasperReports-3.0.0.jar in iReport/lib with 3.1.3; it still works under iReport but not with JBoss...

 

...Help...

Link to comment
Share on other sites

Hi,

Put xalan back in jboss and try something else.

JR offers the possibility to use the Jaxen interpretter, instead of Xalan. Jaxen also has the advantage of being faster.

So you should download the Jaxen JAR (or get it from the JR project lib dir) and then set this property inside the jasperreports.properties file:

net.sf.jasperreports.xpath.executer.factory=net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory

This way you make sure there's no Xalan mismatch problem as both iR and Jboss will use Jaxen (hopefully Jboss does not come with its version of Jaxen as well).

You can see in the /demo/samples/xmldatasource sample of JR, where that property is commented out.

 

I hope this helps.

Teodor

 



Post Edited by Teodor Danciu at 01/21/09 17:38
Link to comment
Share on other sites

That sound like a good plan but...

1/ is there a way to force iReport to use jaxen too?

I have added the jasperreports.properties file (enclosed) in the top package of my jar which is in a jar inside the ear...

2/ Does it log where it is loading that properties file?

All I get is the following log  and I have the suspicion that it is not using jaxen... the PDF is the same...

It does show where the extension is loaded but not the jasperreports properties.

To prove my point, I have removed jaxen from the ear file and left the jasperreports.properties, assuming that it'd throw an exception when trying to get a Jaxen class... nope! So I'm having problem to ensure using that jasperreports.properties...

Thanks!

Benoit

 

Code:
2009-01-21 17:57:09,083 DEBUG [extensions.ExtensionsEnvironment#correspondenceMDPListenerContainer-1] Instantiating extensions registry class net.sf.jasperreports.extensions.DefaultExtensionsRegistry2009-01-21 17:57:09,083 DEBUG [extensions.DefaultExtensionsRegistry#correspondenceMDPListenerContainer-1] Loading JasperReports extension properties resource jar:file:/C:/java/jboss-4.0.5.GA/server/default/tmp/deploy/tmp36451appendium-ear-1.0.ear-contents/appendium-ejb-1.0.jar-contents/jasperreports-3.1.3.jar!/jasperreports_extension.properties2009-01-21 17:57:09,099 DEBUG [extensions.DefaultExtensionsRegistry#correspondenceMDPListenerContainer-1] Instantiating extensions registry for default using factory class net.sf.jasperreports.extensions.DefaultExtensionsRegistryFactory2009-01-21 17:57:09,708 DEBUG [fill.JRBaseFiller#correspondenceMDPListenerContainer-1] Fill 31120972: created for billing-confirm2009-01-21 17:57:10,067 DEBUG [fill.JRBaseFiller#correspondenceMDPListenerContainer-1] Fill 31120972: filling report2009-01-21 17:57:10,161 DEBUG [fill.JRBaseFiller#correspondenceMDPListenerContainer-1] Fill 31120972: adding page 12009-01-21 17:57:10,161 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: title2009-01-21 17:57:10,364 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: page header2009-01-21 17:57:10,395 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: column header2009-01-21 17:57:10,395 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: detail2009-01-21 17:57:10,442 DEBUG [fill.JRFillSubreport#correspondenceMDPListenerContainer-1] Fill 31120972: creating subreport filler2009-01-21 17:57:10,442 DEBUG [fill.JRBaseFiller#correspondenceMDPListenerContainer-1] Fill 10575295: created for billing-per-txn2009-01-21 17:57:10,474 DEBUG [fill.JRFillSubreport#correspondenceMDPListenerContainer-1] Fill 31120972: starting 105752952009-01-21 17:57:10,474 DEBUG [fill.JRThreadSubreportRunner#correspondenceMDPListenerContainer-1] Fill 10575295: starting thread Thread[billing-per-txn subreport filler,5,jboss]2009-01-21 17:57:10,474 DEBUG [fill.JRThreadSubreportRunner#correspondenceMDPListenerContainer-1] Fill 10575295: waiting for fill result2009-01-21 17:57:10,474 DEBUG [fill.JRBaseFiller#billing-per-txn subreport filler] Fill 10575295: filling report2009-01-21 17:57:10,474 DEBUG [fill.JRVerticalFiller#billing-per-txn subreport filler] Fill 10575295: no data2009-01-21 17:57:10,474 DEBUG [fill.JRVerticalFiller#billing-per-txn subreport filler] Fill 10575295: all sections2009-01-21 17:57:10,474 DEBUG [fill.JRVerticalFiller#billing-per-txn subreport filler] Fill 10575295: noData2009-01-21 17:57:10,489 DEBUG [fill.JRBaseFiller#billing-per-txn subreport filler] Fill 10575295: ended2009-01-21 17:57:10,489 DEBUG [fill.JRThreadSubreportRunner#billing-per-txn subreport filler] Fill 10575295: notifying of completion2009-01-21 17:57:10,489 DEBUG [fill.JRThreadSubreportRunner#correspondenceMDPListenerContainer-1] Fill 10575295: notified of fill result2009-01-21 17:57:10,489 DEBUG [fill.JRFillSubreport#correspondenceMDPListenerContainer-1] Fill 31120972: subreport 10575295 finished2009-01-21 17:57:10,505 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: summary2009-01-21 17:57:10,505 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: column footer2009-01-21 17:57:10,505 DEBUG [fill.JRVerticalFiller#correspondenceMDPListenerContainer-1] Fill 31120972: last page footer2009-01-21 17:57:10,505 DEBUG [fill.JRBaseFiller#correspondenceMDPListenerContainer-1] Fill 31120972: ended
Link to comment
Share on other sites

QUICK UPDATE

-------------------------

Ignore previous post, JBoss had a 'spare' jaxen library (1.1-beta9) in its server/default/lib library.

I have removed it and added a jasperreports.properties in my ear file which initially failed as expected as I had not included the jaxen-1.1.1.jar.

Once I added the jaxen jar, it ran the report ok, it seems to be faster... BUT... the subreports are still empty....

I must have done something wrong with the dataSource, Teodor, could you have a look (in the original forum.zip) and tell me my stupid mistake...

Also, how could we force iReport to use Jaxen?

Thanks a lot!

Benoit

Link to comment
Share on other sites

Hi All,

First of all, thanks a lot for helping. We have found a way around...

It seems that the issue is related to the way we call Jasper to fill the report. It is rather confusing that the Master report was filled ok but not the sub reports.

We used to call:

JasperReport reportTemplate = ....

final String xml = generateXml(); // our method

JRDataSource ds = new JRXmlDataSource(new ByteArrayInputStream(xml.getBytes()));

JasperReport report = JasperFillManager.fillReport(reportTemplate, new HashMap(), ds);

And that works ok for the master report... it implies that Jasper itself needs to do the parsing of the XML string.

I have changed this to creating the XML document and giving it to jasper:

JasperReport reportTemplate = ....

final String xml = generateXml(); // our method

Document document = JRXmlUtils.parse(new ByteArrayInputStream(xml.getBytes()));

Map params = new HashMap();

params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
params.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, "yyyy-MM-dd");
params.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, "#,##0.##");
params.put(JRXPathQueryExecuterFactory.XML_LOCALE, Locale.ENGLISH);
JasperReport report = JasperFillManager.fillReport(reportTemplate, params);

And this is working... I have no idea why... any explanation would be welcome!

The 50 USD offer is cancelled, sorry...

Best regards from a rainy London!

Benoit

Link to comment
Share on other sites

  • 2 months later...
  • 8 months later...

Hi, Jeff

 

I don't want to dissapoint you, but your solution is actually wrong. You'll leave a trail of unclosed input streams that might cause you trouble in certain cases.

The correct solution is even simpler. Since you have put the *.jasper file in the classpath (as recommended), you just need to use a String subreport expression and the resource path. JR will open an input stream just the way you tried, but will also close it when done. It will even cache the subreport template object and not read it every time the subreport gets generated.

<subreportExpression class="java.lang.String"><![CDATA["/com/app/subreport.jasper"]]></subreportExpression>

 

Please avoid adding to a very long thread like this one. It would be better to create a new thread, even if you think it is a similar problem. Long threads are difficult to follow and become useless to others.

 

Thank you,

Teodor

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...