Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Problem with Birt Viewer 3.7.1 using Scripted data source
Problem with Birt Viewer 3.7.1 using Scripted data source [message #855153] Tue, 24 April 2012 15:10 Go to next message
Claude B is currently offline Claude BFriend
Messages: 32
Registered: February 2012
Member
Hi,

I've created 2 separated projects: the first is a Java project that generates the report (rptdesign file) and the second is a dynamic web project based on JSF 2.0 which shows the report generated by the first project using jsp viewer taglib.

In the first project I used a scripted data source and here is my open script:

dataSetHandle.setOpen( "i = 0;\r\n"
				+"Pack1 = new Packages.calculMetrics.performanceMetrics.DataSet();\r\n"
				+"L = Pack1.getLabels();\r\n"
				+"V = Pack1.extractData(L);\r\n"
				+"Pack2 = new Packages.calculMetrics.performanceMetrics.OpenedW2D();\r\n"
				+"Pack2.openedw2d(V);\r\n"
				+"Pack3 = new Packages.calculMetrics.performanceMetrics.ClosedW10d();\r\n"
				+"Pack3.closedw10d(V);"


Where L is a list of Strings and V is a vector of classes

When I run my report in the Eclipse viewer I get no problems, same thing if I run it from a report Engine (using HTMLRenderOption()) I get the HTML report with no problem
but when I run it in Birt Viewer from the other project I get a strange error:
Script engine error: ReferenceError: "V" is not defined.
I attached below the stack trace.

Here is what I've done exactly in the web project:
- I created a dynamic web project v2.5
- I deployed Birt Viewer 3.7.1 in a GlassFish server v 3.1.2
- I copied the generated rptdesign file in the root directory of the viewer (D:\glassfish3\glassfish\domains\domain1\applications\birt)
- I copied some libs (SQL Server, Hibernate, ...) into the lib directory
- I copied the jar file of the first project in the scriptlib directory
- I tested the viewer using this jsp page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http ://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http: //java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http: //java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="/birt.tld" prefix="birt" %>

<html>

<f:view>
<body>

<birt:report id="birtViewer" reportDesign="PMetrics.rptdesign" baseURL="/birt"
height="600"
width="800"
format="html"
isHostPage="false"
reportContainer="iframe"
>
</birt:report>
</body>

</f:view>

</html>


I tested it with other sample reports and it worked perfectly

Environment:
- Eclipse BIRT 3.7.1 (all in one)
- BIRT runtime 3.7.1
- JDK 1.7
- GlassFish Server 3.1.2
- JSF 2.0
- Hibernate Tools 3.4.0

I can't understand why have I to define the vector V in the Javascript code of the second project however it works perfectly in the first one without definition.

Can anyone help me to solve this problem ???
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #855206 is a reply to message #855153] Tue, 24 April 2012 15:51 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Claude,

My guess is that the calculMetrics.performanceMetrics package is not
being found. You could try
importPackage(Packages.calculMetrics.performanceMetrics);
Pack1 = new DataSet();
and add a simple file logger like:
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/scrptds.txt", true ) );
out.println( "Pack1 " + Pack1);
out.close();

to see if it is null.

Jason

On 4/24/2012 11:10 AM, Claude B wrote:
> Hi,
>
> I've created 2 separated projects: the first is a Java project that generates the report (rptdesign file) and the second is a dynamic web project based on JSF 2.0 which shows the report generated by the first project using jsp viewer taglib.
>
> In the first project I used a scripted data source and here is my open script:
>
>
> dataSetHandle.setOpen( "i = 0;\r\n"
> +"Pack1 = new Packages.calculMetrics.performanceMetrics.DataSet();\r\n"
> +"L = Pack1.getLabels();\r\n"
> +"V = Pack1.extractData(L);\r\n"
> +"Pack2 = new Packages.calculMetrics.performanceMetrics.OpenedW2D();\r\n"
> +"Pack2.openedw2d(V);\r\n"
> +"Pack3 = new Packages.calculMetrics.performanceMetrics.ClosedW10d();\r\n"
> +"Pack3.closedw10d(V);"
>
>
> Where L is a list of Strings and V is a vector of classes
>
> When I run my report in the Eclipse viewer I get no problems, same thing if I run it from a report Engine (using HTMLRenderOption()) I get the HTML report with no problem
> but when I run it in Birt Viewer from the other project I get a strange error:
> Script engine error: ReferenceError: "V" is not defined.
> I attached below the stack trace.
>
> Here is what I've done exactly in the web project:
> - I created a dynamic web project v2.5
> - I deployed Birt Viewer 3.7.1 in a GlassFish server v 3.1.2
> - I copied the generated rptdesign file in the root directory of the viewer (D:\glassfish3\glassfish\domains\domain1\applications\birt)
> - I copied some libs (SQL Server, Hibernate, ...) into the lib directory
> - I copied the jar file of the first project in the scriptlib directory
> - I tested the viewer using this jsp page:
>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http ://www.w3.org/TR/html4/loose.dtd">
> <%@ taglib uri="http: //java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http: //java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="/birt.tld" prefix="birt" %>
>
> <html>
>
> <f:view>
> <body>
>
> <birt:report id="birtViewer" reportDesign="PMetrics.rptdesign" baseURL="/birt"
> height="600"
> width="800"
> format="html"
> isHostPage="false"
> reportContainer="iframe"
>>
> </birt:report>
> </body>
>
> </f:view>
>
> </html>
>
>
> I tested it with other sample reports and it worked perfectly
>
> Environment:
> - Eclipse BIRT 3.7.1 (all in one)
> - BIRT runtime 3.7.1
> - JDK 1.7
> - GlassFish Server 3.1.2
> - JSF 2.0
> - Hibernate Tools 3.4.0
>
> I can't understand why have I to define the vector V in the Javascript code of the second project however it works perfectly in the first one without definition.
>
> Can anyone help me to solve this problem ???
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #855323 is a reply to message #855206] Tue, 24 April 2012 18:12 Go to previous messageGo to next message
Claude B is currently offline Claude BFriend
Messages: 32
Registered: February 2012
Member
Hi Jason,
Thank you for your quick response,
First I want to answer your question, I tried this code and the result was:
Pack1 calculMetrics.performanceMetrics.DataSet@1778087

but while doing this I realized that I ignored an important part of the log file, I'm so sorry I thought it was relative to an old execution, I attached the full log this time and I discovered that the problem is due to Hibernate, it can't find the hibernate.cfg.xml file so the extractData() method couldn't be executed and the vector is not created.

But I'm still confused because I've the hibernate.cfg.xml file in the root dir of my jar file and I can't understand why it can't find it. BTW I'm creating my jar file using Ant and here is the jar tag:
<target name="jar" depends="compile">
        <mkdir dir="${jar.dir}"/>
        <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
            <manifest>
                <attribute name="Main-Class" value="${exec_report-class}"/>
            </manifest>
        	<fileset dir="src" />
        </jar>
    </target>


As you can see I added "<fileset dir="src" />" so that I can export my configuration and mapping xml files, the hibernate.cfg.xml file is in the src directory of the first project.

Any idea please!!!
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #856365 is a reply to message #855323] Wed, 25 April 2012 15:41 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Claude,

As a test could you jar the hibernate config file by itself manually and
drop it in the web-inf/lib directory?

Jason

On 4/24/2012 2:12 PM, Claude B wrote:
> Hi Jason,
> Thank you for your quick response,
> First I want to answer your question, I tried this code and the result was:
> Pack1 mailto:calculMetrics.performanceMetrics.DataSet@1778087
>
> but while doing this I realized that I ignored an important part of the log file, I'm so sorry I thought it was relative to an old execution, I attached the full log this time and I discovered that the problem is due to Hibernate, it can't find the hibernate.cfg.xml file so the extractData() method couldn't be executed and the vector is not created.
>
> But I'm still confused because I've the hibernate.cfg.xml file in the root dir of my jar file and I can't understand why it can't find it. BTW I'm creating my jar file using Ant and here is the jar tag:
>
> <target name="jar" depends="compile">
> <mkdir dir="${jar.dir}"/>
> <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
> <manifest>
> <attribute name="Main-Class" value="${exec_report-class}"/>
> </manifest>
> <fileset dir="src" />
> </jar>
> </target>
>
>
> As you can see I added "<fileset dir="src" />" so that I can export my configuration and mapping xml files, the hibernate.cfg.xml file is in the src directory of the first project.
>
> Any idea please!!!
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #856462 is a reply to message #856365] Wed, 25 April 2012 17:30 Go to previous messageGo to next message
Claude B is currently offline Claude BFriend
Messages: 32
Registered: February 2012
Member
Hi Jason,

Thanks for your answers, they where helpful for me. Now I can run it perfectly.
In fact I had to delete the jar file containing the project from the scriptlib directory and I put it into the web-inf/lib directory, and this solved the problem Smile
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #856470 is a reply to message #856462] Wed, 25 April 2012 17:42 Go to previous messageGo to next message
Claude B is currently offline Claude BFriend
Messages: 32
Registered: February 2012
Member
Jason, I have another question,
Now I'm going to integrate this web project into another web project which contains many other libs so I want to reduce the number of libs of the web viewer project. At first, I added all libs that I found in the web-inf/lib of the viewer to my project WebContent/web-inf/lib (84 libs) and now I want to delete unused libs: So can you tell me what are the necessary libs that I need to run the viewer???
Re: Problem with Birt Viewer 3.7.1 using Scripted data source [message #857586 is a reply to message #856470] Thu, 26 April 2012 17:22 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Claude this will really depend on what functions you want available to
the user. For example If you do not want to support flat file data
sources you could remove:
org.eclipse.datatools.connectivity.oda.flatfile_version.jar

Jason

On 4/25/2012 1:42 PM, Claude B wrote:
> Jason, I have another question,
> Now I'm going to integrate this web project into another web project
> which contains many other libs so I want to reduce the number of libs of
> the web viewer project. At first, I added all libs that I found in the
> web-inf/lib of the viewer to my project WebContent/web-inf/lib (84 libs)
> and now I want to delete unused libs: So can you tell me what are the
> necessary libs that I need to run the viewer???
Previous Topic:Concatenating logfiles as datasource based on report parameters
Next Topic:Report Error when generating
Goto Forum:
  


Current Time: Wed Apr 24 14:21:45 GMT 2024

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

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

Back to the top