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 Diwakar Mantha <dm...@i2.com> on 2001/05/23 02:40:37 UTC

Transcoder & servlet containers

Hi,

I am trying to transcode an SVG string into JPEG format, inside a servlet.
I have not been able to get this working in Tomcat 3.2.1, JRun 3.1beta and
JRun 3.01.  I have appended the Tomcat error, but it is the same
NoSuchMethodError that is mentioned in the Batik FAQ.  It seems to be due to
a conflicting DOM API Java binding that the servlet container uses.  It may
not be a good idea to override the servlet container's jar files, because it
may affect the container functionality.  The only viable option seems to be
that I should use the container's parser for the Transcoder.  All the three
web servers I mentioned have jaxp.jar and parser.jar (Sun parser) in their
lib/ext directories.  I do realize that I have not given the jaxp version,
and I don't know the versions that the containers are using.  I have to
experiment a bit.

Question 1: How do I do this?  Has anyone got this working with the Sun
parser?  Can someone please give me a concrete example by filling in the
blank below,

t.addTranscodingHint(JPEGTranscoder.KEY_XML_PARSER_CLASSNAME, "<what goes
here??>");

Question 2: Any better solutions for using Batik in a servlet container
without hacking the container's 'built-in' classpath?

Thanks,

--Diwakar


Error: 500
Location: /prof/app/3.jsp
Internal Servlet Error:

javax.servlet.ServletException: org.w3c.dom.DOMImplementation: method
createDocument(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType
;)Lorg/w3c/dom/Document; not found
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
Compiled Code)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java, Compiled Code)
	at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
	at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java, Compiled Code)

Root cause:
java.lang.NoSuchMethodError: org.w3c.dom.DOMImplementation: method
createDocument(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType
;)Lorg/w3c/dom/Document; not found
	at
org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFacto
ry.java, Compiled Code)
	at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocument
Factory.java, Compiled Code)
	at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocument
Factory.java, Compiled Code)
	at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTrans
coder.java, Compiled Code)
	at
app._0002fapp_0002f_00033_0002ejsp3_jsp_1._jspService(_0002fapp_0002f_00033_
0002ejsp3_jsp_1.java, Compiled Code)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
Compiled Code)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java, Compiled Code)
	at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
	at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java, Compiled Code)


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


Re: Transcoder & servlet containers

Posted by Thierry Kormann <tk...@sophia.inria.fr>.
On Wednesday 23 May 2001 02:40, Diwakar Mantha wrote:
> Hi,
>
> I am trying to transcode an SVG string into JPEG format, inside a servlet.
> I have not been able to get this working in Tomcat 3.2.1, JRun 3.1beta and
> JRun 3.01.  I have appended the Tomcat error, but it is the same
> NoSuchMethodError that is mentioned in the Batik FAQ.  It seems to be due
> to a conflicting DOM API Java binding that the servlet container uses.  It
> may not be a good idea to override the servlet container's jar files,
> because it may affect the container functionality.  The only viable option
> seems to be that I should use the container's parser for the Transcoder. 
> All the three web servers I mentioned have jaxp.jar and parser.jar (Sun
> parser) in their lib/ext directories.  I do realize that I have not given
> the jaxp version, and I don't know the versions that the containers are
> using.  I have to experiment a bit.
>
> Question 1: How do I do this?  Has anyone got this working with the Sun
> parser?  Can someone please give me a concrete example by filling in the
> blank below,

We are using crimson. Your exception seems to be a DOM Binding problem. You 
are tyring to call a DOM Level 1 method with the parameters of a DOM Level 2 
method. eg: createDocument vs. createDocumentNS.

Batik needs to work with the DOM Level 2 Binding (which are part of the batik 
archive) - so you will probably have to change your classpath bu putting the 
batik .jar files first.

> t.addTranscodingHint(JPEGTranscoder.KEY_XML_PARSER_CLASSNAME, "<what goes
> here??>");
> Question 2: Any better solutions for using Batik in a servlet container
> without hacking the container's 'built-in' classpath?

This hints is not required anymore. It can be used if you want to use your 
won XML parser (instead of crimson - the one used natively in batik).

Thierry.


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


Re: Transcoder & servlet containers

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Diwakar Mantha" <dm...@i2.com>
To: <ba...@xml.apache.org>
Sent: Tuesday, May 22, 2001 17:40
Subject: Transcoder & servlet containers


> Hi,
>
> I am trying to transcode an SVG string into JPEG format, inside a servlet.
> I have not been able to get this working in Tomcat 3.2.1, JRun 3.1beta and
> JRun 3.01.  I have appended the Tomcat error, but it is the same
> NoSuchMethodError that is mentioned in the Batik FAQ.  It seems to be due
to
> a conflicting DOM API Java binding that the servlet container uses.  It
may
> not be a good idea to override the servlet container's jar files, because
it
> may affect the container functionality.  The only viable option seems to
be
> that I should use the container's parser for the Transcoder.  All the
three
> web servers I mentioned have jaxp.jar and parser.jar (Sun parser) in their
> lib/ext directories.  I do realize that I have not given the jaxp version,
> and I don't know the versions that the containers are using.  I have to
> experiment a bit.

on tomcat 3.2.x you can just
-delete parser.jar
-add the batik versions of crimson.jar and jaxp.jar

other web servers are less easy to deal with.




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