xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Embedding FOP: error with FopFactory
Date Sun, 02 Mar 2008 15:36:41 GMT
This error clearly indicates that avalon-framework is not in the
classpath. Please make sure all JAR files are correctly integrated in
your application's classpath.

On 29.02.2008 21:49:42 Fournier,Danny [NCR] wrote:
> Good eye!
> 
> I copied *.jar from the lib folder to a folder in my classpath. I now
> get a different error:
> 
> java.lang.NoClassDefFoundError:
> org/apache/avalon/framework/configuration/ConfigurationException
> 	at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:149)
> 	at
> org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:165)
> 	at MyFop.render(MyFop.java:75) 
> 
> In my folder I have the following file: "avalon-framework-4.2.0.jar".
> 
> I followed this trail to line 149:
> 
> this.config = new FopFactoryConfigurator(this);
> 
> Dan
> 
> > -----Original Message-----
> > From: Andreas Delmelle [mailto:andreas.delmelle@telenet.be] 
> > Sent: February 29, 2008 3:18 PM
> > To: fop-users@xmlgraphics.apache.org
> > Subject: Re: Embedding FOP: error with FopFactory
> > 
> > On Feb 29, 2008, at 21:07, Fournier,Danny [NCR] wrote:
> > 
> > Hi
> > 
> > > I'm having issues calling the FopFactory.newInstance() method.
> > >
> > > It's basically a cut and paste from the example I found on Apache's 
> > > site
> > >
> > > -- Error --
> > > ROOT CAUSE:
> > > java.lang.NoClassDefFoundError: org/apache/xmlgraphics/util/Service
> > >         at
> > > org.apache.fop.util.ContentHandlerFactoryRegistry.discover
> > > (ContentHandlerFactoryRegistry.java:102)
> > >         at org.apache.fop.util.ContentHandlerFactoryRegistry.<init>
> > > (ContentHandlerFactoryRegistry.java:47)
> > >         at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:75)
> > >         at org.apache.fop.apps.FopFactory.newInstance
> > > (FopFactory.java:165)
> > >         at MyFop.render(MyFop.java:75)
> > >
> > Seems to be a classpath-related issue.
> > Check whether all FOP's dependencies (= the JARs in the 
> > %FOP_ROOT%/ lib directory) are present and correctly loaded.
> > The error is due to the xmlgraphics-commons JAR being missing...
> > 
> > HTH!
> > 
> > 
> > Cheers
> > 
> > Andreas
> > >
> > > -- Code --
> > > public void render(){
> > >         try {
> > >
> > >             // configure fopFactory as desired
> > > 75:             FopFactory fopFactory = FopFactory.newInstance();
> > >
> > >             FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
> > >             // configure foUserAgent as desired
> > >
> > >             // Setup output
> > >             OutputStream out = new 
> > java.io.FileOutputStream(this.pdf);
> > >             out = new java.io.BufferedOutputStream(out);
> > >
> > >                 try {
> > >                 // Construct fop with desired output format
> > >                 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
> > > foUserAgent, out);
> > >
> > >                 // Setup XSLT
> > >                 TransformerFactory factory = 
> > > TransformerFactory.newInstance();
> > >                 Transformer transformer = 
> > factory.newTransformer (new 
> > > StreamSource(this.xslt));
> > >
> > >                 // Set the value of a <param> in the stylesheet
> > >                 transformer.setParameter("versionParam", "2.0");
> > >
> > >                 // Setup input for XSLT transformation
> > >                 Source src = new StreamSource(this.xml);
> > >
> > >                 // Resulting SAX events (the generated FO) must be 
> > > piped through to FOP
> > >                 Result res = new SAXResult(fop.getDefaultHandler());
> > >
> > >                 // Start XSLT transformation and FOP processing
> > >                 transformer.transform(src, res);
> > >             } finally {
> > >                 out.close();
> > >             }
> > >
> > >             System.out.println("Success!");
> > >         } catch (Exception e) {
> > >             e.printStackTrace(System.err);
> > >             System.exit(-1);
> > >         }
> > >     }
> > >
> > > Dan
> > >




Jeremias Maerki


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


Mime
View raw message