Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Scripted DataSet problems
Scripted DataSet problems [message #643440] Mon, 06 December 2010 16:03 Go to next message
Jim Garrison is currently offline Jim Garrison
Messages: 57
Registered: July 2009
Member
I've implemented a trivial scripted dataset sample where the Java object returns a small set of hardcoded test data. The report works and displays the table of data.

However, when I run it under "Run/Debug Report" I see a number of what look like critical exceptions:

>>>> Compiled Source: 
function __bm_OPEN() {
lDao = new Packages.com.troux.licensing.dao.LicensingDao();
iter = lDao.getDummyEvents().iterator();

} 
>>>> end compilation.
>>>> Compiled Source: 
__bm_OPEN()
>>>> end compilation.
>>>> Frame Source Name: 
>>>> Frame Function Name: __bm_OPEN
>>>> Enter script. 1
>>>> Line changed to: 1
>>>> Debugger exception occured:
>>>> Exit script.
org.mozilla.javascript.EcmaError: TypeError: [JavaPackage com.troux.licensing.dao.LicensingDao] is not a function, it is object. (#1)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3734)
    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3722)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3363)
    at script.__bm_OPEN(:1)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at org.mozilla.javascript.SecurityController$1.exec(SecurityController.java:193)
    at org.eclipse.birt.report.engine.javascript.ScriptUtil$1.execWithDomain(ScriptUtil.java:59)
    at org.mozilla.javascript.SecurityController.callWithDomain(SecurityController.java:189)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2474)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
    at script()

   lots more of the same


And later...

>>>> Compiled Source: 
function __bm_FETCH() {
if (!iter.hasNext()) return false;
var data = iter.next(); 
row["month"]        = data.getMonth();
row["day"]          = data.getDay();
row["maxSessions"]  = data.getMaxSessions();
return true;
} 
>>>> end compilation.
>>>> Compiled Source: 
__bm_FETCH()
>>>> end compilation.
>>>> Frame Source Name: 
>>>> Frame Function Name: __bm_FETCH
>>>> Enter script. 1
>>>> Line changed to: 1
>>>> Debugger exception occured:
>>>> Exit script.
org.mozilla.javascript.EcmaError: ReferenceError: "iter" is not defined. (#1)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
	at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)
	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)
	at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1697)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3410)
	at script.__bm_FETCH(:1)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
	at org.mozilla.javascript.SecurityController$1.exec(SecurityController.java:193)
	at org.eclipse.birt.report.engine.javascript.ScriptUtil$1.execWithDomain(ScriptUtil.java:59)
	at org.mozilla.javascript.SecurityController.callWithDomain(SecurityController.java:189)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2474)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
	at script()


In spite of the exceptions, the report is correcly populated.

Is this a problem in the debugger, or in my code (which seems to work for this trivial case)?

[Updated on: Mon, 06 December 2010 16:12]

Report message to a moderator

Re: Scripted DataSet problems [message #643446 is a reply to message #643440] Mon, 06 December 2010 16:20 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Jim

Change
lDao = new Packages.com.troux.licensing.dao.LicensingDao();
to
importPackage(Packages.com.troux.licensing.dao);
lDao = new LicensingDao();

Jason

On 12/6/2010 4:03 PM, Jim Garrison wrote:
> I've implemented a trivial scripted dataset sample where the Java object
> returns a small set of hardcoded test data. The report works and
> displays the table of data.
>
> However, when I run it under "Run/Debug Report" I see a number of what
> look like critical exceptions:
>
>
>>>>> Compiled Source:
> function __bm_OPEN() {
> lDao = new Packages.com.troux.licensing.dao.LicensingDao();
> iter = lDao.getDummyEvents().iterator();
>
> }
>>>>> end compilation.
>>>>> Compiled Source:
> __bm_OPEN()
>>>>> end compilation.
>>>>> Frame Source Name: Frame Function Name: __bm_OPEN
>>>>> Enter script. 1
>>>>> Line changed to: 1
>>>>> Debugger exception occured:
>>>>> Exit script.
> org.mozilla.javascript.EcmaError: TypeError: [JavaPackage
> com.troux.licensing.dao.LicensingDao] is not a function, it is object. (#1)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3654)
>
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3632)
>
> at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3660)
> at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3679)
> at
> org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:3734)
>
> at
> org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:3722)
>
> at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter .java:3363)
> at script.__bm_OPEN(:1)
> at org.mozilla.javascript.Interpreter.interpret(Interpreter.jav a:2487)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedF unction.java:164)
>
> at
> org.mozilla.javascript.SecurityController$1.exec(SecurityCon troller.java:193)
>
> at
> org.eclipse.birt.report.engine.javascript.ScriptUtil$1.execW ithDomain(ScriptUtil.java:59)
>
> at
> org.mozilla.javascript.SecurityController.callWithDomain(Sec urityController.java:189)
>
> at org.mozilla.javascript.Interpreter.interpret(Interpreter.jav a:2474)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedF unction.java:164)
>
> at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter .java:3330)
> at script()
>
> lots more of the same
>
>
> Is this a problem in the debugger, or in my code (which seems to work
> for this trivial case)?
>
Re: Scripted DataSet problems [message #643449 is a reply to message #643446] Mon, 06 December 2010 16:45 Go to previous messageGo to next message
Jim Garrison is currently offline Jim Garrison
Messages: 57
Registered: July 2009
Member
The report still works, but now the error is

org.mozilla.javascript.EcmaError: ReferenceError: "LicensingDao" is not defined.


Also, I tried setting a breakpoint in the Java code and it did not stop at the breakpoint.

[Updated on: Mon, 06 December 2010 16:45]

Report message to a moderator

Re: Scripted DataSet problems [message #643462 is a reply to message #643449] Mon, 06 December 2010 17:35 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Where do you have LicensingDao defined (where is it located)?

Jason

On 12/6/2010 4:45 PM, Jim Garrison wrote:
> The report still works, but now the error is
>
>
> org.mozilla.javascript.EcmaError: ReferenceError: "LicensingDao" is not
> defined.
>
Re: Scripted DataSet problems [message #643593 is a reply to message #643440] Tue, 07 December 2010 10:37 Go to previous messageGo to next message
Jim Garrison is currently offline Jim Garrison
Messages: 57
Registered: July 2009
Member
I'm still having classpath problems. Here's what I know so far:

There are three ways to test a DataSet and/or report:


  1. DataSet properties page, "Preview Results"
  2. Report editor, "Preview" tab
  3. Run/View Report/In Web Viewer


When starting to work on this I was getting ClassNotFoundException at the point where the DAO class was doing
Class.forName("oracle.jdbc.driver.OracleDriver")
with all three methods above.

I tried adding ojdbc6.jar to the birt/scriptlib directory, expecting it to correct the problem in the Web Viewer. Curiously, it causes the DataSet properties "Preview Results" to work, but the other two still get ClassNotFoundException.

I'm out of places to add the JDBC jar file. Can anybody suggest how to proceed?
Re: Scripted DataSet problems [message #643596 is a reply to message #643440] Tue, 07 December 2010 10:45 Go to previous messageGo to next message
Jim Garrison is currently offline Jim Garrison
Messages: 57
Registered: July 2009
Member
I also tried the solution given at http://birtworld.blogspot.com/2009/12/birt-designer-classpat h-changes.html but it had no effect.

[Updated on: Tue, 07 December 2010 10:45]

Report message to a moderator

Re: Scripted DataSet problems [message #643661 is a reply to message #643440] Tue, 07 December 2010 13:48 Go to previous message
Jim Garrison is currently offline Jim Garrison
Messages: 57
Registered: July 2009
Member
I've resolved the problems. See my last post in this thread.
Previous Topic:Can't get BIRT installed on TurnKey Linux VM
Next Topic:Error deploying Birt Viewer on Tomcat
Goto Forum:
  


Current Time: Wed Aug 20 12:37:53 EDT 2014

Powered by FUDForum. Page generated in 0.03454 seconds