1
我正在嘗試將toplink的會話導出與我的生成過程(Apache Ant)集成。我已經從這裏的例子工作: http://download.oracle.com/docs/cd/E14571_01/web.1111/b32441/mw.htm由於SessionLoaderExceptions導致Ant鏈接驗證失敗
我的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>
我從螞蟻以下錯誤:
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:
當我在螞蟻中打開詳細模式時,我可以看到更多的錯誤細節:
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它看起來像我的螞蟻進程沒有找到oracle.toplink.tools.sessionconfiguration.XMLLoader類,但它是在類路徑中的toplink.jar。
任何幫助表示讚賞
我看到你要去的地方Gordon,我並不清楚爲ant提供的所有任務在做什麼,而且我得到的文檔不是很具描述性(http://download.oracle.com /docs/cd/E14571_01/web.1111/b32441/mw.htm#insertedID8)。 3個任務是validate.project,export.project和驗證會話。我認爲validate.session將採取導出的項目文件,並嘗試通過檢查數據庫和Java類來驗證它...我在這裏的方式嗎? – 2010-08-27 07:39:39
不,validate.session期望定義EclipseLink會話配置的sessions.xml文件。在會話配置中,引用了導出的項目文件。您可以使用工作臺創建新的會話配置。 我想指出Workbench是舊的本地EclipseLink配置。你有沒有理由不使用'Eclipse Dali'和JPA?- 戈登 – 2010-08-27 13:28:04