cancel
Showing results for 
Search instead for 
Did you mean: 

Using DOM in XSLT java extension throws exception

Former Member
0 Kudos

Hi,

I try to use DOM within a java extension called by an XSLT mapping in PI 7.11. I use the following code:

InputStream inputStream;

[...]

javax.xml.parsers.DocumentBuilder docBuilder = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();

org.w3c.dom.DocumentDocument document = docBuilder.parse(inputStream);

But during the mapping I get the following exception:

Error occured in bean SMPP_CALL_JAVA_RUNTIME3.
Thrown:
javax.xml.parsers.FactoryConfigurationError: Provider com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingDocumentBuilderFactory not found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:114)

Can anybody help with this issue?

Thanks in advance!

Hans

Accepted Solutions (0)

Answers (2)

Answers (2)

christoph_ostrop
Active Contributor
0 Kudos

hi, Hans,

did you get a solution to your request ?

a colleague of mine (PI developer) has the same difficulties in testing 

(when make first steps on our new PI-sandbox NW-PI-7.31 SPS05)

and how to find out, in which package this class is located

the class is missing in the classpath - how to setup in the normal runtime-environment (outside of the testtool)

javax.xml.parsers.FactoryConfigurationError: Provider com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingDocumentBuilderFactory not found at javax.xml.parsers.DocumentBuilderFactory.newInstance

regards

Chris

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

but this is a PI related error : com.sap.aii.ib.server.... and not XSLT/DOM

so maybe you reference PI classes somehow instead of DOM's ?

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michal,

thank you for your hint!

I try to create a new DocumentBuilderFactory instance and it seems that the default implementation is the com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingDocumentBuilderFactory.

The Java API Reference states:

Obtain a new instance of a DocumentBuilderFactory. This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the DocumentBuilderFactory implementation class to load:

  • Use the javax.xml.parsers.DocumentBuilderFactory system property.
  • Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.  The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use.  If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence.  It is not possible to change the value of any property in jaxp.properties after it has been read for the first time.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.parsers.DocumentBuilderFactory in jars available to the runtime.
  • Platform default DocumentBuilderFactory instance.

  Once an application has obtained a reference to a DocumentBuilderFactory it can use the factory to configure and obtain parser instances.

I don't want to mess with System Properties wihtin my mapping (I don't know what effect this would have on other parallel processes)...

Perhaps I have to add another Imported Archive where the MappingDocumentBuilderFactory is located in, but I don't know how to find the correct .jar...

Regards,

Hans

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Your PI version is 7.11. So you must be running Java 6.0 or above.  JDK 1.6 supports XML parsers by itself. You don't really need to go for external jars like jaxp-api or xerces or so.   This is my few cents.

You can see this class javax.xml.parsers.DocumentBuilderFactory  in the following api jars

xerces-1.4.4.jar

jaxp-api-1.4.jar

Please refer this link for using jdk and notusing any jars. This is the way SAP recommends for the future mapping usage.

http://docs.oracle.com/javase/6/docs/technotes/guides/xml/jaxp/index.html

Hope this helps.

Former Member
0 Kudos

Hi Baskar,

thank you for your opinion!

I know JAXP implementations exist on the Java server. The problem is, that the default implementation used in the XSLT mapping context is the com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingDocumentBuilderFactory which seems not available in the current classpath.

By the way, PI 7.11 is running with JDK 1.5.

Regards,

Hans