You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Vladimir Dejanovic <vl...@zemljasnova.net> on 2009/06/03 13:34:51 UTC

FopFactory.newInstance() error

Hello, 

I created app which is run on tomcat and I am using fop to create some PDF.
Strange thing is happening , after several month of working it just stopped
working, funny thing is that as far as I know nothing is changed. Error is
occurring in this call 

FopFactory.newInstance()

this is error from log

SVGElementMapping.initialize(87) | Error while initializing the Batik SVG
extensions
java.lang.NoClassDefFoundError: org/apache/batik/util/XMLResourceDescriptor
        at
org.apache.fop.fo.extensions.svg.SVGElementMapping.initialize(SVGElementMapping.java:80)
        at org.apache.fop.fo.ElementMapping.getTable(ElementMapping.java:52)
        at
org.apache.fop.fo.ElementMappingRegistry.addElementMapping(ElementMappingRegistry.java:117)
        at
org.apache.fop.fo.ElementMappingRegistry.addElementMapping(ElementMappingRegistry.java:96)
        at
org.apache.fop.fo.ElementMappingRegistry.setupDefaultMappings(ElementMappingRegistry.java:77)
        at
org.apache.fop.fo.ElementMappingRegistry.<init>(ElementMappingRegistry.java:64)
        at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:151)
        at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:166)

thing which I can't figure out is the fact that try catch block isn't
working for some reason

I have this in code 

	try
		{
			System.out.println("<D> 2");
			this.tFactory = TransformerFactory.newInstance();
			System.out.println("<D> 3");
			this.fopFactory = FopFactory.newInstance();
			System.out.println("<D> 4");
		} catch (Exception e)
		{
			System.out.println("<D> 5");
			System.out.println("<D> exception fop "
					+ GregorianCalendar.getInstance().getTime());
			throw new ServletException();
		} catch (Error er)
		{
			System.out.println("<D> 6");
			System.out.println("<D> error fop "
					+ GregorianCalendar.getInstance().getTime());
			System.out.println("<D> " + er.getMessage());
			throw new ServletException();
		}

and in log I get 1 , 2, 3 and 4 , between 3 and 4 the error occurs ???

Does any one have any idea about what might be problem here ?

Thanks
-- 
View this message in context: http://www.nabble.com/FopFactory.newInstance%28%29-error-tp23849856p23849856.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: FopFactory.newInstance() error

Posted by Chris Bowditch <bo...@hotmail.com>.
Vladimir Dejanovic wrote:

<snip/>

> 
> the thing which I can't figure out is how it worked for several month and
> then just stopped. Also why try catch block isn't working like it should ?

Your catch block is catching Exception, but the class 
NoClassDefFoundError extends Error which extends Throwable. Exception is 
a sub class of Throwable. So change your catch block to catch Throwable 
objects to ensure you can catch errors as well as exceptions.

> 
> I will try to find this jar and add it to app. I hope that it will fix the
> problem :|
> 

Regards,

Chris



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


Re: FopFactory.newInstance() error

Posted by "Tobias Anstett [k15t.com]" <to...@k15t.com>.
Hi Vladimir,

if you haven't modified your app, maybe you or your workmates modified
the classpath - maybe adding another jar to tomcat or executed a mvn
build that updated some jars inside the app.

Cheers,
Tobias

On Wed, Jun 3, 2009 at 3:58 PM, Vladimir Dejanovic
<vl...@zemljasnova.net> wrote:
>
>
>
> Andreas Delmelle-2 wrote:
>>
>> On 03 Jun 2009, at 15:25, Vladimir Dejanovic wrote:
>>
>> Hi Vladimir
>>
>>> <snip />
>>> this part of code should catch errors
>>
>> Indeed, but the related error is already caught inside
>> SVGElementMapping.initialize().
>> The reason is obviously that we don't want FOP to crash on this, just
>> log an error message if the SVG extension could not be properly
>> initialized.
>>
>> Do you have another version of Batik in the classpath somewhere (apart
>> from the one in FOP's lib directory)? That might explain the missing
>> class definition...
>>
>>
>> HTH!
>>
>> Andreas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
>>
>
> Hi Andreas,
>
> I am using several jar-s inside my app , like poi , fop , struts, hibernate,
> .... so I can't be sure if Batik is already in some of them or not. But what
> I can't understand is the fact that everything worked just fine for several
> months and then just stopped. I haven't modified app , and my college tells
> me that he didn't modify anything either, so how it stopped working ?
>
> Thanks
> Vladimir Dejanovic
> --
> View this message in context: http://www.nabble.com/FopFactory.newInstance%28%29-error-tp23849856p23851956.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

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


Re: FopFactory.newInstance() error

Posted by Vladimir Dejanovic <vl...@zemljasnova.net>.


Andreas Delmelle-2 wrote:
> 
> On 03 Jun 2009, at 15:25, Vladimir Dejanovic wrote:
> 
> Hi Vladimir
> 
>> <snip />
>> this part of code should catch errors
> 
> Indeed, but the related error is already caught inside  
> SVGElementMapping.initialize().
> The reason is obviously that we don't want FOP to crash on this, just  
> log an error message if the SVG extension could not be properly  
> initialized.
> 
> Do you have another version of Batik in the classpath somewhere (apart  
> from the one in FOP's lib directory)? That might explain the missing  
> class definition...
> 
> 
> HTH!
> 
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

Hi Andreas,

I am using several jar-s inside my app , like poi , fop , struts, hibernate,
.... so I can't be sure if Batik is already in some of them or not. But what
I can't understand is the fact that everything worked just fine for several
months and then just stopped. I haven't modified app , and my college tells
me that he didn't modify anything either, so how it stopped working ?

Thanks
Vladimir Dejanovic
-- 
View this message in context: http://www.nabble.com/FopFactory.newInstance%28%29-error-tp23849856p23851956.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: FopFactory.newInstance() error

Posted by Andreas Delmelle <an...@telenet.be>.
On 03 Jun 2009, at 15:25, Vladimir Dejanovic wrote:

Hi Vladimir

> <snip />
> this part of code should catch errors

Indeed, but the related error is already caught inside  
SVGElementMapping.initialize().
The reason is obviously that we don't want FOP to crash on this, just  
log an error message if the SVG extension could not be properly  
initialized.

Do you have another version of Batik in the classpath somewhere (apart  
from the one in FOP's lib directory)? That might explain the missing  
class definition...


HTH!

Andreas

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


Re: FopFactory.newInstance() error

Posted by Vladimir Dejanovic <vl...@zemljasnova.net>.

>Your catch block is catching Exception, but the class 
>NoClassDefFoundError extends Error which extends Throwable. Exception is 
>a sub class of Throwable. So change your catch block to catch Throwable 
>objects to ensure you can catch errors as well as exceptions.
try
{.........
}
............
catch (Error er)
                {
                        System.out.println("<D> 6");
                        System.out.println("<D> error fop "
                                        +
GregorianCalendar.getInstance().getTime());
                        System.out.println("<D> " + er.getMessage());
                        throw new ServletException();
                }

this part of code should catch errors
-- 
View this message in context: http://www.nabble.com/FopFactory.newInstance%28%29-error-tp23849856p23851389.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: FopFactory.newInstance() error

Posted by Vladimir Dejanovic <vl...@zemljasnova.net>.


Artur Zinatullin wrote:
> 
> 
>  VD> java.lang.NoClassDefFoundError: 
> org/apache/batik/util/XMLResourceDescriptor
> Usually indicates, that You have some jars missing from Your classpath.
> In this case it might be batik-all.jar 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 
the thing which I can't figure out is how it worked for several month and
then just stopped. Also why try catch block isn't working like it should ?

I will try to find this jar and add it to app. I hope that it will fix the
problem :|

-- 
View this message in context: http://www.nabble.com/FopFactory.newInstance%28%29-error-tp23849856p23850018.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: FopFactory.newInstance() error

Posted by Artur Zinatullin <ar...@webmedia.ee>.
 VD> java.lang.NoClassDefFoundError: 
org/apache/batik/util/XMLResourceDescriptor
Usually indicates, that You have some jars missing from Your classpath.
In this case it might be batik-all.jar 


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