xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hardy <vincent.ha...@sun.com>
Subject Re: batik fails under servlet
Date Tue, 02 Apr 2002 12:18:38 GMT
Katja,

Thomas will likely give more info on this, but I am not sure his is
going to be able to answer before some time. So, in the meanwhile.

You are right in the description of the problem: it comes from the
fact that one of the Batik classes which inherits from 
RenderingHints.Key is being reloaded. As you point out, this would
go away if you make sure these classes are not reloaded with one
of the methods you listed. 

Someone proposed a work-around this problem earlier and this is the
part Thomas will comment on later (the proposal boils down to detecting
collisions in the unique key value), so yes, there have been people 
thinking about it and there is a solution on its way (the one proposed
or something close).

Vincent.

Katja A Kivilahti wrote:
> 
> It seems I am not the only one having this problem. But I failed to find
> out whether this has been registered as a bug or accepted as a "feature"..
> 
> I am using fop 0.20.3 that comes with batik 1.1.1, in a web application
> under Resin 2.0.5 (Windows 2000). All jars are in the application's
> WEB-INF/lib. Each time the application is redeployed in the servlet
> container, batik throws an exception and the servlet engine has to be
> restarted. I tried replacing batik 1.1.1 with 1.0, with the same results.
> 
> This is apparently caused by the servlet container's classloader reloading
> java.awt.RenderingHints.Key subclasses. They try to register themselves
> from the constructor. Registered instances are stored in a static map in
> RenderingHints.Key. And because RenderingHints.Key is already loaded in
> the core VM, it contains all previously registered instances, and throws
> an error. On subsequent calls there is a NoClassDefFoundError (stack
> traces below). I hope I made some sense here, I know very little about
> awt.
> 
> It seems to me that the only solution is to place batik.jar in resin/lib,
> or jdk's jre/lib/ext, making batik part of the core VM. This doesn't work
> well in a production environment, for obvious reasons.
> 
> Has anyone thought about this problem? Does this qualify as a bug? Or am I
> missing out on some (other) obvious solution here?
> 
> --
> Katja Kivilahti
> 
> -------------------------
> 
> java.lang.ExceptionInInitializerError: java.lang.IllegalArgumentException:
> Instance(10100) of org.apache.batik.ext.awt.TranscodingHintKey already
> registered
>         at
> java.awt.RenderingHints$Key.recordIdentity(RenderingHints.java:45)
>         at java.awt.RenderingHints$Key.<init>(RenderingHints.java:64)
>         at org.apache.batik.ext.awt.TranscodingHintKey.<init>(Unknown
> Source)
>         at org.apache.batik.ext.awt.RenderingHintsKeyExt.<clinit>(Unknown
> Source)
>         at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument(PDFRenderer.java:468)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderSVGArea(PDFRenderer.java:382)
>         at org.apache.fop.svg.SVGArea.render(SVGArea.java:58)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderForeignObjectArea(PDFRenderer.java:366)
>         at
> org.apache.fop.layout.inline.ForeignObjectArea.render(ForeignObjectArea.java:50)
>         at
> org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:223)
>         at org.apache.fop.layout.LineArea.render(LineArea.java:163)
>         at
> org.apache.fop.render.AbstractRenderer.renderBlockArea(AbstractRenderer.java:192)
>         at org.apache.fop.layout.BlockArea.render(BlockArea.java:82)
>         at
> org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:158)
>         at
> org.apache.fop.layout.AreaContainer.render(AreaContainer.java:38)
>         at
> ...
> org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:158)
>         at org.apache.fop.layout.ColumnArea.render(ColumnArea.java:33)
>         at
> org.apache.fop.render.AbstractRenderer.renderSpanArea(AbstractRenderer.java:58)
>         at org.apache.fop.layout.SpanArea.render(SpanArea.java:53)
>         at
> org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer(AbstractRenderer.java:114)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderPage(PDFRenderer.java:732)
>         at
> org.apache.fop.render.pdf.PDFRenderer.render(PDFRenderer.java:700)
>         at
> org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java:217)
>         at org.apache.fop.layout.AreaTree.addPage(AreaTree.java:81)
>         at
> org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:307)
>         at
> org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:200)
>         at
> org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:182)
>         at
> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
>         at
> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
>         at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
>         at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
>         at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
>         at org.apache.fop.apps.Driver.render(Driver.java:481)
>         at org.apache.fop.apps.Driver.run(Driver.java:554)
>         at
> com.xxx.xxx.pdfgenerator.FOPBridge.renderFO(FOPBridge.java:60)
>         at
> ..
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
>         at
> com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:82)
>         at com.caucho.server.http.Invocation.service(Invocation.java:277)
>         at
> com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
>         at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:216)
>         at
> com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:158)
>         at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
>         at java.lang.Thread.run(Thread.java:484)
> 
> ..
> 
> [2002/03/28 11:23:35] null
> java.lang.NoClassDefFoundError
>         at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument(PDFRenderer.java:468)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderSVGArea(PDFRenderer.java:382)
>         at org.apache.fop.svg.SVGArea.render(SVGArea.java:58)
>         at
> org.apache.fop.render.pdf.PDFRenderer.renderForeignObjectArea(PDFRenderer.java:366)
>         at
> org.apache.fop.layout.inline.ForeignObjectArea.render(ForeignObjectArea.java:50)
>         at
> org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:223)
>         at org.apache.fop.layout.LineArea.render(LineArea.java:163)
>         at
> org.apache.fop.render.AbstractRenderer.renderBlockArea(AbstractRenderer.java:192)
>         at org.apache.fop.layout.BlockArea.render(BlockArea.java:82)
>         at
> org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:158)
>         at
> ...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org

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


Mime
View raw message