Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
View Report as ODT not working (Report with an eventhandler)
JohannJ
Hello
I am running Eclipse Mars.1 with BIRT 4.5.0.
I have a report with a table and a DataSet. In one cell I have an eventhandler
called "LatLonToLonLat". If I start a report preview with "View Report - View Report as ODT" I got the following error:
- the browser opens with an error message "Error: File not found ..."
- Error Log:
Error for "/viewer/preview"
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.eads.fo.birt.eventhandler.LatLonToLonLat.(LatLonToLonLat.java:30)
...
If I delete the eventhandler in the report, the preview is ok.
How can I fix this?
Find more posts tagged with
Comments
Clement Wong
<p>What does your LatLonToLonLat event handler do?</p>
<p> </p>
<p>Are there any dependencies to your LatLonToLonLat event handler? External JARs? If so, where are those located?</p>
<p> </p>
<p>Does it a have org.apache.log4j.Logger dependency in the project?</p>
JohannJ
<p>Thank you for your answer</p>
<p> </p>
<p>The "LatLonToLatLon" eventhandler converts a coordinate from database to a formatted string.</p>
<p>The class "LatLonToLatLon" extends the "DataItemEventAdapter" and is located in a project "birt".</p>
<p>The class has dependencies to</p>
<p>- org.apache.log4j.Logger (located in a separate project)</p>
<p>- java.math.BigDecimal</p>
<p>- and other separate projects for coordinate conversion, Jni utilities, ...</p>
<p>All these projects are referenced in the java build path of the project "birt". The project "birt" also</p>
<p>includes the report design file.</p>
<p>The only reference to my "LatLonToLatLon" class is in the report design file.</p>
Clement Wong
<p>Did you review the steps in this FAQ @ <a data-ipb='nomediaparse' href='
http://wiki.eclipse.org/BIRT/FAQ/JavaEventHandlers?'>http://wiki.eclipse.org/BIRT/FAQ/JavaEventHandlers?</a></p>
;
JohannJ
<p>Thanks for your answer, it was very helpful.<br><br>
I found a way how it works with the most of my eventhandlers (eventhandlers without JNI).<br>
In eclipse (Windows - Preferences - Report Design - Classpath), I added the class-folders with my eventhandlers and the dependent projects (eventhandler, log4j, coordinate conversion, ...) to the report desing classpath.<br>
If I now start a report preview with "View Report - View Report as ODT" the preview is ok.<br>
Is there a difference to the solution described in the FAQ <a data-ipb='nomediaparse' href='?'>
http://wiki.eclipse....aEventHandlers?</a><br><br>
;
I doesn't work with eventhandlers using JNI functions.<br>
Below is a code snippet of my eventhandler with an JNI function call:<br><br>
public class GenerateName extends DataItemEventAdapter {<br>
...<br>
public GenerateName() {<br>
....<br>
JniUtilities.loadLibrary();<br>
....<br>
}<br><br>
public void onRender(IDataItemInstance arg0, IReportContext arg1) {<br>
....<br>
GenericNameFunc.read_gui_name(objId, generatedName);<br>
....<br>
}<br>
}<br><br>
If I use this eventhandler in my BIRT report and start the preview, I got the following exception<br><br>
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.<br>
....<br>
at java.lang.Thread.run(Thread.java:745)<br>
Caused by: java.lang.UnsatisfiedLinkError: com.utilities.jni.UtilitiesJNI.GenericNameFunc_read_gui_name(JLjava/lang/StringBuffer;)Z<br>
at com.utilities.jni.UtilitiesJNI.GenericNameFunc_read_gui_name(Native Method)<br>
at com.utilities.jni.GenericNameFunc.read_gui_name(GenericNameFunc.java:117)<br>
at com.birt.eventhandler.GenerateName.onRender(GenerateName.java:50)<br>
at org.eclipse.birt.report.engine.script.internal.DataItemScriptExecutor.handleOnRender(DataItemScriptExecutor.java:89)<br>
at org.eclipse.birt.report.engine.script.internal.OnRenderScriptVisitor.visitDataItem(OnRenderScriptVisitor.java:96)<br>
at org.eclipse.birt.report.engine.ir.DataItemDesign.accept(DataItemDesign.java:67)<br>
....<br><br>
Thanks in advance.</p>