0

我正在使用 OC4J 10.1.3.5.0,并且在 WAR/EAR 中提供的 Spring XML 文件中的 XML 命名空间存在问题。

根据 Oracle 文档,在 OC4J 中解析 Spring 3 XSD 文件时存在一个已知问题,因为它嵌入了 Oracle XMLParserV2 jar 并将其用于所有 XML 解析(显然 Spring 3 中使用的一些 XSD 技巧存在问题)。

我遵循了 Oracle 解决方法,在 OC4J 实例上定义了我自己的 XML 解析器共享库,并且(在 orion-application.xml 中)定义了要使用的共享库。我使用 xercesImpl (v 2.9.1)、xml-apis (v 1.3.04) 和 xml-resolver (v 1.2) 创建了一个共享库“apache.xml”。我尝试定义 EAR 以使用新库

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

我收到以下错误

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'.

webflow-config.xml 文件被定义为正常:

<?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>

有没有人有任何想法?

[编辑]片段:

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

当然应该阅读:

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

对不起!

4

1 回答 1

0

我找到了答案。原来这是因为我在 Java 6 JVM 上运行 OC4J。如果其他人遇到此问题,这是我们为解决而采取的措施:

Oracle XML 解析器不能很好地处理 Spring 3 XSD 文件,这是一个已知问题。您需要为您的应用程序删除 Oracle XSD 库。在您的orion-application.xml文件中,您需要

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

然后,Oracle 文档会告诉您导入一个的共享库。但是,如果您在 Java 6 JVM(我们就是这样!)上运行 OC4J,则不能这样做。貌似现在Java 6核心有一个XML解析器,导入Xerces库会和这些类冲突,导致奇怪的错误。

无论如何,在 Java 6 上,删除 Oracle 库,但不要导入任何其他库!

于 2011-03-23T08:49:02.113 回答