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 Christian Bockermann <ch...@udo.edu> on 2010/07/19 22:12:43 UTC

ClassCast Error

Hi!

Thanks again for helping me out with my former problem. I got my conversion
running in a standalone Java application. Batik is doing excellent!!

However, as soon as I deploy my code into a web-application I run into some
class-cast errors:

Exception in thread "Thread-17" java.lang.ExceptionInInitializerError
	at org.apache.batik.transcoder.SVGAbstractTranscoder.<init>(SVGAbstractTranscoder.java:123)
	at org.apache.batik.transcoder.image.ImageTranscoder.<init>(ImageTranscoder.java:75)
	at org.apache.batik.transcoder.image.PNGTranscoder.<init>(PNGTranscoder.java:44)
        ....
Caused by: java.lang.ClassCastException: org.apache.batik.extension.svg.BatikDomExtension cannot be cast to org.apache.batik.dom.DomExtension
	at org.apache.batik.dom.ExtensibleDOMImplementation.getDomExtensions(ExtensibleDOMImplementation.java:280)
	at org.apache.batik.dom.ExtensibleDOMImplementation.<init>(ExtensibleDOMImplementation.java:95)
	at org.apache.batik.dom.svg.SVGDOMImplementation.<init>(SVGDOMImplementation.java:91)
	at org.apache.batik.dom.svg.SVGDOMImplementation.<clinit>(SVGDOMImplementation.java:1596)
	... 15 more


I suspect this to be related to DOM implementations, e.g. one provided by the
servlet-container (jetty) or the like. Does anyone have experiences with that?


Best regards,

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


Re: ClassCast Error

Posted by Christian Bockermann <ch...@udo.edu>.
Hi Thomas!

Thanks for the answer (and to Jonathan as well, of course!).

Jonathan's tip pointed me to the right direction. I did change my classpath
a bit (re-organizing my maven-dependencies), and now it seems to work almost
perfectly.

The only problem I struggle with now, is the xslt-transformer/fop exiting my
Java VM upon an error, but that is not related to batik.

Thanks again to all your hints!

Chris


Am 21.07.2010 um 14:11 schrieb thomas.deweese@kodak.com:

> Hi Christian, 
> 
> Christian Bockermann <ch...@udo.edu> wrote on 07/19/2010 04:12:43 PM:
> 
> > However, as soon as I deploy my code into a web-application I run into some
> > class-cast errors:
> > 
> > Caused by: java.lang.ClassCastException: 
> > org.apache.batik.extension.svg.BatikDomExtension cannot be cast to 
> > org.apache.batik.dom.DomExtension
> 
>     This indicates that you have Batik in two independent classpath 
> domains within the servlet container (or what ever the web app is 
> talking to. 
> 
>     You can tell this because if you look at 
> org.apache.batik.extension.svg.BatikDomExtension it _does_ extend 
> org.apache.batik.dom.DomExtension.  So the only possible reason 
> to get this exception is if there are two instances of the class 
> "org.apache.batik.dom.DomExtension". 
> 
>     If none of this makes sense to you then you need to find a 
> class path guru and have them help you sort out your class path 
> in the servlet engine. 
> 
>     Good luck. 
> 


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


Re: ClassCast Error

Posted by th...@kodak.com.
Hi Christian,

Christian Bockermann <ch...@udo.edu> wrote on 07/19/2010 
04:12:43 PM:

> However, as soon as I deploy my code into a web-application I run into 
some
> class-cast errors:
> 
> Caused by: java.lang.ClassCastException: 
> org.apache.batik.extension.svg.BatikDomExtension cannot be cast to 
> org.apache.batik.dom.DomExtension

    This indicates that you have Batik in two independent classpath
domains within the servlet container (or what ever the web app is
talking to.

    You can tell this because if you look at 
org.apache.batik.extension.svg.BatikDomExtension it _does_ extend 
org.apache.batik.dom.DomExtension.  So the only possible reason 
to get this exception is if there are two instances of the class 
"org.apache.batik.dom.DomExtension".

    If none of this makes sense to you then you need to find a
class path guru and have them help you sort out your class path
in the servlet engine.

    Good luck.


Re: ClassCast Error

Posted by jonathan wood <jo...@gmail.com>.
Hi Christian,


My guess is that the container's xerces implementation differs from the one
embedded in your app/batik.  Seems the dom implementation is loaded and
resused on first reference (and by the first referencer).  Maybe try
dropping the apps xerces lib and see if the containers implementation will
work?



On Mon, Jul 19, 2010 at 4:12 PM, Christian Bockermann <
christian.bockermann@udo.edu> wrote:

> Hi!
>
> Thanks again for helping me out with my former problem. I got my conversion
> running in a standalone Java application. Batik is doing excellent!!
>
> However, as soon as I deploy my code into a web-application I run into some
> class-cast errors:
>
> Exception in thread "Thread-17" java.lang.ExceptionInInitializerError
>        at
> org.apache.batik.transcoder.SVGAbstractTranscoder.<init>(SVGAbstractTranscoder.java:123)
>        at
> org.apache.batik.transcoder.image.ImageTranscoder.<init>(ImageTranscoder.java:75)
>        at
> org.apache.batik.transcoder.image.PNGTranscoder.<init>(PNGTranscoder.java:44)
>        ....
> Caused by: java.lang.ClassCastException:
> org.apache.batik.extension.svg.BatikDomExtension cannot be cast to
> org.apache.batik.dom.DomExtension
>        at
> org.apache.batik.dom.ExtensibleDOMImplementation.getDomExtensions(ExtensibleDOMImplementation.java:280)
>        at
> org.apache.batik.dom.ExtensibleDOMImplementation.<init>(ExtensibleDOMImplementation.java:95)
>        at
> org.apache.batik.dom.svg.SVGDOMImplementation.<init>(SVGDOMImplementation.java:91)
>        at
> org.apache.batik.dom.svg.SVGDOMImplementation.<clinit>(SVGDOMImplementation.java:1596)
>        ... 15 more
>
>
> I suspect this to be related to DOM implementations, e.g. one provided by
> the
> servlet-container (jetty) or the like. Does anyone have experiences with
> that?
>
>
> Best regards,
>
>    Christian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>