tags:

views:

24

answers:

1

Hi,

I'm trying to integrate toplink's session exports with my build process (Apache Ant). I've been working from the example here: http://download.oracle.com/docs/cd/E14571_01/web.1111/b32441/mw.htm

My Ant init target and the session validation target are shown below:

<!-- ============
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>

I get the following Errors from 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:

When I turn on verbose mode in ant I can see more details of the error:

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)

The 3 errors shown above correspond to the 3 tags at the same level in the session.xml file. I have tested this validation process with a session.xml file generated from the workbench and that failed too. Since its a NoSuchMethodException it looks like my ant process isn't finding the oracle.toplink.tools.sessionconfiguration.XMLLoader class, but that is in toplink.jar which is in the class path.

Any help appreciated

+1  A: 

Purely based on the names of your files it appears you are attempting to load a mapping metadata file (aka project.xml) as a Sessions metadata file. The XMLLoader is only used to load Session config files (aka "sessions.xml").

Gordon Yorke
I see where you are going here Gordon, I'm not really clear on what all the tasks provided for ant are doing and the documentation I've got isn't very descriptive (http://download.oracle.com/docs/cd/E14571_01/web.1111/b32441/mw.htm#insertedID8).The 3 tasks are validate.project, export.project and validate session. I assumed that validate.session would take the exported project file and try to validate it by checking it against the database and java classes... am I way off here?
Craig Warren
No, validate.session is expecting a sessions.xml file that defines an EclipseLink Session config. Within the session config a reference is made to the exported project file. You can use the workbench to create a new Sessions Config.I would like to point out that the Workbench is older native EclipseLink configuration. Is there a reason why you are not using 'Eclipse Dali' and JPA?--Gordon
Gordon Yorke