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

subreports into subreports using jasperintelli


sandermoelands

Recommended Posts

Hello,

 

I need some help with a report template that I'm trying to deploy on a JasperIntellegence server. When using a main template with multiple subreports, the generation of the report works perfectly. (The subreports are added as resource of the reportunit).

 

When I try to use subreports in the subreports I already added, so:

 

-main report

--subreport

---subreport

--subreport

 

I get a NullPointerException when trying to generate the report. I've tried multiple links to different places in the repository, but nothing seems to be working. I also searched the forum for a similar problem, but couldn't find any.

 

Is this a known problem with the Jasper Intelligence server?

 

I'm using JasperIntelligence server version 1.0.1 deployed as a war file in a tomcat server version 5.5.17

 

I hope that someone can help me!!

Thank you in advance!

 

kind regards,

Sander Moelands

Link to comment
Share on other sites

  • Replies 13
  • Created
  • Last Reply

Top Posters In This Topic

Yes, the report does work properly from within iReport.

 

I have one paramater that I need to supply with the main template and that is passed to all of the subreports.

When I generate the report under JasperIntelligence, supplying the parameter with a control, it works for the main report with the first layer of subreports, but when I add the second layer of subreports, it brakes down.

 

Could you supply a simple example of a multi subreport layer setup (that works for you? (for example just showing an id?

Link to comment
Share on other sites

How are you referring to the 2nd level of subreports from the 1st level? The subreportExpression example below is pointing to a "local" sub report resource. How does your subreportExpression look?

 

Code:
<subreport  isUsingCache="true">
<reportElement
x="2"
y="2"
width="547"
height="43"
key="subreport-1"/>
<parametersMapExpression><![CDATA[new HashMap($P{REPORT_PARAMETERS_MAP})]]></parametersMapExpression>
<subreportParameter name="userid">
<subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression>$P{REPORT_CONNECTION}</connectionExpression>

<returnValue subreportVariable="SUM_amount_1" toVariable="user_total_deals"/>
<returnValue subreportVariable="avg_days_to_close" toVariable="user_avg_days_to_close"/>
<subreportExpression>"repo:«»SubReportDetail"</subreportExpression>
</subreport>

 

 

Sherman

JasperSoft

Link to comment
Share on other sites

This behaviour is caused by a bug in the JasperIntellegence code. Some required context information is missing for second level subreports.

 

The bug is fixed now. You can test (and use) the fix by including the attached jar in your web application.

 

There are also a couple of workarounds to the issue. If you can't/don't want to use the fix, I'll post them.

 

Regards,

Lucian [file name=jasperserver_api_engine_impl_0_fix.jar size=2085]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/jasperserver_api_engine_impl_0_fix.jar[/file]

Link to comment
Share on other sites

This is the subreport link I use from my main report to the first subreport:

 

Code:

<subreport isUsingCache="true">

<reportElement
x="0"
y="0"
width="535"
height="25"
key="subreport-1"
positionType="Float"/>

<subreportParameter name="IssueID">
<subreportParameterExpression><![CDATA[$P{IssueID}]]></subreportParameterExpression>
</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA["repo:BeleggingsStrategie"]]></subreportExpression>

</subreport>

 

 

This is the second subreport link I use from my first subreport:

 

Code:
[code]
<subreport isUsingCache="true">

<reportElement
x="0"
y="98"
width="531"
height="76"
key="subreport-1"/>

<subreportParameter name="IssueID">
<subreportParameterExpression><![CDATA[$P{IssueID}]]></subreportParameterExpression>
</subreportParameter>

<subreportExpression class="java.lang.String"><![CDATA["repo:Beleggingen"]]></subreportExpression>

</subreport>

 

I placed them both in the "local" resources folder of the main report.

 

Did I maybe incorrectly setup the folder structure in the repository of the JasperIntelligence server?

Link to comment
Share on other sites

lucianc wrote:

The bug is fixed now. You can test (and use) the fix by including the attached jar in your web application.

There are also a couple of workarounds to the issue. If you can't/don't want to use the fix, I'll post them.

Regards,
Lucian [file name=jasperserver_api_engine_impl_0_fix.jar size=2085]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/jasperserver_api_engine_impl_0_fix.jar[/file]

 

Hello.

Can you describe how exactly should I use this fix with JasperIntelligence and/or how to solve this problem without this fix?

Link to comment
Share on other sites

To use the fix, you simply have to include the fix jar in your web application, i.e. copy it to $TOMCAT/webapps/jasperserver/WEB-INF/lib.

 

Possible workarounds:

Use Javaflow continuations for subreport instead of threads.

 

To do this, you need to include the Javaflow in your web app and set this property in jasperreports.properties:

Code:
net.sf.jasperreports.subreport.runner.factory=net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory

(jasperreports.properties should be placed somewhere on the application classpath, e.g. under WEB-INF/classes).

 

You might also need to replace the JasperReports jar from the JasperIntelligence with one downloaded from the JR web site, I'm not sure whether the one included with JasperIntelligence is Javaflow-enabled.

Load the second subreport in the master and pass as a parameter to the first subreport:

Code:
[code]
//in the master
<subreport>
..
<subreportParameter name="SubreportB">
<subreportParameterExpression>
net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation("repo:«»SubreportB"«»)
</subreportParameterExpression>
</subreportParameter>
<subreportExpression>"repo:«»SubreportA"</subreportExpression>
</subreport>

//in the first subreport
<parameter name="SubreportB" class="net.sf.jasperreports.engine.JasperReport"/>

<subreport>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">$P{SubreportB}</subreportExpression>
</subreport>

[/ol]

 

Regards,

Lucian

Link to comment
Share on other sites

  • 3 months later...

I got a similar problem, is the fix already include in the newest version of jasperIntelligence?

 

 

This is in my master report:

Code:
<subreportExpression  class="java.lang.String"><![CDATA["repo:«»SUP_REPORT"]]></subreportExpression>

I loaded a report named SUP_REPORT in jasperIntelligence,

 

 

When I run the master report in jasperIntelligence it gives the follow error:

Code:
[code]java.lang.Exception: 1 - null
at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:503)
at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:409)
at com.jaspersoft.jasperserver.irplugin.ReportRunner.run(ReportRunner.java:66)
at java.lang.Thread.run(Unknown Source)

 

Any idea what causes this error?

And I noticed I needed to put the "url" in a string instead in a java URL, why?

 

Thanks in advance,

 

Niels,

Link to comment
Share on other sites

Are you sure it's a similar problem? The original issue involved nested subreports (i.e. subreports in subreports). The 1.1.0 release fixes this issue.

 

If you want to identify the cause of your error, check the Tomcat log since it seems that the exception details don't make it to the web service caller.

 

You have to specify the resource URL as String because the JI engine needs to control the java.net.URL instantiation so that this object can open a connection to read resource data from the repository. This is required because the standard Java URL handler registration mechanism is not suitable for a multi-application container such as Tomcat.

 

Regards,

Lucian

Link to comment
Share on other sites

You're right its not the same problem, its only a report linked to a subreport

 

This was the error:

Code:
2006-12-06 15:49:32,531 DEBUG [org.springframework.web.servlet.DispatcherServlet] Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'JSErrorPage'; model is {exception=org.springframework.webflow.ActionExecutionException: Exception thrown executing [AnnotatedAction@5128b9bc targetAction = com.jaspersoft.jasperserver.war.action.ViewReportAction@7621c3b0, attributes = map[[empty]]] in state 'verifyData' of flow 'viewReportFlow'; nested exception is java.lang.NullPointerException: null}
org.springframework.webflow.ActionExecutionException: Exception thrown executing [AnnotatedAction@5128b9bc targetAction = com.jaspersoft.jasperserver.war.action.ViewReportAction@7621c3b0, attributes = map[[empty]]] in state 'verifyData' of flow 'viewReportFlow'; nested exception is java.lang.NullPointerException: null
java.lang.NullPointerException
at com.jaspersoft.jasperserver.api.engine.jasperreports.util.repo.RepositoryConnection.getInputStream(RepositoryConnection.java:102)
at java.net.URL.openStream(URL.java:1007)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:139)
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:243)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:324)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:277)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1289)

 

I still cant figure out what i did wrong, note if i run the report without the subreport its works ifne.

 

 

Thanks in advance,

 

Niels

Link to comment
Share on other sites

I discoverd what I did wrong, I added the report and the sub_report with the ireport Plugin. When you add the reports with the normal browser it detects that there is a sub_report and asks you where its located.

 

This wont happen when adding it with the ireport plugin, so he gives a "missing attribute" error when running the report.

 

edit: I believe the sup_report should be located in the resources file at the report unit,

 

But i am not sure if can you get a nested sub report in the resources file,

Post edited by: Grazy Mos, at: 2006/12/07 10:36

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...