Hi,
the program works perfectly for transforming my java classes into XML
files when not using the mapping file. Therefore I think I have to
change the accessor methods in those classes involved in the 1:N
relation and the type of those fields in the mapping file, am I right?
Thanks in advance.
2008/2/20, Werner Guttmann <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
Okay, can you try things on the XML side without using a mapping file,
just for the sake of completeness ?
Werner
Stromblad wrote:
> Hi Werner,
>
> No, I am not upgrading from 0.6, I am using version 0.92.
>
> I am using a mapping file because I use Castor both for
transforming xml
> documents to Java objects and persisting those objects (after some
> manipulation). At the beginning I had only a .xsd schema, from
which I
> generated those classes that I try to persist via JDO later.
>
> That field of type Vector in the class and its accessor methods have
> been created by Castor code gen. , and it is supposed to have been
> working in the past...
>
>
> 2008/2/19, Werner Guttmann <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>:
>
> Hold on, are you saying that you are trying to upgrade from
0.6 to a
> more recent release ? In that case, you might be facing
(regression)
> problems, indeed.
>
> Let me ask you a few questions:
>
> a) why use a mapping file at all, when the Java classes have been
> generated using Castor's code generator ?
> b) Having a member variable of type List and trying to access
it as an
> array ... well, is odd to me.
>
> Can you break things down to a really simple test case that
does *not*
> reference multiple Java classes with tons of properties.
>
> But let's first see what your answers are ..
>
> Regards
> Werner
>
>
> Stromblad wrote:
> >
> > Thank you for answering, Werner.
> >
> > The strange fact for me is that this mapping file worked
before
> as it is
> > now...
> >
> > That relation field is defined as follows in the class:
> >
> > private java.util.Vector relationList;
> >
> > and its set/get methods are:
> >
> > public void addRelation(Lom_Relation vRelation)
> > throws java.lang.IndexOutOfBoundsException
> > {
> > relationList.addElement(vRelation);
> > } //-- void addRelation(Lom_Relation)
> >
> > public void addRelation(int index, Lom_Relation vRelation)
> > throws java.lang.IndexOutOfBoundsException
> > {
> > relationList.insertElementAt(vRelation, index);
> > } //-- void addRelation(int, Lom_Relation)
> >
> > public Lom_Relation getRelation(int index)
> > throws java.lang.IndexOutOfBoundsException
> > {
> > //-- check bounds for index
> > if ((index < 0) || (index > relationList.size())) {
> > throw new
IndexOutOfBoundsException("getRelation: Index
> > value '"+index+"' not in range [0.."+relationList.size()+
"]");
> > }
> >
> > return (Lom_Relation) relationList.elementAt(index);
> > } //-- Lom_Relation getRelation(int)
> >
> > public Lom_Relation[] getRelation()
> > {
> > int size = relationList.size();
> > Lom_Relation[] mArray = new Lom_Relation[size];
> > for (int index = 0; index < size; index++) {
> > mArray[index] = (Lom_Relation)
> relationList.elementAt(index);
> > }
> > return mArray;
> > }
> >
> > these were generated with Castor's code generator long ago (v
> 0.96)...
> >
> >
> > 2008/2/19, Stromblad <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>
> > <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>>>:
>
> >
> > First of all, thanks for answering.
> >
> > That package called "classes" is located in my
classpath already.
> >
> > 2008/2/18, Ralf Joachim <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>
> > <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>>>:
>
> >
> > Hi,
> >
> > as you highlighted there is a mapping that refers
to a class
> > 'classes.Lom_Relation' which could not be found. This
> field mapping
> > causes castor to search for a class and a class
mapping for
> > 'classes.Lom_Relation'. It seams castor is not able to
> find the
> > class.
> >
> > Do you have such a class in your classpath or may the
> class be
> > located
> > in a different package?
> >
> > Regards
> > Ralf
> >
> >
> > Stromblad schrieb:
> > > Hi,
> > >
> > > Thanks for answering. Actually that field you
mention is
> > involved in a
> > > 1:N relation, as follows:
> > >
> > > <class name="classes.Lom" identity="identity"
> > key-generator="IDENTITY">
> > > <map-to xml="lom" table="LOM"/>
> > > <field name="identity" type="integer"
> get-method="getId"
> > > set-method="setId">
> > > <sql name="LOMID"/>
> > >
> > > </field>
> > > <field name="general"
type="classes.Lom_General"
> > > get-method="getGeneral" set-method="setGeneral">
> > > <sql name="genID"/>
> > > <bind-xml name="general"/>
> > > </field>
> > > <field name="lifecycle"
> type="classes.Lom_Lifecycle"
> > > get-method="getLifecycle"
set-method="setLifecycle">
> > > <sql name="lifecycleID"/>
> > > <bind-xml name="lifecycle"/>
> > > </field>
> > > <field name="metametadata"
> type="classes.Lom_Metametadata"
> > > get-method="getMetametadata"
set-method="setMetametadata">
> > > <sql name="metametadataID"/>
> > > <bind-xml name="metametadata"/>
> > > </field>
> > > <field name="technical"
> type="classes.Lom_Technical"
> > > get-method="getTechnical"
set-method="setTechnical">
> > > <sql name="technicalID"/>
> > > <bind-xml name="technical"/>
> > > </field>
> > > <field name="educational"
> type="classes.Lom_Educational"
> > > get-method="getEducational"
set-method="setEducational">
> > > <sql name="educationalID"/>
> > > <bind-xml name="educational"/>
> > > </field>
> > > <field name="rights"
type="classes.Lom_Rights"
> > > get-method="getRights" set-method="setRights">
> > > <sql name="rightsID"/>
> > > <bind-xml name="rights"/>
> > > </field>
> > > <field name="relationList"
> type="classes.Lom_Relation"
> > > collection="array" get-method="getRelation"
> > set-method="setRelation">
> > > <sql many-key="LOMID"/>
> > > <bind-xml name="relation"/>
> > > </field>
> > > <field name="annotationList"
> type="classes.Lom_Annotation"
> > > collection="array" get-method="getAnnotation"
> > set-method="setAnnotation">
> > > <sql many-key="LOMID"/>
> > > <bind-xml name="annotation"/>
> > > </field>
> > > <field name="classificationList"
> > > type="classes.Lom_Classification"
collection="array"
> > > get-method="getClassification"
> set-method="setClassification">
> > > <sql many-key="LOMID"/>
> > > <bind-xml name="classification"/>
> > > </field>
> > > <field name="fileURL"
type="java.lang.String"
> > > get-method="getFileURL" set-method="setFileURL">
> > > <sql name="fileURL"/>
> > > </field>
> > > </class>
> > >
> > > Where could the problem be?
> > > Thanks in advance
> > >
> > > 2008/2/14, Werner Guttmann
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> > <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>>
> > > <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> > <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>>>>:
> > >
> > > Hi,
> > >
> > > it looks like the problem is NOT with the class
> mapping,
> > but a field
> > > mapping that actually is typed against this
class.
> Is there
> > such a field
> > > mapping ?
> > >
> > > Werner
> > >
> > > Stromblad wrote:
> > > > Hello,
> > > >
> > > > when a piece of code written by me (a web
service
> > actually) tries to
> > > > load the configuration and mapping file for my
> > application I get
> > > this error:
> > > >
> > > >
org.exolab.castor.mapping.MappingException: Could not
> > find the class
> > > > [Lclasses.Lom_Relation;
> > > > at
> > > >
> >
>
org.exolab.castor.persist.FieldMolder.<init>(FieldMolder.java:551)
> > > > at
> > > >
> >
>
org.exolab.castor.persist.ClassMolder.<init>(ClassMolder.java:384)
> > > > at
> > > >
> > >
> >
>
org.exolab.castor.persist.ClassMolderHelper.resolve(ClassMolderHelper.java:58)
> > > > at
> > >
> >
> org.exolab.castor.persist.LockEngine.<init>(LockEngine.java:177)
> > > > at
> > > >
> > >
> >
>
org.exolab.castor.persist.PersistenceEngineFactory.createEngine(PersistenceEngineFactory.java:77)
> > > > at
> > > >
> > >
> >
>
org.castor.jdo.engine.AbstractConnectionFactory.initializeEngine(AbstractConnectionFactory.java:207)
> > > > at
> > > >
> > >
> >
>
org.castor.jdo.engine.AbstractConnectionFactory.initialize(AbstractConnectionFactory.java:151)
> > > > at
> > > >
> > >
> >
>
org.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:177)
> > > > at
> > > >
> > >
> >
>
org.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:136)
> > > > at
> > > >
> > >
> >
>
org.exolab.castor.jdo.JDOManager.loadConfiguration(JDOManager.java:317)
> > > > at
> > > >
> > >
> >
>
org.exolab.castor.jdo.JDOManager.loadConfiguration(JDOManager.java:350)
> > > > at db.lomDB.connect(lomDB.java:48)
> > > > at
> lom.deleteFromDB.delete(deleteFromDB.java:20)
> > > > at
> > > >
> > >
> >
>
lomService_pkg.LomServiceSoapBindingImpl.borrar(LomServiceSoapBindingImpl.java:216)
> > > > at
> > > >
> > >
> >
>
lomService_pkg.LomServiceSoapBindingSkeleton.borrar(LomServiceSoapBindingSkeleton.java:124)
> > > > at
> >
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > at
> > > >
> > >
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > > at
> > > >
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > > at
> java.lang.reflect.Method.invoke(Method.java:597)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> > > > at
> > >
> org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> > > > at
> >
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> > > > at
> > > >
> >
>
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
> > > > at
> > >
> org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> > > > at
> > >
> javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> > > > at
> > > >
> > >
> >
>
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> > > > at
> > >
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> > > > at
> > > >
> > >
> >
>
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> > > > at
> > > >
> > >
> >
>
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> > > > at
> > > >
> > >
> >
>
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> > > > at
> > > >
> > >
> >
>
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> > > > at
> > > >
> > >
> >
>
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> > > > at
java.lang.Thread.run(Thread.java:619)
> > > >
> > > > In the mapping file that class
> classes.Lom_Relation is
> > correctly
> > > defined:
> > > >
> > > > <class name="classes.Lom_Relation"
> identity="identity"
> > > > key-generator="IDENTITY" >
> > > > <map-to xml="relation"
> table="LOM_RELATION" />
> > > > (...)
> > > > </class>
> > > >
> > > > I have that package called classes in my
> classpath...so i
> > can't figure
> > > > out where the mistake is.
> > > > Any help would be much appreciated.
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe from this list, please visit:
> > >
> > > http://xircles.codehaus.org/manage_email
> > >
> > >
> > >
> >
> > --
> >
> > Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
> > Ralf Joachim
> > Raiffeisenstraße 11
> > 72127 Kusterdingen
> > Germany
> >
> > Tel. +49 7071 3690 52
> > Mobil: +49 173 9630135
> > Fax +49 7071 3690 98
> >
> > Internet: www.syscon.eu
>
> > E-Mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> <mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
>
> >
> > Sitz der Gesellschaft: D-72127 Kusterdingen
> > Registereintrag: Amtsgericht Stuttgart, HRB 382295
> > Geschäftsleitung: Jens Joachim, Ralf Joachim
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email