Hi,
I've been following this thread with interest. I've only
just started working with tomcat and servlets and I'm working
on a similar rasterizing servlet.

My code so far (based on this thread) looks like :

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.batik.transcoder.*;
import org.apache.batik.transcoder.image.*;
import org.apache.batik.*;


public class BatikServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {


File fin = new File("/home/aruke/servlets/400pix.svg");
File fout = new File("/home/aruke/servlets/servlet.png");


       String good;
       if (fin.canRead() && fout.canRead())
       {
               good = transcodeSVG(fin,fout);
       }
       else
       {
           good = "File Not Found";
       }

response.setContentType("text/html");
PrintWriter pout = response.getWriter();
String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0Transitional//EN\">";
String headStr = "<HTML><HEAD><TITLE>Testing</TITLE></HEAD><BODY BGCOLOR=\"#FDF5E6\"><b>";
String tailStr = "</b></BODY></HTML>";
pout.println(docType + headStr + good + tailStr);
}


   public String transcodeSVG(File fin, File fout)
       throws IOException {
       String good="File Available";

       try
       {
           FileInputStream is = new FileInputStream(fin);
           FileOutputStream os = new FileOutputStream(fout);

TranscoderInput in = new TranscoderInput(is);
in.setURI(fin.toURL().toString());


           TranscoderOutput out = new TranscoderOutput(os);
           out.setURI(fout.toString());

PNGTranscoder png=new PNGTranscoder();
png.transcode(in, out);
good +="<br><br>File Transcoded";
}
catch (TranscoderException e) {
good += "Transcoder Error : " + e; } return good;
}
}


And it compiles fine. My problem is that when I try and run it under tomcat
I get a

java.lang.NoClassDefFoundError: org/apache/batik/transcoder/TranscoderException

Error, and I'm stumped. All the batik stuff is in the classpath and if I modify this and run it
as a commandline app it works fine. Is there something I have to do to get batik to
work with Tomcat ?


I realise this is probably more of a tomcat question than batik, but someone might
have a quick answer ..............


Cheers
Colm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Website : http://www.angelfire.com/ia/japan/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Reply via email to