【问题标题】:OC4J Problem: global-web-application.xml Works, orion-web.xml Doesn'tOC4J 问题:global-web-application.xml 有效,orion-web.xml 无效
【发布时间】:2010-01-21 13:49:20
【问题描述】:

我最近在 OC4J 中“解决”了一个关于使用 Xerces 而不是 OC4J 的内置解析器的常见问题。通过将此行添加到 global-web-application.xml 解决了该问题:

<web-app-class-loader search-local-classes-first="true"/>

不幸的是,这种方法过于粗暴,可能会导致应用服务器出现问题,因此我尝试通过在应用的 WEB-INF 目录中创建以下 orion-web.xml 文件来解决它:

<?xml version="1.0"?>
<orion-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd">
<web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true"/>
<web-app/>
</orion-web-app>

不幸的是,事实证明使用 global-web-application.xml 有效,使用 orion-web.xml 没有

OC4J 版本为 10.1.3.5。

谁能给点建议?

【问题讨论】:

    标签: oc4j


    【解决方案1】:

    另一种方法是在部署时指定。看看:

    在部署时指定 search-local-classes-first

    以下示例说明如何使用 Application Server Control 在部署时为 Web 模块生成的 orion-web.xml 文件中设置 search-local-classes-first 属性。

    1. 选择 Applications>Deploy 以启动 Application Server Control 部署向导。
    2. 在向导的第一页中提供应用程序的路径。
    3. 在第二页中指定应用程序名称并提供任何上下文 URI 映射。
    4. 单击向导第三页中的配置类加载(部署:部署设置)。
    5. 在配置 Web 模块类加载器下,选中包含要使用的本地 JAR 文件的 Web 模块名称旁边的 Search Local Classes First 复选框。
    6. (可选)单击“保存部署计划”按钮,然后保存计划以供重复使用。

    【讨论】:

      【解决方案2】:

      我认为你可以用不同的方式解决这个问题。使用属性和删除库。

      有两个属性:

      xml.driver.property

      xml.driver.impl

      一个定义解析器接口,另一个定义实现。您可以从一种实现切换到另一种实现。

      例如我们有:

      xml.driver.property=org.xml.sax.driver

      xml.driver.impl=org.apache.xerces.parsers.SAXParser

      由于这是一个系统属性,您可以通过多种不同方式加载它。我们使用安装在所有 OC4J 实例(容器)中的特殊 servlet,该 servlet 在运行时加载其他属性。

      有点晚了,但希望能有所帮助。

      【讨论】:

        【解决方案3】:

        最后,我可以在我的 OC4J 10.13(和 10.13.50)上运行 JAXB2(由 Spring WS 2.1.4 使用)。 JAXB 需要 xalan 库。

        orion-web.xml

        <?xml version="1.0"?>
        <!DOCTYPE orion-web-app PUBLIC "-//Evermind//DTD Orion Web Application 2.3//EN"
            "http://xmlns.oracle.com/ias/dtds/orion-web.dtd">
        
        <orion-web-app
            persistence-path=""
            jsp-cache-directory="./persistence"
            jsp-cache-tlds="standard"
            simple-jsp-mapping="false"
            temporary-directory="./temp"
            servlet-webdir="/servlet/"
            >
        
            <web-app-class-loader search-local-classes-first="true"/>
        
        </orion-web-app>
        

        maven pom.xml

            <!-- JAXB implemetation by EclipseLink MOXy-->
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>eclipselink</artifactId>
                <version>2.5.1</version>
                <scope>compile</scope>
            </dependency>
        
            <!-- Specific dependencies for OC4J v1013 -->
            <dependency>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
                <version>2.7.1</version>
                <scope>runtime</scope>
                <exclusions>
                    <exclusion>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        

        【讨论】:

          猜你喜欢
          • 2010-12-10
          • 1970-01-01
          • 2010-09-24
          • 1970-01-01
          • 2012-06-15
          • 1970-01-01
          • 1970-01-01
          • 2011-02-16
          • 2014-06-17
          相关资源
          最近更新 更多