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

Basic Crosstab but "Class not set for bucket" when compiling


mytval

Recommended Posts

 Hi,
 
I'm trying to build a report with a crosstab within the summary band.
I added my dataset and I can preview the data correctly.
I also can fill the column (host) and row (service) of my crosstab correctly.
 
But when I get to compile my report I have this error message, concerning my row and column fields: see code 
 
 
Any suggestion?
Cheers,
M. 
Code:


Post Edited by mytval at 08/25/2011 20:44
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  I got it working. 

Actually when I switched to the XML view, I realized there were no class declaration when using the concerned field. 

Indeed I had:

<bucket>

<bucketExpression><![CDATA[$F{host}]]></bucketExpression>

</bucket>

 

instead of:

<bucket class="java.lang.String">

<bucketExpression><![CDATA[$F{host}]]></bucketExpression>

</bucket>

 

I set the missing daclarations and It worked!!!!

Could someone tell me how to make it work automatically ?

Link to comment
Share on other sites

  • 1 month later...
  • 11 months later...

I am getting following error please given me solution. Is it jasper not support to crosstab all functionality?

PLease given me reply early as possible

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BlaineTest" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
 <property name="ireport.zoom" value="1.0"/>
 <property name="ireport.x" value="0"/>
 <property name="ireport.y" value="0"/>
 <style name="Crosstab Data Text" hAlign="Center"/>
 <queryString>
  <![CDATA[sELECT     '1' AS srl, 'Blaine' AS Descr, rnd_ba_cd, rnd_testingPlant, rnd_smpl, rnd_Blaine AS value
FROM         (SELECT     CASE SMPL_CD WHEN '1' THEN 'PPC' WHEN '2' THEN 'OPC' WHEN '3' THEN 'PSC' END AS rnd_smpl, ManuPlantCD AS rnd_ba_cd,
                                              BA_CD AS rnd_testingPlant, BLAINE AS rnd_Blaine, IR AS rnd_IR, SO3 AS rnd_SO3, SETTING_TIME_INITIAL AS rnd_ist,
                                              SETTING_TIME_FINAL AS rnd_fst, DAY1_STRENGTH_MPH AS rnd_Day1Mpa, DAY28_STRENGTH_MPH AS rnd_Day28Mpa
                       FROM          T_SAMPLES_RND
                       WHERE      (MONTH(SMPL_COLLECTION_DT) = 8) AND (YEAR(SMPL_COLLECTION_DT) = 2012) AND (Collection_flag = 1)) AS RND
UNION
SELECT     '1' AS srl, 'Blaine' AS descr, BA_CD AS rnd_ba_cd, 'BIS' AS rnd_testingPlant,
                      CASE SmplCD WHEN 'PPC -P' THEN 'PPC'  END AS rnd_smpl, BISBlaine AS value
FROM         M_sample
WHERE     (SmplCD IN ('PPC -P')) AND (BA_CD IN
                          (SELECT DISTINCT ManuPlantCD
                            FROM          T_SAMPLES_RND AS T_SAMPLES_RND_2
                            WHERE      (MONTH(SMPL_COLLECTION_DT) = 8) AND (YEAR(SMPL_COLLECTION_DT) = 2012) AND (Collection_flag = 1) ))
UNION
SELECT     '1' AS srl, 'Blaine' AS Descr, BA_CD AS rnd_ba_cd, 'Week_PlantAVG' AS rnd_testingPlant, rnd_smpl, BLAINE AS value
FROM         (SELECT     a.BA_CD, a.SMPL_CD,
                                              CASE SMPLNAME WHEN 'PPC -P' THEN 'PPC' END AS rnd_smpl, m.SmplName,
                                              AVG(a.DAY1_STRENGTH_MPH) AS Day1Mpa, AVG(a.DAY28_STRENGTH_MPH) AS Day28Mpa, AVG(a.SO3) AS SO3, AVG(a.IR) AS IR,
                                              AVG(a.BLAINE) AS BLAINE, AVG(a.SETTING_TIME_INITIAL) AS ist, AVG(a.SETTING_TIME_FINAL) AS lst
                       FROM          T_SAMPLES_AQP AS a INNER JOIN
                                              M_sample AS m ON a.SMPL_CD = m.SmplUID AND a.BA_CD = m.BA_CD
                       WHERE      (a.BA_CD IN
                                                  (SELECT DISTINCT ManufPlantCD
                                                    FROM          T_SMPLRNDCollection
                                                    WHERE      (MONTH(PQMCollDate) = 8) AND (YEAR(PQMCollDate) = 2012))) AND (DATEPART(wk, a.SMPL_COLLECTION_DT) = 28) AND
                                              (m.SmplName IN ('PPC -P'))
                       GROUP BY a.BA_CD, a.SMPL_CD, m.SmplName) AS abc]]>
 </queryString>
 <field name="srl" class="java.lang.String"/>
 <field name="Descr" class="java.lang.String"/>
 <field name="rnd_ba_cd" class="java.lang.String"/>
 <field name="rnd_testingPlant" class="java.lang.String"/>
 <field name="rnd_smpl" class="java.lang.String"/>
 <field name="value" class="java.math.BigDecimal"/>
 <background>
  <band splitType="Stretch"/>
 </background>
 <title>
  <band height="60" splitType="Stretch"/>
 </title>
 <pageHeader>
  <band splitType="Stretch"/>
 </pageHeader>
 <columnHeader>
  <band splitType="Stretch"/>
 </columnHeader>
 <detail>
  <band splitType="Stretch"/>
 </detail>
 <columnFooter>
  <band splitType="Stretch"/>
 </columnFooter>
 <pageFooter>
  <band splitType="Stretch"/>
 </pageFooter>
 <summary>
  <band height="363" splitType="Stretch">
   <crosstab>
    <reportElement x="0" y="0" width="802" height="363"/>
    <rowGroup name="rnd_ba_cd" width="70" totalPosition="End">
     <bucket class="java.lang.String">
      <bucketExpression><![CDATA[$F{rnd_ba_cd}]]></bucketExpression>
     </bucket>
     <crosstabRowHeader>
      <cellContents backcolor="#F0F8FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <textField>
        <reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/>
        <textElement/>
        <textFieldExpression><![CDATA[$V{rnd_ba_cd}]]></textFieldExpression>
       </textField>
      </cellContents>
     </crosstabRowHeader>
     <crosstabTotalRowHeader>
      <cellContents backcolor="#005FB3" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <staticText>
        <reportElement x="0" y="0" width="140" height="25" forecolor="#FFFFFF"/>
        <textElement textAlignment="Center" verticalAlignment="Middle"/>
        <text><![CDATA[Total rnd_ba_cd]]></text>
       </staticText>
      </cellContents>
     </crosstabTotalRowHeader>
    </rowGroup>
    <rowGroup name="rnd_smpl" width="70" totalPosition="End">
     <bucket class="java.lang.String">
      <bucketExpression><![CDATA[$F{rnd_smpl}]]></bucketExpression>
     </bucket>
     <crosstabRowHeader>
      <cellContents backcolor="#F0F8FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <textField>
        <reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/>
        <textElement/>
        <textFieldExpression><![CDATA[$V{rnd_smpl}]]></textFieldExpression>
       </textField>
      </cellContents>
     </crosstabRowHeader>
     <crosstabTotalRowHeader>
      <cellContents backcolor="#BFE1FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <staticText>
        <reportElement x="0" y="0" width="70" height="25"/>
        <textElement textAlignment="Center" verticalAlignment="Middle"/>
        <text><![CDATA[Total rnd_smpl]]></text>
       </staticText>
      </cellContents>
     </crosstabTotalRowHeader>
    </rowGroup>
    <columnGroup name="Descr" height="30" totalPosition="End">
     <bucket class="java.lang.String">
      <bucketExpression><![CDATA[$F{Descr}]]></bucketExpression>
     </bucket>
     <crosstabColumnHeader>
      <cellContents backcolor="#F0F8FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <textField>
        <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
        <textElement/>
        <textFieldExpression><![CDATA[$V{Descr}]]></textFieldExpression>
       </textField>
      </cellContents>
     </crosstabColumnHeader>
     <crosstabTotalColumnHeader>
      <cellContents backcolor="#005FB3" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <staticText>
        <reportElement x="0" y="0" width="50" height="60" forecolor="#FFFFFF"/>
        <textElement textAlignment="Center" verticalAlignment="Middle"/>
        <text><![CDATA[Total Descr]]></text>
       </staticText>
      </cellContents>
     </crosstabTotalColumnHeader>
    </columnGroup>
    <columnGroup name="rnd_testingPlant" height="30" totalPosition="End">
     <bucket class="java.lang.String">
      <bucketExpression><![CDATA[$F{rnd_testingPlant}]]></bucketExpression>
     </bucket>
     <crosstabColumnHeader>
      <cellContents backcolor="#F0F8FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <textField>
        <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
        <textElement/>
        <textFieldExpression><![CDATA[$V{rnd_testingPlant}]]></textFieldExpression>
       </textField>
      </cellContents>
     </crosstabColumnHeader>
     <crosstabTotalColumnHeader>
      <cellContents backcolor="#BFE1FF" mode="Opaque">
       <box>
        <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
       </box>
       <staticText>
        <reportElement x="0" y="0" width="50" height="30"/>
        <textElement textAlignment="Center" verticalAlignment="Middle"/>
        <text><![CDATA[Total rnd_testingPlant]]></text>
       </staticText>
      </cellContents>
     </crosstabTotalColumnHeader>
    </columnGroup>
    <measure name="valueMeasure" class="java.math.BigDecimal" calculation="Sum">
     <measureExpression><![CDATA[$F{value}]]></measureExpression>
    </measure>
    <crosstabCell width="50" height="25">
     <cellContents>
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell height="25" rowTotalGroup="rnd_ba_cd">
     <cellContents backcolor="#005FB3" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell width="50" columnTotalGroup="Descr">
     <cellContents backcolor="#005FB3" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField>
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell rowTotalGroup="rnd_ba_cd" columnTotalGroup="Descr">
     <cellContents backcolor="#005FB3" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField>
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell width="50" columnTotalGroup="rnd_testingPlant">
     <cellContents backcolor="#BFE1FF" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}.doubleValue()/4]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell rowTotalGroup="rnd_ba_cd" columnTotalGroup="rnd_testingPlant">
     <cellContents backcolor="#005FB3" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell height="25" rowTotalGroup="rnd_smpl">
     <cellContents backcolor="#BFE1FF" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell rowTotalGroup="rnd_smpl" columnTotalGroup="Descr">
     <cellContents backcolor="#005FB3" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField>
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
    <crosstabCell rowTotalGroup="rnd_smpl" columnTotalGroup="rnd_testingPlant">
     <cellContents backcolor="#BFE1FF" mode="Opaque">
      <box>
       <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
      </box>
      <textField isBlankWhenNull="true">
       <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
       <textElement/>
       <textFieldExpression><![CDATA[$V{valueMeasure}]]></textFieldExpression>
      </textField>
     </cellContents>
    </crosstabCell>
   </crosstab>
  </band>
 </summary>
</jasperReport>
 

 

Code:
Stacktrace:	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)root cause javax.servlet.ServletException: net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 	 1. Crosstab bucket expression class missing for group rnd_ba_cd.	 2. Crosstab bucket value class missing for group rnd_ba_cd.	 3. Crosstab bucket expression class missing for group rnd_smpl.	 4. Crosstab bucket value class missing for group rnd_smpl.	 5. Crosstab bucket expression class missing for group Descr.	 6. Crosstab bucket value class missing for group Descr.	 7. Crosstab bucket expression class missing for group rnd_testingPlant.	 8. Crosstab bucket value class missing for group rnd_testingPlant.	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)	org.apache.jsp.Rpt_005fMonthlyRANDOMdetails_jsp._jspService(Rpt_005fMonthlyRANDOMdetails_jsp.java:251)	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)root cause net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 	 1. Crosstab bucket expression class missing for group rnd_ba_cd.	 2. Crosstab bucket value class missing for group rnd_ba_cd.	 3. Crosstab bucket expression class missing for group rnd_smpl.	 4. Crosstab bucket value class missing for group rnd_smpl.	 5. Crosstab bucket expression class missing for group Descr.	 6. Crosstab bucket value class missing for group Descr.	 7. Crosstab bucket expression class missing for group rnd_testingPlant.	 8. Crosstab bucket value class missing for group rnd_testingPlant.	net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:260)	net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:144)	net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:220)	net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:153)	org.apache.jsp.Rpt_005fMonthlyRANDOMdetails_jsp._jspService(Rpt_005fMonthlyRANDOMdetails_jsp.java:111)	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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...