Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361074 - receiving "is not a function, it is object" when creating a Joined Data Set with a Scripted Data Source
Summary: receiving "is not a function, it is object" when creating a Joined Data Set ...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Birt-DataAccess CLA
QA Contact: Hao Zhou CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-15 23:44 EDT by Dusty Little CLA
Modified: 2011-11-02 12:07 EDT (History)
1 user (show)

See Also:


Attachments
report containing the json joint dataset testcase (11.24 KB, application/octet-stream)
2011-11-01 17:01 EDT, Dusty Little CLA
no flags Details
birt json error 1 (63.56 KB, image/png)
2011-11-01 17:02 EDT, Dusty Little CLA
no flags Details
birt json error 2 (32.89 KB, image/png)
2011-11-01 17:04 EDT, Dusty Little CLA
no flags Details
birt json error 3 (45.46 KB, image/png)
2011-11-01 17:05 EDT, Dusty Little CLA
no flags Details
birt json error 4 (13.83 KB, image/png)
2011-11-01 17:07 EDT, Dusty Little CLA
no flags Details
json.jar (22.55 KB, application/x-java-archive)
2011-11-01 17:11 EDT, Dusty Little CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dusty Little CLA 2011-10-15 23:44:09 EDT
Build Identifier: 20110916-0149

I'm receiving the "is not a function, it is object" when creating a Joined Data Set with a Scripted Data Source. I know the scripted data source works because the data is fetched in the "preview results" step correctly. The error occurs when I choose OK to save the Data Set. The error and issue seems identical to the one described in this post: http://www.eclipse.org/forums/index.php/t/201442/ ,however the solution that worked there is not working here. I have added my jar to the scriptlib and WEB-INF/lib folders of the report.viewer plugin. I have added my jar to the classpath of both java and report builder as an external jar using the full path. I've event tried adding the jar to the jvm classpath.

Reproducible: Always

Steps to Reproduce:
1. Create a scripted data source
2. Use it in a Joined Data Set
Comment 1 Dusty Little CLA 2011-10-15 23:57:21 EDT
Here is the full text of the error:

A BIRT exception occurred.
  Plug-in Provider:Eclipse BIRT Project
  Plug-in Name:BIRT Data Engine
  Plug-in ID:org.eclipse.birt.data
  Version:3.7.1.v20110905
  Error Code:data.engine.FailToExecuteScript
  Error Message:Fail to execute script in function __bm_open(). Source:
------
" + importPackage(Packages.com.groupbasis.json);

// This will track the current row later on
count = 0;

// Create instance of the Controller class
parser = new Packages.com.groupbasis.json.MKLiveStatusParser();

// Load the JSON Source
parser.loadData("http://192.168.122.65/gbutils/live.php?q=GET%20hosts%0AColumns:%20name%20state%0A");

// Calculate the total rows we will have
totalCount = parser.getTotalCount(); + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: [JavaPackage com.groupbasis.json.MKLiveStatusParser] is not a function, it is object. (<inline>#7)
 Script source: <inline>, line: 0, text:
__bm_open()
Comment 2 Xiaoying Gu CLA 2011-10-24 05:01:15 EDT
I can't reproduce this issue with latest birt.
If you can still reproduce it,could you provide more detail information about
how to reproduce it or a sample report I can test with.
Comment 3 Dusty Little CLA 2011-11-01 17:01:24 EDT
Created attachment 206292 [details]
report containing the json joint dataset testcase
Comment 4 Dusty Little CLA 2011-11-01 17:02:19 EDT
Created attachment 206294 [details]
birt json error 1

Error received when clicking finish in the Joint Dataset wizard.
Comment 5 Dusty Little CLA 2011-11-01 17:04:10 EDT
Created attachment 206295 [details]
birt json error 2

Screenshot showing that the scripted datasets are functioning and that data is fetched correctly.
Comment 6 Dusty Little CLA 2011-11-01 17:05:29 EDT
Created attachment 206296 [details]
birt json error 3

Screenshot showing that the error is generated again upon clicking "OK" to close the edit dataset dialog.
Comment 7 Dusty Little CLA 2011-11-01 17:07:25 EDT
Created attachment 206297 [details]
birt json error 4

Screenshot showing that the joint dataset is generated but now fields are available for inclusion in the report.
Comment 8 Dusty Little CLA 2011-11-01 17:11:41 EDT
Created attachment 206298 [details]
json.jar

Jar file containing the json dependencies the scripted datasources. The source is probably al little dated and could be updated from the git repository, but the all test cases indicate that the code works for this data set.
Comment 9 Dusty Little CLA 2011-11-01 17:14:32 EDT
I've attached an example report that demonstrates the error along with the json.jar dependency and screenshots that show the behaviour I am experiencing.
Comment 10 Xiaoying Gu CLA 2011-11-02 05:13:17 EDT
I can run your report without errors.
Please try again and follow these steps:
1,open your report
2,click layout
3,property editor->properties->Resource tab
4,add your jar file
5,No error occur when choose OK to save the data set
Comment 11 Dusty Little CLA 2011-11-02 12:07:42 EDT
Thanks Xiaoying,

That solved my error.