>>>>> "KL" == Karl Larsson <[EMAIL PROTECTED]> writes:
KL> Thanks for your help. I have now got the batik / crimson JAR files
KL> first on my classpath, but when I get to the transcode line, in
KL> throws this error:
It would be really helpful if you could send a stack trace with
line numbers. There are like a dozen createDocument methods in
SAXDocumentFactory. If you have a source distribution the easiest way
to make a debug build is to put a build.properties file with the line
'debug=on' in it in the xml-batik directory (right next to the
build.xml file).
Without that I'm mostly guessing, but I think that
SAXDocumentFactory.java:330 is the problem:
XMLReader parser =
XMLReaderFactory.createXMLReader(parserClassName);
Which probably means a problem with parserClassName (which comes
from XMLResourceDescriptor.getXMLParserClassName() which you print out
in your code below - does it look right?). Can you create the
XMLReader yourself?
Of course it could be any of number of other places, the above is
just an educated guess, line numbers would _really_ help.
KL> java.io.IOException: java.lang.NullPointerException at
KL> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
KL> Source) at SaveAsJPEG.createJPEG(SaveAsJPEG.java:43) at
KL> JavaAgent.NotesMain(JavaAgent.java:32) at
KL> lotus.domino.AgentBase.runNotes(Unknown Source) at
KL> lotus.domino.NotesThread.run(NotesThread.java:208)
KL> org.apache.batik.transcoder.TranscoderException: null Enclosed
KL> Exception: java.lang.NullPointerException at
KL> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
KL> Source) at SaveAsJPEG.createJPEG(SaveAsJPEG.java:43) at
KL> JavaAgent.NotesMain(JavaAgent.java:32) at
KL> lotus.domino.AgentBase.runNotes(Unknown Source) at
KL> lotus.domino.NotesThread.run(NotesThread.java:208)
KL> Here is the code I am using. I pass in the following strings from
KL> another class in the Domino agent:
KL> inputFilePath = "c:\\batik\\batik-1.1.1\\samples\\" inputFileName
KL> = "gvt.svg"
KL> //Start.....................................................
KL> import java.io.*; import
KL> org.apache.batik.transcoder.image.JPEGTranscoder; import
KL> org.apache.batik.transcoder.TranscoderInput; import
KL> org.apache.batik.transcoder.TranscoderOutput; import
KL> org.apache.batik.util.XMLResourceDescriptor; import
KL> org.w3c.dom.DOMImplementation;
KL> public class SaveAsJPEG {
KL> public void createJPEG( String inputFilePath, String
KL> inputFileName) throws Exception {
KL> String parserStr =
KL> XMLResourceDescriptor.getXMLParserClassName();
KL> System.out.println(parserStr);
KL> System.out.println("Getting transcoder....");
KL> JPEGTranscoder t = new JPEGTranscoder();
KL> System.out.println("set the transcoding hints:
KL> quality"); t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new
KL> Float(.8));
KL> System.out.println("create the transcoder input");
KL> String svgURI = new File(inputFilePath,
KL> inputFileName).toURL().toString(); System.out.println(svgURI);
KL> TranscoderInput input = new TranscoderInput(svgURI);
KL> System.out.println("create the transcoder output");
KL> OutputStream ostream = new FileOutputStream("out.jpg");
KL> TranscoderOutput output = new TranscoderOutput(ostream);
KL> System.out.println(output.getOutputStream());
KL> System.out.println("save the image");
KL> t.transcode(input, output);
KL> System.out.println("flush and close the stream then
KL> exit"); ostream.flush(); ostream.close();
KL> System.exit(0);
KL> } }
KL> //End.....................................................
KL> Have you got any ideas?
KL> Thanks,
KL> Karl
KL> Thomas E Deweese <[EMAIL PROTECTED]> To
KL> 04/12/2002 12:49 Batik Users <[EMAIL PROTECTED]> cc
KL> Please respond to Subject "Batik Users" RE:
KL> NoSuchMethodError/NullPointerException with Lotus Notes 6
KL> <[EMAIL PROTECTED]>
>>>>> "KL" == Karl Larsson <[EMAIL PROTECTED]> writes:
KL> I am trying to use the Batik transcoder API as part of a Lotus
KL> Notes 6 Java agent. The code is pretty much the same as the
KL> SaveAsJpeg example in the documentation and it all works fine
KL> until I actually try and transcode the TranscodeInput into the
KL> TranscoderOutput, which gives me the following error:
KL> java.lang.NoSuchMethodError: org.w3c.dom.DOMImplementation: method
KL>
createDocument(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType;)Lorg/w3c/dom/Document;
KL> No such method exceptions are almost always caused by picking
KL> up a DOM implementation that does not support styling. You need
KL> to make sure that the DOM interface included with Batik is earlier
KL> on the class path for the agent than what ever DOM Lotus Notes is
KL> including (I don't know how you would do that or even if it is
KL> possible in Notes).
KL> not found at
KL> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
KL> Source) at SaveAsJPEG.createJPEG(SaveAsJPEG.java:37) at
KL> JavaAgent.NotesMain(JavaAgent.java:32) at
KL> lotus.domino.AgentBase.runNotes(Unknown Source) at
KL> lotus.domino.NotesThread.run(NotesThread.java:208)
KL> Although Lotus Notes natively uses IBM's XML4j.jar, adding
KL> XMLResourceDescriptor.getXMLParserClassName() to the code returns
KL> the following:
KL> org.apache.crimson.parser.XMLReaderImpl
KL> If I remove XML4j.jar from my Notes installation, the agent fails
KL> on the same line but for a different reason:
KL> java.io.IOException: java.lang.NullPointerException at
KL> org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown
KL> Source) at
KL> It's a little hard to tell without line numbers but I think
KL> this is most likely caused by the call to
KL> XMLReaderFactor.createXMLReader(parserClassName) returning Null
KL> (i.e. org.apache.crimson.parser.XMLReaderImpl isn't available).
KL> You can build a debug version by putting adding a
KL> build.properties file in the root of the batik source distribution
KL> with the line 'debug=on' in it.
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
KL> Source) at
KL> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
KL> Source) at SaveAsJPEG.createJPEG(SaveAsJPEG.java:37) at
KL> JavaAgent.NotesMain(JavaAgent.java:32) at
KL> lotus.domino.AgentBase.runNotes(Unknown Source) at
KL> lotus.domino.NotesThread.run(NotesThread.java:208)
KL> org.apache.batik.transcoder.TranscoderException: null Enclosed
KL> Exception: java.lang.NullPointerException at
KL> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
KL> Source) at SaveAsJPEG.createJPEG(SaveAsJPEG.java:37) at
KL> JavaAgent.NotesMain(JavaAgent.java:32) at
KL> lotus.domino.AgentBase.runNotes(Unknown Source) at
KL> lotus.domino.NotesThread.run(NotesThread.java:208)
KL> Again, XMLResourceDescriptor.getXMLParserClassName() returns the
KL> following:
KL> org.apache.crimson.parser.XMLReaderImpl
KL> Has anyone got any ideas? If it helps, Lotus Notes creates a new
KL> classpath each time an agent is run, in the following order:
KL> 1) Any classes or archives added to Lotus Notes ini file (I have
KL> none) 2) Any default classes or archive files Notes uses (this is
KL> where XML4j.jar gets picked up from) 3) And classes or archive
KL> files attached to the agent itself (this is where all the Batik
KL> files are)
KL> Yah, so you need to get the Batik DOM interfaces up into 1 (it
KL> is in batik-ext.jar). Also in #3 do you have all the stuff in lib
KL> (like crimson-parser.jar)?
KL> ---------------------------------------------------------------------
KL> To unsubscribe, e-mail: [EMAIL PROTECTED] For
KL> additional commands, e-mail: [EMAIL PROTECTED]
KL> This email and any files transmitted with it are confidential and
KL> intended solely for the use of individuals or entity to whom they
KL> are addressed.
KL> If you have received this email in error, please notify The
KL> Salvation Army International Headquarters Helpdesk on +44 (0) 20
KL> 7398 5466 or the originator of the message.
KL> Any views expressed in this message are those of the individual
KL> sender, except where the sender specifies and with the authority,
KL> states them to be the views of The Salvation Army International
KL> Trustee Company.
KL> [v3.5.1]
KL> ---------------------------------------------------------------------
KL> To unsubscribe, e-mail: [EMAIL PROTECTED] For
KL> additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]