[HELP] Java expert needed on fdo#61726

David Ostrovsky d.ostrovsky at idaia.de
Tue Mar 5 16:22:33 PST 2013


/On Tue Mar  5/Lionel Elie Mamane wrote:

>> On Tue, Mar 05, 2013 at 04:20:32PM +0200, Noel Grandin wrote:

>>/  Normally when that happens it indicates that you have multiple
/>>/  copies of the same code in your CLASSPATH, and the two copies are
/>>/  from different versions of the code.
/
>Concretely, how do I find out which this is?
>I tried looking for duplicates in workdir/, but didn't get anywhere.

You have to know what are you looking for.
For that just put some diagnsostic in your java code and produce
Exception stack trace to find out the abusing class.

In your case it is the Interface ReportEngine.java,
because the exception is thrown while trying to load this class:
public class PentahoReportEngine implements ReportEngine

Then with this one liner figure out where is the second class is coming 
from:

for file in `find /home/david/projects/libo/install/ -name "*.jar"`; do 
echo $file; jar -tf $file | grep ReportEngine; done

first one:
/home/david/projects/libo/install/program/classes/unoil.jar
com/sun/star/report/ReportEngine.class

second one:
/home/david/projects/libo/install/share/extensions/report-builder/sun-report-builder.jar
com/sun/star/report/ReportEngine.class

let's look inside it and see the difference:

ReportEngine in unoil.jar:
javap -classpath /home/david/projects/libo/install/program/classes/unoil.jar
public final class com.sun.star.report.ReportEngine extends 
java.lang.Object{
     public static com.sun.star.report.XReportEngine 
create(com.sun.star.uno.XComponentContext);
}

and ReportEngine in sun-report-builder.jar

public interface com.sun.star.report.ReportEngine{
     public abstract com.sun.star.report.ReportJobDefinition 
createJobDefinition();
     public abstract com.sun.star.report.ReportEngineMetaData getMetaData();
     public abstract com.sun.star.report.ReportJob 
createJob(com.sun.star.report.ReportJobDefinition)       throws 
com.sun.star.report.JobDefinitionException;
}

So why it is so? Well apparently a new empty IDL was defined (since 4.1):

offapi/com/sun/star/report/ReportEngine.idl

that collide with our own ReportEngine.java.

to rectify that i renamed our class to be ReportEngine2.java
and you test report from fdo#61726 works like a charm ;-)

David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130306/50150dce/attachment.html>


More information about the LibreOffice mailing list