1

我正在尝试将 toplink 的会话导出与我的构建过程(Apache Ant)集成。我一直在这里的例子工作:http: //download.oracle.com/docs/cd/E14571_01/web.1111/b32441/mw.htm

我的 Ant 初始化目标和会话验证目标如下所示:

<!-- ============
init Target
============== -->
<target name="init">

<property name = "toplink.home" value = "C:/APPS/OC4J/toplink"/>
<property name = "oracle.home" value = "C:/APPS/OC4J"/>
<property name = "toplink.log.dir" value = "${basedir}/../toplinklogs"/>

<property name = "toplink.mwp.dir" value = "${basedir}/../java/mwb"/>
<property name = "toplink.sessions.dir" value = "${basedir}/config"/>
<property name = " myProject.classes" value = "${basedir}/../java/classes "/>

<path id = "database.classpath">
<pathelement path = "${oracle.home}/lib/dms.jar"/>
</path>

<path id = "toplink.classpath">
<pathelement path = "${toplink.home}/jlib/toplink.jar"/>
<pathelement path = "${oracle.home}/j2ee/home/lib/ejb.jar"/>
<pathelement path = "${oracle.home}/lib/xmlparserv2.jar"/>
<pathelement path = "${toplink.home}/jlib/antlr.jar"/>
</path>
<path id = "mw.classpath">
<pathelement path = "${toplink.home}/jlib/tlmwcore.jar"/>
<pathelement path = "${toplink.home}/jlib/toplinkmw.jar"/>
</path>
<path id = "mwplatforms.classpath">
<pathelement path = "${toplink.home}/config"/>
</path>

<typedef file = "${basedir}/toplink-ant-lib.xml" classpathref = "mw.classpath" uri = "toplinklib" />
</target>

<!-- ======================
validate session Target
======================= -->
<target name="validate.session" depends="export.project" if="export-completed">
<toplink:session.validate
sessionsfile = "${basedir}/../java/src/aquila/administrator/accounting/config/toplink/AccountingMapping.xml"
sessionname = "AccountingMapping"
property = "session-valid"
classpathref = "toplink.classpath"
classpath = "${myProject.classes}" >

<toplink:classpath refid = "mw.classpath" />
<toplink:classpath refid = "database.classpath" />

<toplink:loginspec refid = "loginSpec" />
</toplink:session.validate>
</target>

我从 ant 收到以下错误:

validate.session:
[toplink:session.validate] An error occured while validating project:
[toplink:session.validate] Exception Description: Several [3] SessionLoaderExceptions were thrown:

BUILD FAILED
C:\Eclipse\Administrator\ant\example.xml:105: An error occured while validating project:
Exception Description: Several [3] SessionLoaderExceptions were thrown:

当我在 ant 中打开详细模式时,我可以看到错误的更多详细信息:

Local Exception Stack:
Exception [TOPLINK-9001] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.SessionLoaderException
Exception Description: Unknown tag name: [toplink:login] in XML node: [toplink:object-persistence].
Internal Exception: java.lang.NoSuchMethodException: oracle.toplink.tools.sessionconfiguration.XMLLoader.process_toplink:login_Tag(org.w3c.dom.Node, oracle.toplink.tools.sessionconfiguration.XMLLoader$ObjectHolder)

Local Exception Stack:
Exception [TOPLINK-9001] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.SessionLoaderException
Exception Description: Unknown tag name: [opm:class-mapping-descriptors] in XML node: [toplink:object-persistence].
Internal Exception: java.lang.NoSuchMethodException: oracle.toplink.tools.sessionconfiguration.XMLLoader.process_opm:class_mapping_descriptors_Tag(org.w3c.dom.Node, oracle.toplink.tools.sessionconfiguration.XMLLoader$ObjectHolder)

Local Exception Stack:
Exception [TOPLINK-9001] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.SessionLoaderException
Exception Description: Unknown tag name: [opm:name] in XML node: [toplink:object-persistence].
Internal Exception: java.lang.NoSuchMethodException: oracle.toplink.tools.sessionconfiguration.XMLLoader.process_opm:name_Tag(org.w3c.dom.Node, oracle.toplink.tools.sessionconfiguration.XMLLoader$ObjectHolder)

上面显示的 3 个错误对应 session.xml 文件中同一级别的 3 个标签。我已经使用从工作台生成的 session.xml 文件测试了这个验证过程,但也失败了。由于它是 NoSuchMethodException ,因此我的 ant 进程似乎没有找到 oracle.toplink.tools.sessionconfiguration.XMLLoader 类,但它位于类路径中的 toplink.jar 中。

任何帮助表示赞赏

4

1 回答 1

1

纯粹基于文件的名称,您似乎正在尝试将映射元数据文件(又名 project.xml)加载为 Sessions 元数据文件。XMLLoader 仅用于加载会话配置文件(又名“sessions.xml”)。

于 2010-08-26T13:52:39.620 回答