OC4J 10.1.3.5 / Spring3 Issue

2.1k views Asked by At

I'm using OC4J 10.1.3.5.0, and have an issue with the XML namespaces in the Spring XML files supplied in the WAR/EAR.

According to the Oracle documentation, there is a known issue in parsing the Spring 3 XSD files within OC4J, as this embeds the Oracle XMLParserV2 jar and uses this for all XML parsing (which has issues with some XSD tricks used in Spring 3 apparently).

I've folowed the Oracle work-around, defining my own XML parser shared libraries on the OC4J instance, and (in the orion-application.xml), defining the shared library to use. I created a shared library,'apache.xml', with xercesImpl (v 2.9.1), xml-apis (v 1.3.04), and xml-resolver (v 1.2). I tried defining the EAR to use the new library

<imported-shared-libraries>
    <imported-shared-library name="apache.xml"/>
</imported-shared-libraries>

I receive the following error

14:50:31 ERROR (UserId:) [DispatcherServlet] Context initialization failed 
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
        Line 10 in XML document from ServletContext resource [/WEB-INF/spring/webflow-config.xml] is invalid;
    nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: 
    The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-executor'.

The webflow-config.xml file is defined as normal:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:webflow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
               http://www.springframework.org/schema/beans 
               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/webflow-config 
               http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">

    <!-- Executes web flows -->
    <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry" />

    <!-- Rest of the file ... -->

</beans>

Does anyone have any ideas?

[Edit] The snippet:

<imported-shared-libraries>
    <imported-shared-library name="apache.xml"/>
</imported-shared-libraries>

should, of course read:

<imported-shared-libraries>
    <import-shared-library name="apache.xml"/>
</imported-shared-libraries>

Sorry!

1

There are 1 answers

0
GKelly On BEST ANSWER

I found the answer to this. Turns out this was specifically because I was running OC4J on a Java 6 JVM. If anyone else gets this problem, here's what we did to resolve:

The Oracle XML parser does not handle the Spring 3 XSD files well, this is a know issue. You need to remove the Oracle XSD libraries for your application. In your orion-application.xml file, you need

<imported-shared-libraries>
    <remove-inherited name="oracle.xml"/>
</imported-shared-libraries>

The Oracle documentation then tells you to import a new shared library. However, if you're running OC4J on a Java 6 JVM (which we are!), you can't do this. It looks like there is an XML parser in the Java 6 core now, and importing Xerces libraries will conflict with these classes, causing weird errors.

Anyway, on Java 6, remove the Oracle libraries, but don't import any other ones!