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

Incompatible net.sf.jasperreports.engine.JRDefault


fashist

Recommended Posts

Cann some one help me.

I want to create Report without datasourse. Only parameters should be sent to the report.

 

 

hier is Report and the exception.

 

How can i solve it????

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="Scannblatt"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="563"

columnSpacing="0"

leftMargin="2"

rightMargin="30"

topMargin="144"

bottomMargin="492"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false"

>

<property name="ireport.scriptlethandling" value="0" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

 

<parameter name="PARAM_1" isForPrompting="false" class="java.lang.String"/>

<parameter name="PARAM_2" isForPrompting="false" class="java.lang.String"/>

<parameter name="PARAM_3" isForPrompting="false" class="java.lang.String"/>

<parameter name="PARAM_4" isForPrompting="false" class="java.lang.String"/>

<parameter name="PARAM_5" isForPrompting="false" class="java.lang.String"/>

<parameter name="PARAM_6" isForPrompting="false" class="java.lang.String"/>

 

 

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="206" isSplitAllowed="true" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="0"

width="495"

height="24"

key="textField-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_1}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="186"

width="495"

height="20"

key="textField-3"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement verticalAlignment="Bottom">

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_6}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="38"

width="495"

height="20"

key="textField-4"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_2}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="77"

width="495"

height="20"

key="textField-5"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_3}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="114"

width="495"

height="20"

key="textField-6"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_4}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="68"

y="152"

width="495"

height="20"

key="textField-7"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Courier New" pdfFontName="Courier-Bold" size="14"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$P{PARAM_5}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

 

 

net.sf.jasperreports.engine.JRException: Incompatible net.sf.jasperreports.engine.JRDefaultScriptlet value assigned to parameter REPORT_SCRIPTLET in the Scannblatt dataset.

at net.sf.jasperreports.engine.fill.JRFillDataset.setParameter(JRFillDataset.java:873)

at net.sf.jasperreports.engine.fill.JRFillDataset.setFillParameterValues(JRFillDataset.java:640)

at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:596)

at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:879)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:708)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:123)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:420)

at de.media.ifa.vw.ProcessReportVWAction.processScanblatt(ProcessReportVWAction.java:65)

at java.lang.reflect.Method.invoke(Native Method)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

I'm also having the same problem.

 

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

 

I can't use a Scriptlet in a subreport

 

 

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

The exception I get is:

 

et.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Incompatible net.sf.jasperreports.engine.JRDefaultScriptlet value assigned to parameter REPORT_SCRIPTLET in the companyDataSheetReport_certifications dataset.

at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:582)

at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)

 

When I specify the scriptlet in a subreport.

 

Also, I'm already passing $P{REPORT_PARAMETERS_MAP} to the subreport.

Link to comment
Share on other sites

  • 3 months later...

Yea I am getting the same error. It only happens when I export multiple reports. One report is using a scriptlet and the other is not. JRException is

Incompatible net.sf.jasperreports.engine.JRDefaultScriptlet value assigned to parameter REPORT_SCRIPTLET

 

I have been trying to troubleshoot this for a while with no luck. Any help would be excellent. Im using JR 1.3.0.

Link to comment
Share on other sites

  • 1 month later...

Had the same error here for reports with subreports that have scriptlets. The subreports' scriptlets fail to initialize. Here is the 'offending' code:

 

In net.sf.jasperreports.engine.fill.JRFillDataset, force the creation of a new scriptlet for subreports:

 

Code:
..........
protected void setParameterValues(Map parameterValues) throws JRException
{
..........

// scriptlet = (JRAbstractScriptlet) parameterValues.get(JRParameter.REPORT_SCRIPTLET);
// if (scriptlet == null)
// {
scriptlet = createScriptlet();
parameterValues.put(JRParameter.REPORT_SCRIPTLET, scriptlet);
// }
scriptlet.setData(parametersMap, fieldsMap, variablesMap, groups);

........
}

 

Code:
[code]createScriptlet()
was never called for subreports because
Code:
[code]scriptlet
was initialized to
Code:
[code]new JRDefaultScriptlet()
(!= null) for the parent report.

 

I am guessing the intention was to force subreports to use the parent report's scriptlet in more recent versions of jasperreports.

Link to comment
Share on other sites

Hi,

I get the similar type of compatibility exception but not exactly what ur problem is:

check ur jar file whether it was properly placed in ear file of ur application.make sure ur jasper jar file should not be there any where ,i mean in war or ..but only in ear..

May ur problem be rectified.

i made the same mistake by keeping the jar in both ear and war file later on i rectified the mistake and its working properly now.

Link to comment
Share on other sites

I am looking for a workaround for the following problem, while upgrading from 0.6 to 1.3.3. Please help.

 

I have a report that contains a subreport. The subreport uses a scriptlet, while the main report does not.

 

In JRFillDataset, in the setParameterValues() method, 'scriptlet' is never 'null' for a subreport (because it is 'new JRDefaultScriptlet()', as created by the call to 'createScriptlet()' when initializing the scriptlet for the main report).

 

setParameterValues() {

....................

scriptlet = (JRAbstractScriptlet) parameterValues.get(JRParameter.REPORT_SCRIPTLET);

if (scriptlet == null)

{

scriptlet = createScriptlet();

parameterValues.put(JRParameter.REPORT_SCRIPTLET, scriptlet);

}

....................

 

Therefore, the subreport can never have its own scriptlet. The "Incompatible net.sf.jasperreports.engine.JRDefaultScriptlet value assigned to parameter REPORT_SCRIPTLET" exception is thrown.

 

Thank you in advance!

Link to comment
Share on other sites

I can't follow your argumentation. How does the fact that the scriptlet is never null imply that a subreport cannot have its own scriptlet?

 

Do you have a simple self-contained sample that illustrates this issue?

 

Are you by any chance using

Code:

<parametersMapExpression>$P{REPORT_PARAMETERS_MAP}</parametersMapExpression>

for the subreport?

 

Regards,

Lucian

Link to comment
Share on other sites

I had the similar problem with the incompatible for the scrptlet on subreports.

 

My solution was not using the same data map. In my first version I was using for the main report and the subreport the same data mapping.

But it seems that jasper is doing a lot of changes there. So simply using a new new data map

 

Map yourLocalMap = new HashMap();

yourLocalMap .putAll(yourMasterMap);

and adding the map for subreports with:
<paramteresMapExpression>$P{yourLocalMap }</parametersMapExcepression>

(as you can see I'm using a parameter for adding the map)

 

Btw. I nerver was reading that before but adding subreports into the summary is a good place to concatinate reports into one file.

 

Hope that is helping, best regards

Markus

Link to comment
Share on other sites

After nearly a day tinkering to try to work around

this bug, I found a way, at least for my reports.

 

Here's a description of the situation:

 

ReportA is the main report, it includes ReportB as a

subreport, and also has its own scriptlet.

 

ReportB uses a data source passed in from ReportA, but

does not need any scriptlet, and does not declare one.

 

In ReportA's <subreport> tag to include ReportB, I

have some simple markup:

 

Code:
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{REPORT_SCRIPTLET}.getMyOutputDataSource()]]></dataSourceExpression>

.. and the getMyDataSource() call in there does work.

That wasn't the problem.

 

The problem was that somehow, ReportA is passing in

its own definition of REPORT_SCRIPTLET, which ReportB

did not define at all, and the report engine probably

automatically chooses the wrong type for it. When

the automatic type and the type from ReportA do not

match up, the exception is thrown.

 

To fix this, all I had to do was:

 

In ReportB, set the exact same scriptlet settings as

in ReportA. Then, they both set the same type for

REPORT_SCRIPTLET, and the exception never happens.

 

If it is possible to not send ReportB the

REPORT_SCRIPTLET parameter at all, that would be

best, I suppose. I'm going to see if I can do that.

But, it would sure be nice if I didn't need to spend

time doing all this..

 

--

Jason Brittain

Link to comment
Share on other sites

Okay, I found a fix. Wherever you have a <subreport>

element to include a subreport, instead of doing this:

 

Code:
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>

 

.. do this instead:

 

Code:
[code]<parametersMapExpression><![CDATA[new HashMap($P{REPORT_PARAMETERS_MAP})]]></parametersMapExpression>

 

If I do that, with the subreport's .jrxml file not

using any scriptlet at all, the problem goes away.

No more exception about the REPORT_SCRIPTLET.

 

This is mentioned in passing in the docs, but nothing

is said about what might happen if you do not do it,

and no mention about this particular exception.

*sigh*

 

--

Jason Brittain

Link to comment
Share on other sites

  • 3 years later...
  • 5 months later...

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