cancel
Showing results for 
Search instead for 
Did you mean: 

Strange problem with jars in Java Mapping

Former Member
0 Kudos

Hi All,

I'm trying to implement a Java Mapping that uses Xerces. I'm using xercesImpl.jar.

I put the xercesImpl.jar file in the folder containing the .class file (the Java Mapping program), and zipped the folder.I imported the zip file as an archive and used it in the Interface Mapping.

My code uses the org.apache.xerces.parsers.<b>SAXParser</b> class.

However, while trying to execute the Interface Mapping, it gives error: <b>Unable to find resource:'org/apache/xerces/parsers/SAXParser.class'</b>.

The same method works when I'm using xerces.jar and using classes javax.xml.parsers.<b>DocumentBuilder</b> and

javax.xml.parsers.DocumentBuilderFactory.

I can't figure out what the problem is.

Any ideas?

Regards,

Puloma.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

The use of external parser libs may cause problems, when they include classes which are part of the library sapxmltoolkit.jar

The classes:

javax.xml.parsers.DocumentBuilder and

javax.xml.parsers.DocumentBuilderFactory

are part of sapmxltoolkit.jar, so these lib will provide the code instead of the xerxes.jar.

I recommend using the SAX parser of the sapxmltoolkit.jar instead of xerxes, that will avoid this problem.

Regards

Stefan

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Rahul,

Try by creating a package of structure org.apache.xerces.parsers.SAXParser and place your java also, export as a jar file in NWDS, and import the same in your IR and test.

Hope this helps,

regards,

satish

Former Member
0 Kudos

Hi All,

I tried all the methods suggested. Mow my problem is that I get the following error, when I try to instantiate the SAXParser class:

Unable to find resource:

<b>META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration</b>

The XMLParserConfiguration class is actually in org.apache.xerces.xni.parser. Why does XI try to find it in the wrong sub-directory?

My code works just fine on standalone.

Regards,

Rahul.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Rahul,

Instead of bundling the xercesImpl.jar along with your actual Java mapping Jar, just import the xercesImpl.jar under the imported archives separately and test your scenario,.

Think it should work.

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

I tried what you suggested, but it is not working. It is still not able to find certain classes.

I should mention that I tried using both using a zi and a jar file.Also, I am able to work with xerces.jar, not with xercesImpl.jar.

Why is that? Any more ideas?

Regards,

Rahul.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Rahul,

Instead of bundling the xercesImpl.jar along with your actual Java mapping Jar, just import the xercesImpl.jar under the imported archives separately and test your scenario,.

Think it should work.

Regards,

Bhavesh