|
Re: Java Event Handler Class Not Found [message #717984 is a reply to message #717973] |
Mon, 22 August 2011 22:27 |
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04114 seconds