I am using Jaspersoft studio 6.2 to create a report. I am new and just experimenting crosstab. I put a crosstab on summary band. The data source is postgresql, the query runs fine in postgresql and in Dataset and Query Dialog (fields detected). The crosstab has one row group and one column group.
Edit: I changed the query so that doesn't need data source, but still postgresql query so you can verify it. I got the same error.
The source
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-04-15T09:31:15 -->
<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="test8" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="49d2f486-e168-4ed8-b00a-ba04aabc1354">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datamart"/>
<style name="Crosstab_CH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CG" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CT" mode="Opaque" backcolor="#005FB3">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Crosstab_CD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<queryString>
<![CDATA[select '2016-04-01'::date as UsageDate, 'a' as ProductName, 1 as CustomerKey
union all select '2016-04-01'::date as UsageDate, 'b' as ProductName, 2 as CustomerKey
union all select '2016-05-01'::date as UsageDate, 'a' as ProductName, 2 as CustomerKey
union all select '2016-05-01'::date as UsageDate, 'b' as ProductName, 3 as CustomerKey]]>
</queryString>
<field name="usagedate" class="java.sql.Date"/>
<field name="productname" class="java.lang.String"/>
<field name="customerkey" class="java.lang.Integer"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="220" splitType="Stretch">
<crosstab>
<reportElement x="272" y="20" width="200" height="200" uuid="27b59abe-7800-4d75-bfde-8ba98dcb63a2">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<rowGroup name="productname1" width="60" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{productname}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="4d3b9a26-c9ae-4d91-9f9b-046051fe68ef"/>
<textFieldExpression><![CDATA[$V{productname1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF" uuid="0454ed72-f427-4178-96da-15c3c0120059"/>
<text><![CDATA[Total productname1]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="usagedate1" height="20" totalPosition="End">
<bucket class="java.sql.Date">
<bucketExpression><![CDATA[$F{usagedate}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="f96354ac-6d2c-4b37-bd70-5f12a1a0d83b"/>
<textFieldExpression><![CDATA[$V{usagedate1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF" uuid="9a5d6927-1279-48b9-85a2-4632d3cf1d73"/>
<text><![CDATA[Total usagedate1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="customerkey_MEASURE1" class="java.lang.Integer">
<measureExpression><![CDATA[$F{customerkey}]]></measureExpression>
</measure>
<crosstabCell width="60" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="5692496d-54c7-473e-b903-56ab136f392e"/>
<textFieldExpression><![CDATA[$V{customerkey_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="usagedate1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF" uuid="ab4186ba-507c-43d1-bd39-36f39ce22e37"/>
<textFieldExpression><![CDATA[$V{customerkey_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="productname1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF" uuid="ecfc705d-bd32-43e2-b1b5-3dec58bdd84e"/>
<textFieldExpression><![CDATA[$V{customerkey_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="productname1" columnTotalGroup="usagedate1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF" uuid="803b9a3e-bb42-4ed4-8d43-ea8451f0f678"/>
<textFieldExpression><![CDATA[$V{customerkey_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
The dataset query:
select '2016-04-01'::date as UsageDate, 'a' as ProductName, 1 as CustomerKey
union all select '2016-04-01'::date as UsageDate, 'b' as ProductName, 2 as CustomerKey
union all select '2016-05-01'::date as UsageDate, 'a' as ProductName, 2 as CustomerKey
union all select '2016-05-01'::date as UsageDate, 'b' as ProductName, 3 as CustomerKey
error log when I click preview
net.sf.jasperreports.engine.JRException: java.lang.NullPointerException
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:524)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$20(ReportControler.java:499)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:380)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.NullPointerException
at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.addMeasure(BucketingService.java:276)
at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.<init>(BucketingService.java:135)
at net.sf.jasperreports.crosstabs.fill.calculation.CrosstabBucketingService.<init>(CrosstabBucketingService.java:59)
at net.sf.jasperreports.engine.fill.JRFillCrosstab.createService(JRFillCrosstab.java:507)
at net.sf.jasperreports.engine.fill.JRFillCrosstab.initBucketingService(JRFillCrosstab.java:682)
at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customInitialize(JRFillCrosstab.java:1191)
at net.sf.jasperreports.engine.fill.JRFillElementDataset.initialize(JRFillElementDataset.java:148)
at net.sf.jasperreports.engine.fill.JRCalculator.initializeDataset(JRCalculator.java:556)
at net.sf.jasperreports.engine.fill.JRCalculator.initializeVariables(JRCalculator.java:322)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:241)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:119)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:558)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:119)
at java.lang.Thread.run(Thread.java:745)