0

我最近在 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。

任何人都可以建议吗?

4

3 回答 3

2

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

在部署时指定 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. 在 Configure Web Module Class Loaders 下,选中包含要使用的本地 JAR 文件的 Web 模块名称旁边的 Search Local Classes First 复选框。
  6. (可选)单击保存部署计划按钮,并保存计划以供重复使用。
于 2010-12-22T16:22:26.070 回答
0

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

有两个属性:

xml.driver.property

xml.driver.impl

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

例如我们有:

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

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

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

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

于 2010-11-12T19:07:38.583 回答
0

最后,我可以在我的 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>
于 2013-11-26T12:48:02.540 回答