You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Martin Kristensen <mk...@reklamedata.dk> on 2008/06/09 15:50:45 UTC

Integrating Apache FOP in an Eclipse RCP app gives IncompatibleClassChangeError

Hi,

 

I'm getting this error when running Apache FOP as part of an Eclipse RCP application.

 

java.lang.IncompatibleClassChangeError: Class org.apache.fop.fo.FOTreeBuilder does not implement the requested interface org.xml.sax.ContentHandler

           at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startDocumentInternal(Unknown Source)

           at com.sun.org.apache.xml.internal.serializer.SerializerBase.startDocument(Unknown Source)

           at rd_adsml_financials_fo.transform()

           at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(Unknown Source)

           at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)

           at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)

           at dk.reklamedata.archive.DocConverter.xmlToPdf(DocConverter.java:64)

 

DocConverter.xmlToPdf is a simple XML to PDF conversion, copied from an official Apache FOP example, which works fine if I run it as a separate class. I have created a separate Eclipse plug-in with all the required Apache FOP jars, which I suppose is the way to do it with the Eclipse platform.

 

Anyone else had similar problems when integrating Apache FOP in an Eclipse RCP app?

 

Best regards,

Martin Kristensen / Developer
Reklamedata A/S · Vordingborggade 18-22 · DK-2100 København Ø 
Tel +45 35 272 222 · Fax +45 35 272 299 · Web www.reklamedata.dk <http://www.reklamedata.dk>  
Tel Dir +45 35 272 247 · Mob +45 51990779 · Mail mk@reklamedata.dk <ma...@reklamedata.dk> 

The information in this message is confidential. It is intended solely for the addressee. Access to this message by anyone else is unauthorized. If you are not the intended recipient, do not disclose, copy, or distribute the message without express permission from the sender. Please contact the sender if you have recieved this message in error. 

 

 


Re: Integrating Apache FOP in an Eclipse RCP app gives IncompatibleClassChangeError

Posted by Amin Ahmad <am...@gmail.com>.
I just ran into the same problem. Ideally, you want Apache FOP bundled as a
separate plug-in, but based on what I've read here, you've scrapped that
approach and moved FOP into the same plug-in as the client code because of
this error.
Keep FOP in a separate plug-in but remove the two jars xml-apis and
xml-apis-ext. When these JARs are present in the FOP plug-ins
classpath, FOTreeBuilder implements the ContentHandler interface defined in
the xml-apis JAR, which leads to the incompatible class change error (why
this should be is baffling, but I figure it has something to do with the way
OSGI handles dependencies). When you remove these JARs it falls back to
using the JDK/Eclipse standard ContentHandler class and the error goes away.

I hope this helps,
Amin

On Tue, Jun 17, 2008 at 4:25 AM, Martin Kristensen <mk...@reklamedata.dk>wrote:

> Thanks for the help, both of you who answered. One of my colleagues
> succeeded in doing it by making a plug-in that contains both all the FOP
> jars and all the code that accesses them.
>
> Martin
>
>
> -----Original Message-----
> From: Fabrice Dubach [mailto:fabrice92@gmail.com]
> Sent: 12. juni 2008 12:05
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Integrating Apache FOP in an Eclipse RCP app gives
> IncompatibleClassChangeError
>
>
> Hi,
>
> I had exactly the same error in the same context. How I solve it :
>
> I have renouced to build a separate plug-in which is supposed to
> encapsulated Apache FOP libraries.
>
> I have included directly all needed jars in my own RCP application in a
> simple "lib" folder, than I linked them to my application adding them in
> the
> "classpath" section on the "runtime" page of the "plugin.xml" file.
>
> It works great, even when exporting the corresponding "product" that I
> made
> from this RCP app.
>
> Hope it's help,
>
> Fabrice Dubach
>
>
> Martin Kristensen-2 wrote:
> >
> > Hi,
> >
> > I'm getting this error when running Apache FOP as part of an Eclipse
> RCP
> > application.
> >  java.lang.IncompatibleClassChangeError:
> > (...)
> > I have created a separate Eclipse plug-in with all the required Apache
> FOP
> > jars, which I suppose is the way to do it with the Eclipse platform.
> >
> --
> View this message in context:
> http://www.nabble.com/Integrating-Apache-FOP-in-an-Eclipse-RCP-app-gives
> -IncompatibleClassChangeError-tp17733288p17796549.html<http://www.nabble.com/Integrating-Apache-FOP-in-an-Eclipse-RCP-app-gives-IncompatibleClassChangeError-tp17733288p17796549.html>
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

RE: Integrating Apache FOP in an Eclipse RCP app gives IncompatibleClassChangeError

Posted by Martin Kristensen <mk...@reklamedata.dk>.
Thanks for the help, both of you who answered. One of my colleagues
succeeded in doing it by making a plug-in that contains both all the FOP
jars and all the code that accesses them.

Martin


-----Original Message-----
From: Fabrice Dubach [mailto:fabrice92@gmail.com] 
Sent: 12. juni 2008 12:05
To: fop-users@xmlgraphics.apache.org
Subject: Re: Integrating Apache FOP in an Eclipse RCP app gives
IncompatibleClassChangeError


Hi,

I had exactly the same error in the same context. How I solve it :

I have renouced to build a separate plug-in which is supposed to
encapsulated Apache FOP libraries. 

I have included directly all needed jars in my own RCP application in a
simple "lib" folder, than I linked them to my application adding them in
the
"classpath" section on the "runtime" page of the "plugin.xml" file.

It works great, even when exporting the corresponding "product" that I
made
from this RCP app.

Hope it's help,

Fabrice Dubach


Martin Kristensen-2 wrote:
> 
> Hi,
> 
> I'm getting this error when running Apache FOP as part of an Eclipse
RCP
> application.
>  java.lang.IncompatibleClassChangeError: 
> (...)
> I have created a separate Eclipse plug-in with all the required Apache
FOP
> jars, which I suppose is the way to do it with the Eclipse platform.
> 
-- 
View this message in context:
http://www.nabble.com/Integrating-Apache-FOP-in-an-Eclipse-RCP-app-gives
-IncompatibleClassChangeError-tp17733288p17796549.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Integrating Apache FOP in an Eclipse RCP app gives IncompatibleClassChangeError

Posted by Fabrice Dubach <fa...@gmail.com>.
Hi,

I had exactly the same error in the same context. How I solve it :

I have renouced to build a separate plug-in which is supposed to
encapsulated Apache FOP libraries. 

I have included directly all needed jars in my own RCP application in a
simple "lib" folder, than I linked them to my application adding them in the
"classpath" section on the "runtime" page of the "plugin.xml" file.

It works great, even when exporting the corresponding "product" that I made
from this RCP app.

Hope it's help,

Fabrice Dubach


Martin Kristensen-2 wrote:
> 
> Hi,
> 
> I'm getting this error when running Apache FOP as part of an Eclipse RCP
> application.
>  java.lang.IncompatibleClassChangeError: 
> (...)
> I have created a separate Eclipse plug-in with all the required Apache FOP
> jars, which I suppose is the way to do it with the Eclipse platform.
> 
-- 
View this message in context: http://www.nabble.com/Integrating-Apache-FOP-in-an-Eclipse-RCP-app-gives-IncompatibleClassChangeError-tp17733288p17796549.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Integrating Apache FOP in an Eclipse RCP app gives IncompatibleClassChangeError

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
FOTreeBuilder does indirectly implement ContentHandler (it's a
DefaultHandler subclass). So what you get here is really strange. I've
never seen this. My only explanation is some kind of class loader
confusion, i.e. the ContentHandler expected by the ToSAXHandler is
a different one from the one accessible in the context of FOP. But since
you seem to be using Sun's own Xalan fork (the JDK default), that seems
somewhat unlikely. Except if something loaded some JAXP classes with a
special class loader that does not consult the system class loader.
Something OSGi-ish maybe? I don't know.

Good luck finding the trouble spot!

On 09.06.2008 15:50:45 Martin Kristensen wrote:
> Hi,
>  
> I'm getting this error when running Apache FOP as part of an Eclipse RCP application.
>  
> java.lang.IncompatibleClassChangeError: Class org.apache.fop.fo.FOTreeBuilder does not implement the requested interface org.xml.sax.ContentHandler
>            at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startDocumentInternal(Unknown Source)
>            at com.sun.org.apache.xml.internal.serializer.SerializerBase.startDocument(Unknown Source)
>            at rd_adsml_financials_fo.transform()
>            at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(Unknown Source)
>            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
>            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
>            at dk.reklamedata.archive.DocConverter.xmlToPdf(DocConverter.java:64)
>  
> DocConverter.xmlToPdf is a simple XML to PDF conversion, copied from an
> official Apache FOP example, which works fine if I run it as a separate
> class. I have created a separate Eclipse plug-in with all the required
> Apache FOP jars, which I suppose is the way to do it with the Eclipse
> platform.
>  
> Anyone else had similar problems when integrating Apache FOP in an Eclipse RCP app?
<snip/>


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org