Error accesing java classes from a scripted dataset [message #629892] |
Wed, 29 September 2010 16:59  |
Eclipse User |
|
|
|
Hi,
Iam using BIRT version : 2.2.1 , along with my ILOG rule studio 6.7.3. Iam trying to create a BIRT scripted datasource, the java script in my dataset is trying to acces the java classes. I have done the following steps to achive it :
1) Have placed my compiled java classes under: JRules673\studio\eclipse\plugins\org.eclipse.birt.report.vie wer_2.2.1.r22x_v20070920\birt\WEB-INF\classes\
2) Have created a Dataset in my report which uses a scripted Datasource. The open scrip of the data set looks likes this :
count = 0;
// Create instance of
// the GetStockHistory class
gsh = new Packages.StockDaoMock();
//Load the List
stock = gsh.getStockValues("Java");
The java script in my fetch method looks like this :
if(count < stock.size()){
row["columnDate"] = stock.get(count).getDate();
row["columnOpen"] = stock.get(count).getOpen();
row["columnHigh"] = stock.get(count).getHigh();
row["columnLow"] = stock.get(count).getLow();
row["columnClose"] = stock.get(count).getClose();
row["columnVolume"] = stock.get(count).getVolume();
count++;
return true;
}
return false;
When I try to previe my results on the data set , I get the following error :
[B]
A BIRT exception occured : Error evaluating javascript expression. Script Engine error : TypeError:[JavaPackage StockDaoMock] is not a function.[/B]
My understanding is eclipse report in the design time is not able to find the java classes which the scrip is using. Following some suggestion on the forum I also tried to put a jar containing my compiled classes at the following location : \studio\eclipse\plugins\org.eclipse.birt.report.viewer_2.2.1 .r22x_v20070920\birt\scriptlib
But the script was not able to pick the classes. It still came back with the same exception. TypeError:[JavaPackage]is not a funtion . What am I missing? Iam using BIRT 2.2.1 with ILOG rule studio 6.7.3. Struggling with this for a long time now , so any help/hints is highly appreciated.
|
|
|
|
|
|
Re: Error accesing java classes from a scripted dataset [message #630169 is a reply to message #629892] |
Thu, 30 September 2010 17:13  |
Eclipse User |
|
|
|
Hi Jason,
I was able to get my report running by placing my jar files in the scriptlib folder as you asked me to. However is there a more elegant solution for BIRT report plugin to look up my java classes. I will bebundling the solution inot an RCP app , In my case I want BIRT viewer to have acces to my whole persistance stack, which include a whole bunch of jars. One thing I tried to do is add
Eclipse-BuddyPolicy: registered to the manifest file of my BIRT report viewer, and then added the following to the Manifest file of the plugin which has my java classes
Eclipse-RegisterBuddy: org.eclipse.birt.report.viewer.ViewerPlugin
I assumed that this will allow BIRT report to actually have access to my java class , but it did not work. Please advise me as to how to set my classloader on the BIRT report viewer.Your help is highly appreciated.
|
|
|
Powered by
FUDForum. Page generated in 0.27399 seconds