You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Mikael St�ldal <mi...@home.se> on 2002/01/19 20:05:58 UTC

Batik interference with FOP

I'm trying to embeed both Batik and FOP into an application, and there 
seems to be some strange interference between them. Try this simple example:

prompt>java -classpath batik-rasterizer.jar;fop.jar 
org.apache.batik.apps.rasterizer.Main batikLogo.svg

and you will get this error:

Exception in thread "main" java.lang.AbstractMethodError
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<init>(Unknown Source)
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<clinit>(Unknown 
Source)
         at 
org.apache.batik.transcoder.image.ImageTranscoder.<init>(Unknown Source)
         at org.apache.batik.transcoder.image.PNGTranscoder.<init>(Unknown 
Source)
         at 
org.apache.batik.apps.rasterizer.DestinationType.getTranscoder(Unknown Source)
         at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown 
Source)
         at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
         at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)

When changing the order between Batik and FOP in CLASSPATH, this error goes 
away, but then I get another error in my application:

Exception in thread "main" java.lang.NoSuchMethodError
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<init>(Unknown Source)
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<clinit>(Unknown 
Source)

When leaving out FOP from the CLASSPATH, everything works fine.

I'm using Batik 1.1.1 and FOP 0.19.0.


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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 17:42 2002-02-04 -0500, Thomas E Deweese wrote:
>     This assumes that the problem is a bug in Batik, I believe this
>assumption is a bad one.

Yes, the bug rather seems to be in FOP.



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


Re: Batik interference with FOP

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "MS" == Mikael Ståldal <mi...@home.se> writes:

MS> At 08:10 2002-02-04 -0500, Thomas E Deweese wrote:
>> I don't know for certain but I suspect that the jar file
>> 'Class-Path' manifest directive adds the referenced jar files at
>> the end of the current class path.  So our DOM impl jar file ends
>> up after the fop jar.

MS> Wouldn't it be a good idea to fix the bug in Batik that makes it
MS> dependent on CLASSPATH order?

    This assumes that the problem is a bug in Batik, I believe this
assumption is a bad one.

    I'm not an expert on this (so I'm sure Thierry will correct me if
I'm wrong) but my understanding is that Batik requires a DOM that is
styleable (since SVG uses styling).  Older versions of the DOM
interface don't support styling and therefore are incompatible with
SVG and hence incompatible with Batik.  This 'bug' in Batik is that it
requires a styleable DOM and you apparently aren't giving it one.

    Good luck tracking things down...

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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 08:10 2002-02-04 -0500, Thomas E Deweese wrote:
>     I don't know for certain but I suspect that the jar file
>'Class-Path' manifest directive adds the referenced jar files at the
>end of the current class path.  So our DOM impl jar file ends up after the 
>fop jar.

Wouldn't it be a good idea to fix the bug in Batik that makes it dependent 
on CLASSPATH order?



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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 17:34 2002-02-04 -0500, Thomas E Deweese wrote:
>     I am now 100% convinced the problem is in your setup, I hope the
>following will convince you.  I still suspect an old copy of xerces is
>putting it's self somewhere on your classpath.

Finally I found the error. fop.jar contains a reference to an old 
batik.jar, when I renamed the old batik.jar the error disappeared.

However, FOP seems to be dependent on this old Batik, and doesn't work 
properly with the new one:
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/batik/gvt/
GraphicsNodeRenderContext
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:120)
         at org.apache.fop.apps.Driver.setRenderer(Driver.java:298)
         at org.apache.fop.apps.Driver.setRenderer(Driver.java:283)

I hope the FOP people can fix this problem.



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


Re: Batik interference with FOP

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "MS" == Mikael Ståldal <mi...@home.se> writes:

MS> At 08:10 2002-02-04 -0500, Thomas E Deweese wrote:
>> Try the following instead:

MS> Same error. And also the same error if I remove
MS> "batik/barik-rasterizer.jar".

    I am now 100% convinced the problem is in your setup, I hope the
following will convince you.  I still suspect an old copy of xerces is
putting it's self somewhere on your classpath.

    The following worked for me:

% cvs checkout xml-batik
  [...]
% cvs checkout xml-fop
  [...]
% cd xml-fop
% build.sh
  [...]
% cd ../xml-batik
% build.sh jars
  [...]
% cp ../xml-fop/build/fop.jar .
% java -cp batik-1.1.1/batik-rasterizer.jar:fop.jar org.apache.batik.apps.rasterizer.Main samples/batikLogo.svg
About to transcode 1 SVG file(s)

Converting batikLogo.svg to samples/batikLogo.png ... ... success

---

    I don't know what else to tell you.  You might try compiling your
batik build debug (create a 'build.properties' file in 'xml-batik'
with the line 'debug=on') to see if that tells you anything.  The
abstract method error has _always_ been a problem with an old copy of
the DOM interfaces hiding the new DOM interfaces Batik needs (this
problem has come up 4 or 5 times at least and it has always been
this).  Do a find on xerces, try using javap and overriding
bootclasspath and extdirs. Somewhere you have a copy of an old DOM
interface creeping in.

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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 08:10 2002-02-04 -0500, Thomas E Deweese wrote:
>     Try the following instead:
>
>% java -classpath 
>batik/batik-rasterizer.jar;batik/lib/batik-ext.jar;batik/lib/batik-dom.jar;batik/lib/batik-css.jar;batik/lib/batik-svg-dom.jar;batik/lib/batik-gvt.jar;batik/lib/batik-parser.jar;batik/lib/batik-script.jar;batik/lib/batik-bridge.jar;batik/lib/batik-transcoder.jar;batik/lib/batik-awt-util.jar;batik/lib/batik-util.jar;batik/lib/batik-xml.jar;batik/lib/crimson-parser.jar;batik/lib/js.jar;fop/fop.jar 
>org.apache.batik.apps.rasterizer.Main batik/samples/batikLogo.svg

Same error. And also the same error if I remove "batik/barik-rasterizer.jar".



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


Re: Batik interference with FOP

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "MS" == Mikael Ståldal <mi...@home.se> writes:

MS> At 15:33 2002-01-30 -0500, Thomas E Deweese wrote:
>> It's not clear what your classpath is (environment var or what ever
>> they are called under windows), and it's not clear that you don't
>> have an old DOM impl in your jre/lib/ext dir.

MS> OK, I tried it again. My jre/lib/ext directory is empty, any the
MS> CLASSPATH environment variable is not set.

MS> C:\javaInstall>java -classpath
MS> batik/batik-rasterizer.jar;fop/fop.jar
MS> org.apache.batik.apps.rasterizer.Main batik/samples/batikLogo.svg

    I don't know for certain but I suspect that the jar file
'Class-Path' manifest directive adds the referenced jar files at the
end of the current class path.  So our DOM impl jar file ends up after
the fop jar.

    Try the following instead:

% java -classpath batik/batik-rasterizer.jar;batik/lib/batik-ext.jar;batik/lib/batik-dom.jar;batik/lib/batik-css.jar;batik/lib/batik-svg-dom.jar;batik/lib/batik-gvt.jar;batik/lib/batik-parser.jar;batik/lib/batik-script.jar;batik/lib/batik-bridge.jar;batik/lib/batik-transcoder.jar;batik/lib/batik-awt-util.jar;batik/lib/batik-util.jar;batik/lib/batik-xml.jar;batik/lib/crimson-parser.jar;batik/lib/js.jar;fop/fop.jar org.apache.batik.apps.rasterizer.Main batik/samples/batikLogo.svg

    You might also want to try the 'all-jar' build target to build
batik-all.jar which will include all the above (plus a bit more).
This would make your classpath more like your first one, but you would
still need some of the library jars in there.

java -classpath batik/batik-all.jar;batik/lib/crimson-parser.jar;batik/lib/js.jar;fop/fop.jar org.apache.batik.apps.rasterizer.Main batik/samples/batikLogo.svg

    Hope this helps...

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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 15:33 2002-01-30 -0500, Thomas E Deweese wrote:
>     It's not clear what your classpath is (environment var or what
>ever they are called under windows), and it's not clear that you don't
>have an old DOM impl in your jre/lib/ext dir.

OK, I tried it again. My jre/lib/ext directory is empty, any the CLASSPATH 
environment variable is not set.

C:\javaInstall>java -classpath batik/batik-rasterizer.jar;fop/fop.jar 
org.apache.batik.apps.rasterizer.Main     batik/samples/batikLogo.svg

Exception in thread "main" java.lang.AbstractMethodError
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<init>(Unknown Source)
         at 
org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<clinit>(Unknown 
Source)
         at 
org.apache.batik.transcoder.image.ImageTranscoder.<init>(Unknown Source)
         at org.apache.batik.transcoder.image.PNGTranscoder.<init>(Unknown 
Source)
         at 
org.apache.batik.apps.rasterizer.DestinationType.getTranscoder(Unknown Source)
         at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown 
Source)
         at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
         at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)

I use Batik 1.1.1. I tried both FOP 0.19.0 and FOP 0.20.1 with similar result.

It works fine if I remove FOP from classpath.

I use Windows 2000, and "java -version" gives:
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)



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


Re: Batik interference with FOP

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "MS" == Mikael Ståldal <mi...@home.se> writes:

MS> At 15:04 2002-01-28 +0100, Thierry Kormann wrote:
>> > prompt>java -classpath batik-rasterizer.jar;fop.jar >
>> org.apache.batik.apps.rasterizer.Main batikLogo.svg

>> check your classpath and put batik jar files first.

MS> That's what I did, didn't I?

http://xml.apache.org/batik/faqs.html#faq-20

When I try to run Batik it results in a NoSuchMethodException. What is
the problem?


    There is certainly something wrong with your classpath. Clear your
    CLASSPATH environment variable and be sure to remove all the
    libraries which use the W3C's DOM bindings from jre/lib/ext before
    running any of the Batik's applications.



    It's not clear what your classpath is (environment var or what
ever they are called under windows), and it's not clear that you don't
have an old DOM impl in your jre/lib/ext dir.


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


Re: Batik interference with FOP

Posted by Mikael St�ldal <mi...@home.se>.
At 15:04 2002-01-28 +0100, Thierry Kormann wrote:
> > prompt>java -classpath batik-rasterizer.jar;fop.jar
> > org.apache.batik.apps.rasterizer.Main batikLogo.svg

>check your classpath and put batik jar files first.

That's what I did, didn't I?



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


Re: Batik interference with FOP

Posted by Thierry Kormann <tk...@ilog.fr>.
On Saturday 19 January 2002 20:05, Mikael Ståldal wrote:
> I'm trying to embeed both Batik and FOP into an application, and there
> seems to be some strange interference between them. Try this simple
> example:
>
> prompt>java -classpath batik-rasterizer.jar;fop.jar
> org.apache.batik.apps.rasterizer.Main batikLogo.svg
>
> and you will get this error:
>
> Exception in thread "main" java.lang.AbstractMethodError
>          at
> org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<init>(Unknown
> Source) at
> org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<clinit>(Unknown
> Source)
>          at
> org.apache.batik.transcoder.image.ImageTranscoder.<init>(Unknown Source)
>          at org.apache.batik.transcoder.image.PNGTranscoder.<init>(Unknown
> Source)
>          at
> org.apache.batik.apps.rasterizer.DestinationType.getTranscoder(Unknown
> Source) at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown
> Source)
>          at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
>          at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)
>
> When changing the order between Batik and FOP in CLASSPATH, this error goes
> away, but then I get another error in my application:
>
> Exception in thread "main" java.lang.NoSuchMethodError
>          at
> org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<init>(Unknown
> Source) at
> org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation.<clinit>(Unknown
> Source)
>
> When leaving out FOP from the CLASSPATH, everything works fine.
>
> I'm using Batik 1.1.1 and FOP 0.19.0.


check your classpath and put batik jar files first. It seems that FOP 
includes old DOM bindings.


Thierry.


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