ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  XML Data Binding with Castor
Subject:   handling enums in mapping xml
Date:   2004-04-22 12:57:49
From:   Espinosa

I'm using Castor mapping to handle differences between 2 schemas. One schema is derived from the other. If I make a change to one of the schema to add an enum from commsStateDefs_CommsState_T .... but my incoming XML message uses one of the existing enum values for this type, I get the following error during the unmarshalling.


Why am I getting this error and what should be done to resolve this problem? I tried to add the enums in the mapping document but the class is the generated Castor classes and the marshalling fails because the member variables are static.


com.lucent.oms.xml.naInterface.types.CommsStateDefs_CommsState_T{file: [not available]; line: 2; column: 633}
java.lang.IllegalStateException: Java schema change: Class com.lucent.oms.xml.naInterface.types.CommsStateDefs_CommsState_T can no longer be constructed
: com.lucent.oms.xml.naInterface.types.CommsStateDefs_CommsState_T
org.exolab.castor.mapping.loader.Types.newInstance(Types.java:225)
at org.exolab.castor.mapping.loader.FieldHandlerImpl.newInstance(FieldHandlerImpl.java:629)
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1023)
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1214)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch (XMLDocumentScanner.java:1171)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at org.exolab.castor.xml.Unmarshaller.unmarshal Unmarshaller.java:338)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)