Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » SAX2 driver class org.apache.xerces.parsers.SAXParser not found
SAX2 driver class org.apache.xerces.parsers.SAXParser not found [message #162759] Thu, 27 November 2003 05:46 Go to next message
Eclipse UserFriend
Originally posted by: johannes.neuber.gmx.de

Hello everybody,

once again I've a question about referencing specific libraries, which
are requiered for running my plugin. This plugin contains an Image Viewer
for displaying SVG Graphics. Therefor several external "Batik" libraries
(jar's) are requiered. I've created a "Batik Eclipse plugin" which simly
wraps the 20 Batik jar's. So I'm able to import the required "Batik
Plugin" in the plugin.xml of my Image Viewer, instead of referencing all
jar-libraries manually.

Running the Plugin within a Run-time Workbech works fine until the
following code inside my SVGLoader class is reached:

//...
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
svgDocument = f.createSVGDocument(svgURL.toString());
//...

At this point the following java.io.IOException is thrown:
SAX2 driver class org.apache.xerces.parsers.SAXParser not found
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument( Unknown
Source)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocumen t(Unknown
Source)
at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocu ment(Unknown
Source)
...

I don't understand this exception because the requiered SAXParser class
exists within the "xerces_2_3_0.jar" of my "Batik-Plugin" ... !
All other classes and libraries of this plugin are imported correctly
to the Image Viewer plugin - only the SAXParser makes problems! Why ?
May it be possible that there are any conflicts with the Eclipse's
Xerces Plugin ?


Here's a short excerpt of my Image Viewer's plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<plugin
id="java.xyz.editor"
class="xyzEditorClass">
<runtime>
<library name="runtime/"><export name="*"/></library>
</runtime>
<requires>
<!-- ... -->
<import plugin="org.apache.batik" export="true"/>
<!-- ... -->
</requires>
<!-- ... -->
<extension point="org.eclipse.ui.views">
<view name="Image View"
<!-- ... -->
</view>
</extension>
</plugin>


... and the "Batik-Plugin's" *.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<plugin
id="org.apache.batik"
name="%pluginName"
version="1.5"
provider-name="%providerName">
<runtime>
<!-- ... here all batik jar's are listed ... -->
<library name="lib/xerces_2_3_0.jar">
<export name="*"/>
</library>
<!-- ... -->
</runtime>
</plugin>



Thanks in advance ...

Johannes
Re: SAX2 driver class org.apache.xerces.parsers.SAXParser not found [message #162823 is a reply to message #162759] Thu, 27 November 2003 07:45 Go to previous message
Eclipse UserFriend
Originally posted by: johannes.neuber.gmx.de

The problem is solved ...! If I insert the following line of code:

Thread.currentThread().setContextClassLoader(getClass().getC lassLoader());

before i call "svgDocument = f.createSVGDocument(svgURL.toString());"
all works fine and the SVGDocument is parsed correctly! This seems to
be an old and well known Eclipse problem. A short description can be
found here: http://eclipsewiki.swiki.net/114#context

Although I don't really understand the problem, it works now ! Would
somebody like to explain ?

"the very confused" Johannes *g



Johannes wrote:

> Hello everybody,

> once again I've a question about referencing specific libraries, which
> are requiered for running my plugin. This plugin contains an Image Viewer
> for displaying SVG Graphics. Therefor several external "Batik" libraries
> (jar's) are requiered. I've created a "Batik Eclipse plugin" which simly
> wraps the 20 Batik jar's. So I'm able to import the required "Batik
> Plugin" in the plugin.xml of my Image Viewer, instead of referencing all
> jar-libraries manually.

> Running the Plugin within a Run-time Workbech works fine until the
> following code inside my SVGLoader class is reached:

> //...
> String parser = XMLResourceDescriptor.getXMLParserClassName();
> SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
> svgDocument = f.createSVGDocument(svgURL.toString());
> //...

> At this point the following java.io.IOException is thrown:
> SAX2 driver class org.apache.xerces.parsers.SAXParser not found
> at org.apache.batik.dom.util.SAXDocumentFactory.createDocument( Unknown
> Source)
> at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocumen t(Unknown
> Source)
> at
> org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocu ment(Unknown
> Source)
> ...

> I don't understand this exception because the requiered SAXParser class
> exists within the "xerces_2_3_0.jar" of my "Batik-Plugin" ... !
> All other classes and libraries of this plugin are imported correctly
> to the Image Viewer plugin - only the SAXParser makes problems! Why ?
> May it be possible that there are any conflicts with the Eclipse's
> Xerces Plugin ?


> Here's a short excerpt of my Image Viewer's plugin.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <plugin
> id="java.xyz.editor"
> class="xyzEditorClass">
> <runtime>
> <library name="runtime/"><export name="*"/></library>
> </runtime>
> <requires>
> <!-- ... -->
> <import plugin="org.apache.batik" export="true"/>
> <!-- ... -->
> </requires>
> <!-- ... -->
> <extension point="org.eclipse.ui.views">
> <view name="Image View"
> <!-- ... -->
> </view>
> </extension>
> </plugin>


> ... and the "Batik-Plugin's" *.xml file looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <plugin
> id="org.apache.batik"
> name="%pluginName"
> version="1.5"
> provider-name="%providerName">
> <runtime>
> <!-- ... here all batik jar's are listed ... -->
> <library name="lib/xerces_2_3_0.jar">
> <export name="*"/>
> </library>
> <!-- ... -->
> </runtime>
> </plugin>



> Thanks in advance ...

> Johannes
Previous Topic:Howto Assert/Ensure that the platform is initialized
Next Topic:How to contribute classes to another plugin
Goto Forum:
  


Current Time: Mon Jul 14 14:14:25 EDT 2025

Powered by FUDForum. Page generated in 0.13045 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top