Re: runtime ExceptionInInitializerError: first steps
- Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 7:50 PM Subject: Re: runtime ExceptionInInitializerError: first steps Uncaught exception (java.lang.ExceptionInInitializerError) SVGElementMapping.setupSVG() SVGElementMapping.addToBuilder(TreeBuilder) The exception happens in some Batik related code. Do you have Batik in the classpath? YES, it is. If so, it is the version taken from the FOP distribution? SURE!! Is this the only one? yes There could be incompatibilities. of what kind? I don't understand ... the code is simple and small I thing that something is missing ... some initialization ... any idea?? thanks Massimiliano - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
Ok,thanks ... this is (now) clear!! :-) but why it does not work width the URI??? thanks Massimiliano - Original Message - From: Oleg Tkachenko To: [EMAIL PROTECTED] Sent: Friday, May 17, 2002 11:35 PM Subject: RE: runtime ExceptionInInitializerError: first steps Hello! InputSource class havethe only String constructor and that String is supposed to be system id (URI), for example, file name. See http://www.saxproject.org/apidoc/org/xml/sax/InputSource.htmlfor more info. If you want to create InputSource from serialized xml you need something like new InputSource(new StringReader(src)) ---Oleg Tkachenko,Multiconn International, Israel
Re: runtime ExceptionInInitializerError: first steps
Hello! What do you mean? Give us some more info, what doesn't work and which URI are you using. -- Oleg Tkachenko Multiconn International, Israel Massimiliano Cuccia wrote: Ok, thanks ... this is (now) clear!! :-) but why it does not work width the URI??? thanks Massimiliano - Original Message - *From:* Oleg Tkachenko mailto:[EMAIL PROTECTED] *To:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Sent:* Friday, May 17, 2002 11:35 PM *Subject:* RE: runtime ExceptionInInitializerError: first steps Hello! InputSource class have the only String constructor and that String is supposed to be system id (URI), for example, file name. See http://www.saxproject.org/apidoc/org/xml/sax/InputSource.html for more info. If you want to create InputSource from serialized xml you need something like new InputSource(new StringReader(src)) --- Oleg Tkachenko, Multiconn International, Israel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
Sorry for missing informations ... now I will try to be more unambiguous this is my Java code 1Driver driver = new Driver( new InputSource(new java.io.FileInputStream(C:\\character.fo)), new FileOutputStream(C:\\prova.pdf)); 2driver.setRenderer(Driver.RENDER_PDF); 3driver.run(); PS: character.fo is the same file of the examples in the distribution the problems comes in the first row (the call to Driver constructor) Uncaught exception is java.lang.ExceptionInInitializerError I'm using VisualAge and all the jars in the lib folder of fop were included (and no other) fop version 0.20.3 are these information enough??? I Hope!! :-) thanks Massimiliano Cuccia - Original Message - From: Oleg Tkachenko [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 12:56 PM Subject: Re: runtime ExceptionInInitializerError: first steps Hello! What do you mean? Give us some more info, what doesn't work and which URI are you using. -- Oleg Tkachenko Multiconn International, Israel Massimiliano Cuccia wrote: Ok, thanks ... this is (now) clear!! :-) but why it does not work width the URI??? thanks Massimiliano - Original Message - *From:* Oleg Tkachenko mailto:[EMAIL PROTECTED] *To:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Sent:* Friday, May 17, 2002 11:35 PM *Subject:* RE: runtime ExceptionInInitializerError: first steps Hello! InputSource class have the only String constructor and that String is supposed to be system id (URI), for example, file name. See http://www.saxproject.org/apidoc/org/xml/sax/InputSource.html for more info. If you want to create InputSource from serialized xml you need something like new InputSource(new StringReader(src)) --- Oleg Tkachenko, Multiconn International, Israel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
Massimiliano Cuccia [EMAIL PROTECTED] wrote: Uncaught exception (java.lang.ExceptionInInitializerError) SVGElementMapping.setupSVG() SVGElementMapping.addToBuilder(TreeBuilder) ... Do you have Batik in the classpath? YES, it is. If so, it is the version taken from the FOP distribution? SURE!! ... I don't understand ... the code is simple and small I thing that something is missing ... some initialization ... any idea?? Ok. From the Java doc: java.lang.ExceptionInInitializerError: Signals that an unexpected exception has occurred in a static initializer. You stacktrace indicates this happens in org.apache.fop.svg.SVGElementMapping.setupSVG() The code is (comments trimmed) private static synchronized void setupSVG() { if(foObjs == null) { XMLResourceDescriptor.setXMLParserClassName(Driver.getParserClassName()); foObjs = new HashMap(); foObjs.put(svg, SVGElement.maker()); foObjs.put(rect, SVGObj.maker(rect)); ... lots of foObjs.put ... } } It uses the class org.apache.batik.util.XMLResourceDescriptor, which happens to have a static initializer: static { bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault()); } This could cause the above mentioned exception, the other stuff doesn't seem to do this. Ergo: something went wrong during loading of the ressource. What's going wrong is hard to guess. Usually, it's a deployment problem. However, you seem to run an unusual JVM. Locale.getDefault() could return an unusual value, perhaps null. If this is the case, you're hosed, complain to the vendor of your JVM. I'm not familiar enough with the failure modes of RessourceBundle.getBundle() to hazard a guess what else could have happened. If you can run the stuff in a debugger, you might be able to deduce it yourself. Otherwise, I'd recommend downloading the source for Batik 1.1 (actually which *is* the version of Batik shipped with 0.20.3?) insert some printlns for debugging in the code and see what happens. Batik seems to be somewhat overzealous in early loading all kinds of stuff all over the place. Someone out there with enough positive standing with the Batik people to tell them to do something about this? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
Massimiliano Cuccia wrote: Sorry for missing informations ... now I will try to be more unambiguous this is my Java code 1Driver driver = new Driver( new InputSource(new java.io.FileInputStream(C:\\character.fo)), new FileOutputStream(C:\\prova.pdf)); 2driver.setRenderer(Driver.RENDER_PDF); 3driver.run(); PS: character.fo is the same file of the examples in the distribution the problems comes in the first row (the call to Driver constructor) Uncaught exception is java.lang.ExceptionInInitializerError I'm using VisualAge and all the jars in the lib folder of fop were included (and no other) H, that works like a charm for me in WebSphere App Developer 4. As Joerg poined out that is a problem with resource loading. Did you import resources from batik.jar along with classes ? -- Oleg Tkachenko Multiconn International, Israel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
GREAT!!! Did you import resources from batik.jar along with classes ? ... very very well!! :-) I had not checked the item in import phase!! sorry ... Now there is another problem import of Xerces 1.2.3 is impossible ... VisualAge starts the import than close the window without any message and the import isn't completed ... I will try something!!! thanks very very much Mr. Oleg Massimiliano Cuccia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: runtime ExceptionInInitializerError: first steps
Hello! InputSource class havethe only String constructor and that String is supposed to be system id (URI), for example, file name. See http://www.saxproject.org/apidoc/org/xml/sax/InputSource.htmlfor more info. If you want to create InputSource from serialized xml you need something like new InputSource(new StringReader(src)) ---Oleg Tkachenko,Multiconn International, Israel -Original Message-From: Massimiliano Cuccia [mailto:[EMAIL PROTECTED]]Sent: Friday, May 17, 2002 4:05 PMTo: [EMAIL PROTECTED]Subject: runtime ExceptionInInitializerError: first steps I have a problem in running this code ... I hadjustcutpaste from documentation can anyone help me??? I don't know where to start ... public void test1(String src, String dst) { try { Driver driver = new Driver(new InputSource(src), new FileOutputStream(dst)); driver.setRenderer(Driver.RENDER_PDF); driver.run(); } catch (Exception ex) { ex.printStackTrace(); } } I'm calling test1 by this way test1("c:\\prova.fo", "c:\\prova.pdf"); I tryed passing a fo string for src parameter too something like this String src =" "?xml" version="1.0" encoding=\"ISO-8859-1\"?"+ "fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\""+ ... ... ... "/fo:root"; test1(src, "c:\\prova.pdf"); every call generate an exception:java.lang.ExceptionInInitializerError this is the Debugger Stack Trace Report: Thread[main,5,main] (Alive)Uncaught exception (java.lang.ExceptionInInitializerError) SVGElementMapping.setupSVG()SVGElementMapping.addToBuilder(TreeBuilder)this=(org.apache.fop.svg.SVGElementMapping) org.apache.fop.svg.SVGElementMapping@6266arg_1=(org.apache.fop.fo.TreeBuilder) org.apache.fop.fo.FOTreeBuilder@6cd4Driver.addElementMapping(ElementMapping)this=(org.apache.fop.apps.Driver) org.apache.fop.apps.Driver@1936arg_1=(org.apache.fop.fo.ElementMapping) org.apache.fop.svg.SVGElementMapping@6266Driver.addElementMapping(String)this=(org.apache.fop.apps.Driver) org.apache.fop.apps.Driver@1936arg_1=(java.lang.String) org.apache.fop.svg.SVGElementMappingDriver.setupDefaultMappings()this=(org.apache.fop.apps.Driver) org.apache.fop.apps.Driver@1936Driver()this=(org.apache.fop.apps.Driver) org.apache.fop.apps.Driver@1936Driver(InputSource, OutputStream)this=(org.apache.fop.apps.Driver) org.apache.fop.apps.Driver@1936arg_1=(org.xml.sax.InputSource) org.xml.sax.InputSource@4478arg_2=(java.io.OutputStream) java.io.FileOutputStream@4481ProvaFOP.test1(String, String)this=(xxx.prova.ProvaFOP) xxx.prova.ProvaFOP@261asrc="(java.lang.String)" c:\prova.fodst=(java.lang.String) c:\prova.pdfProvaFOP.main(String [])args=([Ljava.lang.String;) [Ljava.lang.String;@1546pFOP=(xxx.prova.ProvaFOP) xxx.prova.ProvaFOP@261afo=(java.lang.String) c:\prova.fo thanks!! byeMassimiliano Cuccia