Bug 19016 - java.lang.NoClassDefFoundError: org/xml/sax/SAXException
Summary: java.lang.NoClassDefFoundError: org/xml/sax/SAXException
Status: CLOSED WORKSFORME
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.20.4
Hardware: Sun Solaris
: P1 blocker
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-15 01:23 UTC by Ozhan
Modified: 2012-04-01 13:55 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozhan 2003-04-15 01:23:15 UTC
Hi,

I have written a simple script to read in an xml file from the command line and 
convert it to pdf. I have put the script in the FOP/source/fop-0.20.4/src 
directory. When I run the build script, it compiles okay. However, when I try 
and run the compiled code it gives me the following error:

test:ozhan 510% java RenderingEngine input.xml output.pdf
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/xml/sax/SAXException
        at RenderingEngine.main(Unknown Source)

It appears that the sax library isn't present in my source tree. The code is 
shown below:
------

import java.io.*;
import java.lang.*;
import java.util.*;

// FOP libraries
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.messaging.MessageHandler;

import org.xml.sax.InputSource;
import org.apache.fop.apps.FOPException;

import org.apache.avalon.framework.logger.ConsoleLogger;  
import org.apache.avalon.framework.logger.Logger; 


class RenderingEngine
{
    public static void main(String args[])
    {
        if (args.length != 2)
        {
            System.err.println("Usage: % java RenderingEngine " + 
                "<inputFileName.xml> <outputFileName.pdf>");
            System.exit(1);
        }

        try
        {
            String inFileName = args[0];
            String outFileName = args[1];
            
            try
            {
                Driver driver = new Driver(new InputSource (inFileName),
                    new FileOutputStream(outFileName));
                driver.setRenderer(Driver.RENDER_PDF);
                driver.run();

                Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
                MessageHandler.setScreenLogger(logger);
                driver.setLogger(logger);
            }
            catch (FOPException ex)
            {
                //throw new FOPException(ex);
                System.err.println("ERROR: " + ex);
            }

        }
        catch (IOException exception)
        {
            System.err.println(exception);
            System.exit(1);
        }
    }
}
Comment 1 Ozhan 2003-04-15 03:49:18 UTC
I should also point out, the reason for this program is purely to test that I 
can call FOP libraries from a stand alone application. Once I have this working 
I can progress onto more advanced tasts I have planned out.
Comment 2 Jeremias Maerki 2003-04-15 06:17:37 UTC
Please don't use Bugzilla for this kind of thing. The fop-user mailing list is 
better suited for getting help.

You're missing the JAXP API in your classpath (xml-apis.jar for example). Have 
a look at the fop.sh script in the root directory of the FOP distribution for 
comparison. The command-line option you need to look for is -cp or -classpath.

And by the way, you should set up the logger before calling run(). After run() 
the show is already over. :-)

I'm closing this entry. Please follow up on the fop-user mailing list.
Comment 3 Glenn Adams 2012-04-01 13:55:30 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs