Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Java Event Handler Class Not Found
Java Event Handler Class Not Found [message #717973] Mon, 22 August 2011 21:40 Go to next message
John Roberts is currently offline John RobertsFriend
Messages: 18
Registered: August 2011
Junior Member
I am using BIRT 3.7. I am unable to get a report to find my event handler class in either the IDE or deployed in the BIRT runtime war.

I created a report project and a java project in the same workspace. I can go to the report definition, right click properties, and select my report java class from the pull down menu. However, when I preview the report, I get an error at the end of the report stating that the event handler class is not found.

I have reports that read data via a JDBC connection and display both a chart and tabular data successfully. However - I cannot get it to find the event handler class in a jar that is in (1) WEB-INF/lib or (2) the scriptlib directory.

What else do I need to do to make the class visible to the report?

Thanks.
Re: Java Event Handler Class Not Found [message #717984 is a reply to message #717973] Mon, 22 August 2011 22:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

On the designer side did you set the project specific classpath in the
preferences?
http://birtworld.blogspot.com/2009/12/birt-designer-classpath-changes.html

On the deployed viewer the jar just needs to be in web-inf/lib

For example create a java project with the following class and then
configure your report project to add this Java project to the class path.

package my.event.handlers;

import org.eclipse.birt.report.engine.api.script.IReportContext;
import org.eclipse.birt.report.engine.api.script.element.IReportDesign;
import
org.eclipse.birt.report.engine.api.script.eventadapter.ReportEventAdapter;
import org.eclipse.birt.report.model.api.*;
import org.eclipse.birt.report.model.api.activity.SemanticException;



public class MyReportEvents extends ReportEventAdapter {


@Override
public void beforeFactory(IReportDesign report, IReportContext
reportContext) {

//reportContext.getResource("dd");
//Requires Viewer Plugin
//String xyz =
ViewerPlugin.getDefault().getPluginPreferences().getString( "user_locale");


}

@Override
public void initialize(IReportContext reportContext) {
if( (Boolean)reportContext.getParameterValue("DropTable")){
ReportDesignHandle rdh =
(ReportDesignHandle)reportContext.getDesignHandle();
try{
if( rdh != null ){
DesignElementHandle deh = rdh.findElement("Mytable");
if( deh != null ){
deh.drop();
}
}
}catch( SemanticException e){
e.printStackTrace();
}
}
}

}

Add the attached report to your birt project and see if it runs in the
designer. Copy the attached jar to your web-inf/lib of the deployed
viewer to see if the report will work in the viewer.

Jason

On 8/22/2011 5:40 PM, John Roberts wrote:
> I am using BIRT 3.7. I am unable to get a report to find my event
> handler class in either the IDE or deployed in the BIRT runtime war.
> I created a report project and a java project in the same workspace. I
> can go to the report definition, right click properties, and select my
> report java class from the pull down menu. However, when I preview the
> report, I get an error at the end of the report stating that the event
> handler class is not found.
> I have reports that read data via a JDBC connection and display both a
> chart and tabular data successfully. However - I cannot get it to find
> the event handler class in a jar that is in (1) WEB-INF/lib or (2) the
> scriptlib directory.
>
> What else do I need to do to make the class visible to the report?
>
> Thanks.
Re: Java Event Handler Class Not Found [message #718170 is a reply to message #717984] Tue, 23 August 2011 13:38 Go to previous message
John Roberts is currently offline John RobertsFriend
Messages: 18
Registered: August 2011
Junior Member
I did not realize that the classpath in the reports project prefs had to be set; not documented but certainly does make sense.

Very helpful, thanks!!

p.s. Now that I can run the handler in the designer, I can now see that the problem with the deployed report.

[Updated on: Tue, 23 August 2011 13:41]

Report message to a moderator

Previous Topic:Nested groups are not rendered correctly
Next Topic:Empty data set?
Goto Forum:
  


Current Time: Thu Apr 25 09:16:08 GMT 2024

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

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

Back to the top