Hi,

Does anybody know whether Castor XML has problems with the simultaneous
use of auto-derive="byClassName" and the location attribute ? In a class
mapping, I have the following field mapping:

<field name="bets" type="com.betandwin.abp.entity.bet.PlaceableBet"
collection="collection">
        <bind-xml auto-naming="deriveByClass" location="bets"/>
</field>

When trying to unmarshall anything really simple, I get an exception
such as 

unable to find FieldDescriptor for 'win' in ClassDescriptor of
bets{file: [not available]; line: 1; column: 122}
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:671)
        at
com.betandwin.servlet.TestBetSlipXML.testSimpleBetSlip(TestBetSlipXML.ja
va:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:478)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:344)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)
Caused by: org.xml.sax.SAXException: unable to find FieldDescriptor for
'win' in ClassDescriptor of bets
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
a:1940)
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
a:1388)
        at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(U
nknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
        ... 16 more
Caused by: org.xml.sax.SAXException: unable to find FieldDescriptor for
'win' in ClassDescriptor of bets
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
a:1940)
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
a:1388)
        at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(U
nknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
        at
com.betandwin.servlet.TestBetSlipXML.testSimpleBetSlip(TestBetSlipXML.ja
va:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:478)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:344)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)


When changing above field mapping to 

<field name="bets" type="com.betandwin.abp.entity.bet.PlaceableBet"
collection="collection">
        <bind-xml auto-naming="deriveByClass" />
</field>

The exception is not thrown anymore, and Castor is successful in
unmarshalling what it previously marshalled.

Any idea what's going wrong ? 

Thanks
Werner

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to