This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Web Services and the fly likes UnmarshalException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "UnmarshalException" Watch "UnmarshalException" New topic


manikandan malathy

Joined: Sep 17, 2008
Posts: 13
I have a problem in Unmarshall......

This s my code

package Sample;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import org.apache.log4j.Logger;
import com.sun.jmx.remote.internal.Unmarshal;
class MarshalUnmarshal
JAXBContext jc;
Object parseObject=null;
String message="<?xml version=\'1.0\' encoding=\'UTF-8\'?><MSG_VER>1</MSG_VER><VAR_COU>0034</VAR_COU><LEG_COU>1</LEG_COU>";

private static Logger log=Logger.getLogger(MarshalUnmarshal.class);

public MarshalUnmarshal()
Unmarshaller u=jc.createUnmarshaller();
parseObject=u.unmarshal(new StringReader(message));
log.debug("parsedObject= " + parseObject);
catch(Exception e)
System.out.println("This s parsed error"+e);

public static void main(String[] s)
MarshalUnmarshal MU=new MarshalUnmarshal();


after executing i am getting this error:
errorjavax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"MSG_VER"). Expected elements are (unknown)
I agree. Here's the link:
subject: UnmarshalException
It's not a secret anymore!