Thomas,

Thanks for your help. I have now got the batik / crimson JAR files first on my 
classpath, but when I get to the
transcode line, in throws this error:

java.io.IOException: java.lang.NullPointerException
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
at SaveAsJPEG.createJPEG(SaveAsJPEG.java:43)
at JavaAgent.NotesMain(JavaAgent.java:32)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(NotesThread.java:208)

org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
java.lang.NullPointerException
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
at SaveAsJPEG.createJPEG(SaveAsJPEG.java:43)
at JavaAgent.NotesMain(JavaAgent.java:32)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(NotesThread.java:208)

Here is the code I am using. I pass in the following strings from another class in the 
Domino agent:

inputFilePath = "c:\\batik\\batik-1.1.1\\samples\\"
inputFileName = "gvt.svg"

//Start.....................................................

import java.io.*;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.util.XMLResourceDescriptor;
import org.w3c.dom.DOMImplementation;

public class SaveAsJPEG {

        public void createJPEG( String inputFilePath, String inputFileName)
           throws Exception {

            String parserStr = XMLResourceDescriptor.getXMLParserClassName();
            System.out.println(parserStr);

            System.out.println("Getting transcoder....");
            JPEGTranscoder t = new JPEGTranscoder();

            System.out.println("set the transcoding hints: quality");
                   t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));

            System.out.println("create the transcoder input");
            String svgURI = new File(inputFilePath, inputFileName).toURL().toString();
                  System.out.println(svgURI);
            TranscoderInput input = new TranscoderInput(svgURI);

            System.out.println("create the transcoder output");
            OutputStream ostream = new FileOutputStream("out.jpg");
            TranscoderOutput output = new TranscoderOutput(ostream);
            System.out.println(output.getOutputStream());

            System.out.println("save the image");
            t.transcode(input, output);

            System.out.println("flush and close the stream then exit");
            ostream.flush();
            ostream.close();

        System.exit(0);

    }
}

//End.....................................................

Have you got any ideas?

Thanks,

Karl



                                                                                       
                                 
             Thomas E Deweese                                                          
                                 
             <[EMAIL PROTECTED]>                                                
                                 
                                                                                       
                              To 
             04/12/2002 12:49                            Batik Users 
<[EMAIL PROTECTED]>                       
                                                                                       
                              cc 
                                                                                       
                                 
                      Please respond to                                                
                         Subject 
                        "Batik Users"                    RE: 
NoSuchMethodError/NullPointerException with Lotus Notes 6  
                <[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:
KL>   org.w3c.dom.DOMImplementation: method
KL> 
createDocument(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType;)Lorg/w3c/dom/Document;

    No such method exceptions are almost always caused by picking up a
DOM implementation that does not support styling.  You need to make
sure that the DOM interface included with Batik is earlier on the
class path for the agent than what ever DOM Lotus Notes is including
(I don't know how you would do that or even if it is 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

    It's a little hard to tell without line numbers but I think this
is most likely caused by the call to
XMLReaderFactor.createXMLReader(parserClassName) returning Null (i.e.
org.apache.crimson.parser.XMLReaderImpl isn't available).

    You can build a debug version by putting adding a build.properties
file in the root of the batik source distribution 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)

    Yah, so you need to get the Batik DOM interfaces up into 1 (it is
in batik-ext.jar). Also in #3 do you have all the stuff in lib (like
crimson-parser.jar)?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





This email and any files transmitted with it are confidential and intended solely for 
the use of individuals or entity to whom they are addressed.

If you have received this email in error, please notify The Salvation Army 
International Headquarters Helpdesk on +44 (0) 20 7398 5466 or the originator of the 
message.

Any views expressed in this message are those of the individual sender, except where 
the sender specifies and with the authority, states them to be the views of The 
Salvation Army International Trustee Company.

[v3.5.1]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to