【问题标题】:OC4J 10.1.3.5 / Spring3 IssueOC4J 10.1.3.5 / Spring3 问题
【发布时间】:2011-02-24 15:50:41
【问题描述】:

我使用的是 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>

有人有什么想法吗?

[编辑] sn-p:

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

当然应该阅读:

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

对不起!

【问题讨论】:

  • 项目的classpath中添加了spring-webflow jar吗?
  • 是的。在这个阶段,我在 WAR 的类路径中拥有大部分 Spring JAR 文件。因此,JAR 嵌入到 WAR 中,而 WAR 本身也嵌入到 EAR 中。 (抱歉回复晚了,我身体不好)。

标签: spring spring-mvc oc4j


【解决方案1】:

我找到了答案。原来这是因为我在 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 库,但不要导入任何其他库!

【讨论】:

    猜你喜欢
    • 2010-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-21
    • 2011-10-07
    相关资源
    最近更新 更多