由于SessionLoaderExceptions,Ant的Toplink验证失败

时间:2010-08-18 14:55:12

标签: ant toplink

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

我的Ant init目标和会话验证目标如下所示:

<!-- ============
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中,它位于类路径中。

任何帮助表示赞赏

1 个答案:

答案 0 :(得分:1)

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