Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » AdapterException: The data source of this data set can not be null.
AdapterException: The data source of this data set can not be null. [message #555465] Thu, 26 August 2010 16:56 Go to next message
Nils is currently offline NilsFriend
Messages: 15
Registered: August 2010
Location: Stuttgart
Junior Member
hi there,

hope you can help me with a problem that is bugging me...

I just created a report that uses scripted datasources fetching data from some pojos. no big deal, works fine in eclipse report designer!

now I want to have it all in a servlet. Basically I followed the instructions in the wiki ( http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1 ) and try to make it run in tomcat using wtp. after some minor adaptations the platform and engine started and the report was found.

But: during task.run() I got lots of exceptions, all of them like
An exception occurred during processing. Please see the following message for details:
The data source of this data set can not be null.
org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred during processing. Please see the following message for details:
The data source of this data set can not be null.
	at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.prepare(DataRequestSessionImpl.java:526)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.doPrepareQuery(AbstractDataEngine.java:208)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:172)
	at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:118)
	at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportExecutor.execute(WrappedReportExecutor.java:59)
	at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplciateReportExecutor.execute(SuppressDuplciateReportExecutor.java:51)
	at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportExecutor.execute(WrappedReportExecutor.java:59)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:149)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:72)


Obviously the engine cannot find the datasources? do I have to configure the engine to use scripts embedded in the report?
I'm using an IRunAndRenderTask.

this is the birtengine's properties as displayed by the debugger:
[org.eclipse.birt.report.engine.api.EngineConfig.scriptObjects={PARENT_CLASSLOADER=WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@e1899b
}, BIRT_HOME=C:\seu2\tomcat\6.x\wtpwebapps\EWO-Druck\WEB-INF\platform, logLevel=FINEST, PLATFORM_CONTEXT=org.eclipse.birt.core.framework.PlatformServletContext@12a642, org.eclipse.birt.report.engine.api.EngineConfig.emitterConfigs={html=org.eclipse.birt.report.engine.api.HTMLEmitterConfig@615f19}, org.eclipse.birt.report.engine.api.EngineConfig.statusHandler=org.eclipse.birt.report.engine.api.DefaultStatusHandler@1a8e0bd, logDest=c:/temp]

I also had BIRT_HOME=C:\seu2\tomcat\6.x\wtpwebapps\EWO-Druck without any changes...
the pojos for the datasources are within the classpath...

At the moment I'm too blind to see the problem Sad

any help is highly welcome Smile
thanx in advance!

nils

[Updated on: Thu, 26 August 2010 17:01]

Report message to a moderator

Re: AdapterException: The data source of this data set can not be null. [message #555471 is a reply to message #555465] Thu, 26 August 2010 17:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You need to set the scriptlib directory that the engine is searching for
the pojos. It also searches this directory if you implemented your
event handlers in java.

config.getAppContext().put("webapplication.projectclasspath ",
"c:/test/myclasspathentry1.jar;c:/tmp/myjar2.jar" );

Jason


On 8/26/2010 12:56 PM, nils.buntenbeck@bluecarat.de wrote:
> hi there,
>
> hope you can help me with a problem that is bugging me...
>
> I just created a report that uses scripted datasources fetching data
> from some pojos. no big deal, works fine in eclipse report designer!
>
> now I want to have it all in a servlet. Basically I followed the
> instructions in the wiki (
> http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1 ) and try to make
> it run in tomcat using wtp. after some minor adaptations the platform
> and engine started and the report was found.
>
> But: during task.run() I got lots of exceptions, all of them like
> An exception occurred during processing. Please see the following
> message for details:
> The data source of this data set can not be null.
> org.eclipse.birt.report.data.adapter.api.AdapterException: An exception
> occurred during processing. Please see the following message for details:
> The data source of this data set can not be null.
> at
> org.eclipse.birt.report.data.adapter.impl.DataRequestSession Impl.prepare(DataRequestSessionImpl.java:526)
>
> at
> org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.d oPrepareQuery(AbstractDataEngine.java:208)
>
> at
> org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.p repare(AbstractDataEngine.java:172)
>
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:118)
>
> at
> org.eclipse.birt.report.engine.internal.executor.wrap.Wrappe dReportExecutor.execute(WrappedReportExecutor.java:59)
>
> at
> org.eclipse.birt.report.engine.internal.executor.dup.Suppres sDuplciateReportExecutor.execute(SuppressDuplciateReportExec utor.java:51)
>
> at
> org.eclipse.birt.report.engine.internal.executor.wrap.Wrappe dReportExecutor.execute(WrappedReportExecutor.java:59)
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:149)
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:72)
>
>
> Obviously the engine cannot find the datasources? do I have to configure
> the engine to use scripts embedded in the report?
> I'm using an IRunAndRenderTask.
>
> this is the birtengine's properties as displayed by the debugger:
> [org.eclipse.birt.report.engine.api.EngineConfig.scriptObjec ts={PARENT_CLASSLOADER=WebappClassLoader
>
> delegate: false
> repositories:
> /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@e1899b
> }, BIRT_HOME=C:\seu2\tomcat\6.x\wtpwebapps\EWO-Druck\WEB-INF\pl atform,
> logLevel=FINEST,
> PLATFORM_CONTEXT=org.eclipse.birt.core.framework.PlatformServletContext@12a642,
> org.eclipse.birt.report.engine.api.EngineConfig.emitterConfi gs={html=org.eclipse.birt.report.engine.api.HTMLEmitterConfig@615f19},
> org.eclipse.birt.report.engine.api.EngineConfig.statusHandle r=org.eclipse.birt.report.engine.api.DefaultStatusHandler@1a8e0bd,
> logDest=c:/temp]
> I also had BIRT_HOME=C:\seu2\tomcat\6.x\wtpwebapps\EWO-Druck without any
> changes...
>
> At the moment I'm too blind to see the problem :(
> any help is highly welcome :)
> thanx in advance!
>
> nils
Re: AdapterException: The data source of this data set can not be null. [message #555477 is a reply to message #555471] Thu, 26 August 2010 17:28 Go to previous messageGo to next message
Nils is currently offline NilsFriend
Messages: 15
Registered: August 2010
Location: Stuttgart
Junior Member
thnaks for your quick reply Smile

unfortunately: not working Sad

here's my config section:
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            config.getAppContext().put(
                    EngineConstants.APPCONTEXT_CLASSLOADER_KEY, cl);
            config.getAppContext().put("webapplication.projectclasspath",
                    "C:/seu2/tomcat/6.x/wtpwebapps/EWO-Druck/WEB-INF/classes");
            config.setEngineHome(sc.getRealPath("/WEB-INF/platform"));
            IPlatformContext context = new PlatformServletContext(sc);
            config.setPlatformContext(context);

            try {
                Platform.startup(config);
            } catch (BirtException e) {
                e.printStackTrace();
            }

            IReportEngineFactory factory = (IReportEngineFactory) Platform
                    .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
            birtEngine = factory.createReportEngine(config);


I'm using Birt 2.3.2

cheers,
nils
Re: AdapterException: The data source of this data set can not be null. [message #555654 is a reply to message #555477] Fri, 27 August 2010 13:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are all the jars needed by the pojo in the classpath?
Also when setting the classloader key can you use
NameOfYourClass.class.getClassLoader( ) ?
If the pojos are are in the web-inf/lib or web-inf/classes you should
not need to set the webapplication.projectclasspath to that directory.
This may cause an issue. Try moving the classes into a jar and put them
in another directory.

Jason

On 8/26/2010 1:28 PM, Nils wrote:
> thnaks for your quick reply :)
>
> unfortunately: not working :(
>
> here's my config section:
>
> ClassLoader cl = Thread.currentThread().getContextClassLoader();
> config.getAppContext().put(
> EngineConstants.APPCONTEXT_CLASSLOADER_KEY, cl);
> config.getAppContext().put("webapplication.projectclasspath ",
> "C:/seu2/tomcat/6.x/wtpwebapps/EWO-Druck/WEB-INF/classes");
> config.setEngineHome(sc.getRealPath("/WEB-INF/platform"));
> IPlatformContext context = new PlatformServletContext(sc);
> config.setPlatformContext(context);
>
> try {
> Platform.startup(config);
> } catch (BirtException e) {
> e.printStackTrace();
> }
>
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_E NGINE_FACTORY);
> birtEngine = factory.createReportEngine(config);
>
>
> I'm using Birt 2.3.2
>
> cheers,
> nils
Re: AdapterException: The data source of this data set can not be null. [message #556058 is a reply to message #555654] Mon, 30 August 2010 17:11 Go to previous messageGo to next message
Nils is currently offline NilsFriend
Messages: 15
Registered: August 2010
Location: Stuttgart
Junior Member
hi jason,

thanks for your help. I'm sorry to say that I still did not get it running...

I tried to make it run in the example birt-viewer, which finally worked Smile
I tried to make it run as a servlet and failed again...

all jars containing datasource-classes are in the right place, that is web-inf/classes and web-inf/lib.
the classloader knows all relevant classes.
I removed the setting of webapplication.classpath and set the engine-home to the web-inf/platform directory
platform starts, loads the report, creates a task and... fails!
again complaining that the datasource can not be null!

what am I doing wrong?

thank you for your help!
nils

Jason Weathersby wrote on Fri, 27 August 2010 09:44
Are all the jars needed by the pojo in the classpath?
Also when setting the classloader key can you use
NameOfYourClass.class.getClassLoader( ) ?
If the pojos are are in the web-inf/lib or web-inf/classes you should
not need to set the webapplication.projectclasspath to that directory.
This may cause an issue. Try moving the classes into a jar and put them
in another directory.

Jason




Re: AdapterException: The data source of this data set can not be null. [message #556067 is a reply to message #556058] Mon, 30 August 2010 17:18 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try creating this class:

package my.event.handlers;

import org.eclipse.birt.report.engine.api.script.IUpdatableDataSetR ow;
import
org.eclipse.birt.report.engine.api.script.eventadapter.Scrip tedDataSetEventAdapter;
import org.eclipse.birt.report.engine.api.script.instance.IDataSetI nstance;

public class MyScriptedDataSet extends ScriptedDataSetEventAdapter {

private Integer cnt=0;
private Integer cntT=3;

@Override
public boolean fetch(IDataSetInstance dataSet, IUpdatableDataSetRow row) {

//dataSet.getInputParameterValue(arg0);
if( cnt < cntT){
try{
row.setColumnValue("col1", new Integer(cnt));
row.setColumnValue("col2", "hello");

cnt++;
return true;
}catch (Exception e){

}
}
return false;
}

}


Jar it and create a scriptlib directory under your app context and put
the jar in there. then add the webapp setting back specifying the full
path to the jar you created and then run the attached report?

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21"
id="1">
<property name="comments">Copyright (c) 2007 &lt;&lt;Your Company
Name here>></property>
<property name="createdBy">Eclipse BIRT Designer Version
2.5.2.v20100208 Build &lt;2.5.2.v20100210-0630></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<property name="units">in</property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="layoutPreference">auto layout</property>
<data-sources>
<script-data-source name="Data Source" id="6">
<property name="newHandlerOnEachEvent">true</property>
</script-data-source>
</data-sources>
<data-sets>
<script-data-set name="Data Set" id="7">
<property
name="eventHandlerClass">my.event.handlers.MyScriptedDataSet </property>
<property name="newHandlerOnEachEvent">true</property>
<list-property name="resultSetHints">
<structure>
<property name="position">1</property>
<property name="name">col1</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">col2</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">col1</property>
</structure>
<structure>
<property name="columnName">col2</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">col1</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">col2</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
</script-data-set>
</data-sets>
<styles>
<style name="crosstab" id="4">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<property name="topMargin">1in</property>
<property name="leftMargin">1.25in</property>
<property name="bottomMargin">1in</property>
<property name="rightMargin">1.25in</property>
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table id="33">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">col1</property>
<text-property name="displayName">col1</text-property>
<expression name="expression"
type="javascript">dataSetRow["col1"]</expression>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">col2</property>
<text-property name="displayName">col2</text-property>
<expression name="expression"
type="javascript">dataSetRow["col2"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="47"/>
<column id="48"/>
<header>
<row id="34">
<cell id="35">
<label id="36">
<text-property name="text">col1</text-property>
</label>
</cell>
<cell id="37">
<label id="38">
<text-property name="text">col2</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="39">
<cell id="40">
<data id="41">
<property
name="resultSetColumn">col1</property>
</data>
</cell>
<cell id="42">
<data id="43">
<property
name="resultSetColumn">col2</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="44">
<cell id="45"/>
<cell id="46"/>
</row>
</footer>
</table>
</body>
</report>


On 8/30/2010 1:11 PM, Nils wrote:
> hi jason,
>
> thanks for your help. I'm sorry to say that I still did not get it
> running...
>
> I tried to make it run in the example birt-viewer, which finally worked
> :) I tried to make it run as a servlet and failed again...
>
> all jars containing datasource-classes are in the right place, that is
> web-inf/classes and web-inf/lib.
> the classloader knows all relevant classes.
> I removed the setting of webapplication.classpath and set the
> engine-home to the web-inf/platform directory
> platform starts, loads the report, creates a task and... fails!
> again complaining that the datasource can not be null!
>
> what am I doing wrong?
>
> thank you for your help!
> nils
>
> Jason Weathersby wrote on Fri, 27 August 2010 09:44
>> Are all the jars needed by the pojo in the classpath?
>> Also when setting the classloader key can you use
>> NameOfYourClass.class.getClassLoader( ) ?
>> If the pojos are are in the web-inf/lib or web-inf/classes you should
>> not need to set the webapplication.projectclasspath to that directory.
>> This may cause an issue. Try moving the classes into a jar and put
>> them in another directory.
>>
>> Jason
>
>
>
Re: AdapterException: The data source of this data set can not be null. [message #556240 is a reply to message #556067] Tue, 31 August 2010 12:31 Go to previous messageGo to next message
Nils is currently offline NilsFriend
Messages: 15
Registered: August 2010
Location: Stuttgart
Junior Member
hi jason,

thank you!

that worked! but... why?
I just did not put the jar in scriptlib, but in the web-inf/lib, in fact I even put it the same jar that contains all the failing datasources...

the only big difference I see at the moment, is that you use java-based handlers and I use javascript within the report itself...
Is that the problem? Does the javascript-engine not know the correct classpath? how do I configure that?

why do I use javascript?
just because that was the first documented solution I found when I searched for pojos as a datasource Wink

cheers,
nils
Re: AdapterException: The data source of this data set can not be null. [message #556277 is a reply to message #556240] Tue, 31 August 2010 14:53 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I do not understand what you mean about using java event handler and
javascript within a report. Event handlers have to be written in one or
the other. Can you give me an example? The js engine should be able to
pick up the proper classloader.

Jason

On 8/31/2010 8:31 AM, Nils wrote:
> hi jason,
>
> thank you!
>
> that worked! but... why?
> I just did not put the jar in scriptlib, but in the web-inf/lib, in fact
> I even put it the same jar that contains all the failing datasources...
>
> the only big difference I see at the moment, is that you use java-based
> handlers and I use javascript within the report itself...
> Is that the problem? Does the javascript-engine not know the correct
> classpath? how do I configure that?
>
> why do I use javascript?
> just because that was the first documented solution I found when I
> searched for pojos as a datasource ;)
>
> cheers,
> nils
Re: AdapterException: The data source of this data set can not be null. [message #556280 is a reply to message #556277] Tue, 31 August 2010 15:18 Go to previous messageGo to next message
Nils is currently offline NilsFriend
Messages: 15
Registered: August 2010
Location: Stuttgart
Junior Member
I just meant, that I have my handlers written in javascript, the code is in the rptdesign-file, that's all.
it still gives me the same error Sad
Re: AdapterException: The data source of this data set can not be null. [message #556292 is a reply to message #556280] Tue, 31 August 2010 15:32 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you email me the report? jasonweathersby at windstream dot net

On 8/31/2010 11:18 AM, Nils wrote:
> I just meant, that I have my handlers written in javascript, the code is
> in the rptdesign-file, that's all.
> it still gives me the same error :(
Re: AdapterException: The data source of this data set can not be null. [message #556293 is a reply to message #556292] Tue, 31 August 2010 15:34 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

One other thing to check. Can you try setting the locale in the RE API?
task.setLocale(new Locale("en", "US"));
before the report is executed?

Jason


On 8/31/2010 11:32 AM, Jason Weathersby wrote:
> Can you email me the report? jasonweathersby at windstream dot net
>
> On 8/31/2010 11:18 AM, Nils wrote:
>> I just meant, that I have my handlers written in javascript, the code is
>> in the rptdesign-file, that's all.
>> it still gives me the same error :(
>
Previous Topic:Automatically generating a queryText for a xml dataset?
Next Topic:java.lang.IllegalStateException: zip file closed
Goto Forum:
  


Current Time: Fri Apr 19 22:42:47 GMT 2024

Powered by FUDForum. Page generated in 0.03783 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top