Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with JAXB Unmarshall - javax.xml.bind.UnmarshalException

843834Jan 27 2009 — edited Mar 16 2010
Hi,

I'm getting an expection while unmarshalling using JAXB. The error is as follows :

DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://www.etrade.com/ee/systemdomainao/search", local:"Context_Id"). Expected elements are <{}contextId>,<{}predicateInterceptor>,<{}isDefaultsearch>,<{}implicitContextSQL>,<{}contextName>,<{}searchId>,<{}implicitContextText>

I've generated JAXB classes using xjc command from my schema. The root element is Search object which has a List of Searchcontext and Columlist object. When I'm trying to unmarshall the XML, I'm getting the above exception. What is baffling, if I comment out the <tns:SearchContext> entry from the XML, unmarshall doesn't throw any exception and populates the columnlist properly. Columnlist and Searchcontext have little difference except that columnlist contains more elements.

Here'e the unmarshall code,
URL metadataURL = this.getClass().getClassLoader().getResource("metadata/search/PARTICIPANT.xml");
JAXBContext jc = JAXBContext.newInstance("com.etrade.ee.systemdomainao.search.domain");
Unmarshaller unmarshaller = jc.createUnmarshaller();
unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
Search search = (Search)unmarshaller.unmarshal(metadataURL);

Any pointers will be highly appreciated.

Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2010
Added on Jan 27 2009
12 comments
5,084 views