Problem unmarshalling xml using JAXB

I am using JAXB for processing xml, which comes from an external source. Most often, the xml gets changed from external source which causes the error during unmarshalling as the xsd has not changed. Is there a way to process the xml in same way even if xsd hasn't changed, like converting new xml to one as per xsd etc. Someone has mentioned using xslt, but I would like to get more ideas on any other technologies or third party tools to overcome this issue so that I do not have to reply upon changing xsd everytime. Thanks

Most often, the xml gets changed from external source which causes the error during unmarshalling as the xsd has not changed.So, you've got garbage input. Your goal should be to stop that from happening rather than trying to make it work.
so that I do not have to reply upon changing xsd everytimeIf you have to keep changing the schema then perhaps JAXB wasn't a suitable technology choice here. Or maybe the design wasn't done properly. Or maybe (see earlier comment) the input files aren't being produced properly. At any rate you need to fix the underlying problem before writing code.

Similar Messages

  • Error when reading data from XML using JAXB?

    Hi all,
    I get the error message when reading data from XML using JAXB.
    [org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
    (AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:481)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:199)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142)
    I don't find the reason, please help!
    Thanks in advance!

    The problem is sovled.

  • Parsing ejb-jar.xml using jaxb

    hi all,
    how to parse the ejb-jar.xml using jaxb? can anybody send the information about the API which we have to use to parse the ejb-jar.xml? (ejb2.0)
    i need the details about all ejbs in an application, (like jndi name, Home and Remote name). so, how can i parse the ejb descriptors?
    regards,
    panneer

    Hi Panneer,
    Well, parsing the EJB descriptors is, in principle, a task for the EJB container where they are deployed. From what you wrote I assume that you need to gather that kind of info to visualize in some (monitoring?) tool. Is that correct?
    If so, the question would be whether you have access to the EJB jar on the file system (before it's deployed) or you can only connect to the server with the already deployed EJBs. In the latter case, this information is shown in the [NWA plugins|http://help.sap.com/saphelp_nwce10/helpdata/en/0b/5b5a42ea221153e10000000a155106/frameset.htm]. There are also some [telnet commands|http://help.sap.com/saphelp_nw04/helpdata/en/79/3cf82ade038d45a21fbfdaee349b22/frameset.htm] in NW 04 and 7.0 (04s).
    If you have access to the EJB jar file, you can parse the descriptors using DOM or SAX, but I'm not aware of any pre-defined JAXB API for this purpose. Probably you can also generate the mapped classes yourself and use them, however I'm not sure how that works with DTD (because of EJB 2.0).
    HTH!
    \-- Vladimir

  • Entity include with relative path in XML using JAXB

    Moving this from the Java Technologies for Web Services forum to this one.
    With the jwsdp jars I'm trying to use JAXB to load in several specified XML files. This works fine. The XML files are read in from a relative link "/templates/mainXML.xml" and the xml string read in and passed to the unmarshaller as a StreamSource:
    BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResource(xmlPath_).openStream()));
    while ( (line = reader.readLine()) != null) {
    buff.append(line.trim()+"\n");
    String xml = buff.toString();
    u.unmarshall(new StreamSource(new StringReader(xml)))
    But my XML files are becoming rather large with some repitition across the files so I'd like to use the entity incude in the header of the XML to abstract some of the XML into addMe.xml e.g:
    <!DOCTYPE StrategyTemplate [
    <!ENTITY IncludeTimeComponent SYSTEM "file:///templates/addMe.xml">]>
    with &IncludeTimeComponent;
    But it gives this error:
    Caused by: java.io.FileNotFoundException: \templates\addMe.xml (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
    at java.net.URL.openStream(URL.java:1007)
    at weblogic.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:836)
    at weblogic.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:767)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1095)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1513)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
    at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
    at com.lb.cmte.oms.interpreter.jaxb.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:140)
    ... 11 more
    It works fine if I put the file in the working directory or supply the full path e.g.
    <!DOCTYPE StrategyTemplate [
    <!ENTITY IncludeTimeComponent SYSTEM "file:///C:/dev/templates/addMe.xml">]>
    with &IncludeTimeComponent;
    I've tried using jwsdp2.0 jars rather than 1.4 I was using previously, but with the same result.
    But I don't want to do that, because I don't know where that might be. I'd like to be able to supply the xml file's path as it would be shown within a JAR as I do currently for the mainXML.xml files. Thanks in advance for any help!

    Oh, I see why. When XML talks about a "relative path" that means relative to the URL the XML was loaded from. But when the parser doesn't have such a URL -- for example in cases like yours where you are parsing from a String -- then it falls back to assuming the XML was loaded from the current working directory.
    This is almost never a good assumption, but what else can it do?
    Looking at your code, I don't understand why you are parsing from a String anyway. All of that code that reads from an input stream, ignoring the line endings and putting back new line endings, seems pointless to me. You should just marshal directly from getClass().getResource(xmlPath_) as far as I can see. Then your relative paths would work just fine.

  • Problem validating xml file - jaxb

    hi people, I'm working with jaxb to generate Java source classes from the .xsd schemas that I have. I work with 17 schemas that, a priori, I can't modify. In those schemas there are a lot of types and structures that I can use when creating an .xml file. I've read other threads with the problem of namespaces but as a solution they provide a modification on the schemas. The generation of java source is ok, I've done custoization classes and no problem, but when I try to unmarshal an input xml file I get an error of validation:
    DefaultValidationEventHandler: [ERROR]: Probably namespace URI of tag "XFFile" is wrong (correct one is "http://ww........
    A possible xml file is :
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE XFFile><XFFile xmlns:rp210Elements="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S377M/2004" xmlns:s377mMux="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S377M/2004" xmlns:s380mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S380M/2004" xmlns:s381mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S381M/200X" xmlns:s382mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S382M/200X" xmlns:s385mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S385M/2004" xmlns:s422mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S422M/200X" xmlns:s422mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S422M/200X" xmlns:s423mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S423M/200X">
         <s380mGroups:ClipFramework rp210Elements:InstanceID="a6.67.7a.47.19.2f.4b.10.8f.ee.1e.59.6d.4c.f1.70" rp210Elements:LinkedGenerationID="0e.10.a8.9c.96.1c.4c.11.b1.fb.0a.a9.40.22.a4.e2">
              <rp210Elements:ClipCreationDateTime>
                   <rp210Elements:Year>2006</rp210Elements:Year>
                   <rp210Elements:Month>4</rp210Elements:Month>
                   <rp210Elements:Day>18</rp210Elements:Day>
                   <rp210Elements:Hour>12</rp210Elements:Hour>
                   <rp210Elements:Minute>0</rp210Elements:Minute>
                   <rp210Elements:Second>0</rp210Elements:Second>
                   <rp210Elements:mSec4>0</rp210Elements:mSec4></rp210Elements:ClipCreationDateTime>
              <rp210Elements:FrameworkExtendedTextLanguageCode>fr</rp210Elements:FrameworkExtendedTextLanguageCode>
         </s380mGroups:ClipFramework>
    </XFFile>
    I think it's ok because someone has provided it to my company but I can't validate it because it takes elements from many schemas (am I wrong and I can?)
    i can't post the schemas because of the copyrights (damn it). I'm not asking for a solution but if someone has an idea or has had a similar problema.. I'll appreciate all comments, thanks
    Jordi
    Message was edited by:
    WuWei

    In the schema root element xs:schema add namespace declaration.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
    <root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

  • Marshalling Java to XML using JAXB

    Hi,
    I have just downloaded the JAXB reference implementation and have been trying out marshalling Java objects to XML.
    I have a very basic question - can I convert the data from my Java classes into XML and simply send it as a String to another object instead of only having to write it out into a File? Ideally, I want to convert Java to XML from my Business Layer and send XML to my Presentation Layer objects. To do this, I need the XML returned to me in the form of a String and not a File. Any tips will be highly appreciated.

    You should be using Object Factory. JAXB provides one ObjectFactory for each schema.
    Create that particular object and after filling values into that object please set it to the Jaxb object where ever it fits.
    Like
    <Message>
    <Type></Type>
    <Name></name>
    <Message>
    If you want to set Name then JAXB will provide you with setter which be used to set or get. Util you are setting an object which is can repeat more that once then you will have to get a list from the JAXB object and add those objects into the list which will automatically add it the main object.

  • Problem Tranforming xml using jstl

    Hello To Every One
    I have transformed xml document using servlet now i need to know how can i transform xml document using jstl. I have found this code very often but it doesn't work with a relative or absolute url. I need to pass parameters dynamically.
    <c:import var="xml" url="<%=xmlFile%>" />
    <c:import var="xslt" url="<%=xsltFile%>" />
    <x:transform xml="${xml}" xslt="${xslt}" />In this code I have to pass xmlFile and xsltFile parameter dynamically and i want to make it as session variables. When i put relative url in *<c: import >* tag it works fine but for absolute url it does not work. Although I doesnot want to pass absolute url but relative ones, but how can i achieve that one.
    E.G.
    <x:transform xml="relative url for xmlfile" xslt="relative url for xslt file" />If anyone have the solution please reply me as soon as possible. Thanx in Advance for your kind Attention.

    Thanx for your answer This is my Code which works fine.
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
    <html>
      <head>
      </head>
      <body>
        <form method="post">
       <c:import var="xml" url="..\\data\\192.168.1.94\\master.xml" />
    <c:import var="xslt" url="..\\other\\Masterview.xsl" />
    <x:transform xml="${xml}" xslt="${xslt}" />
        </form>
      </body>
    </html>But in <c:import > tag i want to put url value dynamically so when i convert that string to a variable and pass that variable into url attribute it does not work.
    Like This
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
    <html>
      <head>
      </head>
      <body>
       <%
       try{
            String xmlFile="..\\data\\"+session.getAttribute("param1").toString()+"\\master.xml";
            String xsltFile="..\\other\\"+session.getAttribute("param2").toString()+"\\MasterView.xsl";
            }catch(Exception ep){ep.printStackTrace();}
       %>
        <form method="post">
       <c:import var="xml" url="<%=xmlFile.toString()%>" />
    <c:import var="xslt" url="<%=xsltFile.toString()%>" />
    <x:transform xml="${xml}" xslt="${xslt}" />
        </form>
      </body>
    </html>

  • Appending Data in XML File using JAXB

    I need to write the 50,000 records into XML file. But at a time i need to write only 1000 records into XML. How do i append the data into XML using JAXB.

    I have tried but the data is written in the following way:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Users xmlns="http://www.yyyy.com/umc/importer/jaxb">
    <User id="101" xmlns="">
    <username>gjhs</username>
    <password>hdfhhdf</password>
    <role>df</role>
    <email>sdd</email>
    <phone>sdfdf</phone>
    <description>shkl</description>
    <property name="ernnker" value="hkdfhk"/>
    </User>
    </Users>
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Users xmlns="http://www.yyyy.com/umc/importer/jaxb">
    <User id="101" xmlns="">
    <username>gjhs</username>
    <password>hdfhhdf</password>
    <role>df</role>
    <email>sdd</email>
    <phone>sdfdf</phone>
    <description>shkl</description>
    <property name="ernnker" value="hkdfhk"/>
    </User>
    </Users>
    If i can eliminate the following lines from the above files then my job is done:
    </Users>
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Users xmlns="http://www.yyyy.com/umc/importer/jaxb">

  • Query in Unmarshaling using JAXB

    Hi,
    I have some chinese characters in my xml. When i try to read those string from XML using JAXB Unmarshaling and print the same, it is getting changed to some unicode character.
    Help me in this regard.
    As the chinese characaters are getting changed after preview, if u can contact my thro mail, it will be better ([email protected] is my email id)
    Regards
    Ravishankar

    Please post the error message and the exception stack.
    My guess is that the error is: your VO's SQL statement did not include the primary key attribute (say Empno).
    Thanks.
    Sung

  • JAXB problems unmarshalling

    I used xjc to generate a set of elements from the schema shown below:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://www.doc.state.nc.us/doccodes" xmlns="http://www.doc.state.nc.us/doccodes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <xsd:element name="codeTable" type="CodeTable"/>
         <xsd:element name="codeRequest" type="CodeRequest"/>
         <xsd:complexType name="CodeTable">
              <xsd:sequence>
                   <xsd:element name="codename" type="xsd:string"/>
                   <xsd:element name="codes" type="Codes"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="Codes">
              <xsd:sequence>
              <xsd:element name="code" type="Code" minOccurs="1" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="Code">
              <xsd:sequence>
                        <xsd:element name="identifier" type="xsd:string"/>
                        <xsd:element name="description" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="CodeRequest">
              <xsd:sequence>
                   <xsd:element name="application" type="xsd:string"/>
                   <xsd:element name="token" type="xsd:string"/>
                   <xsd:element name="codename" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    I have successfully been able to marshall an xml file using the following code:
    jc = JAXBContext.newInstance( "nc.doc.nexus.code.jaxb.model");
    CodeTable codeTable = new CodeTable();
    Codes facilityCodes = new Codes();
    List<Code> codeList = facilityCodes.getCode();
    codeList.addAll(persistables); // where persistables is an ArrayList of Code objects
    codeTable.setCodes(facilityCodes);
    codeTable.setCodename("facilityCode");
    JAXBElement<CodeTable> codeTableElement = (new ObjectFactory()).createCodeTable(codeTable);
    Marshaller m = jc.createMarshaller();
    m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
    m.marshal(codeTableElement, System.out);
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    DocumentBuilder db;
    try {
    db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    m.marshal(codeTableElement, doc);
    return doc;
    catch (ParserConfigurationException e) {
    The marshalling works just fine, and results in the following xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:codeTable xmlns="http://www.doc.state.nc.us/doccodes" xmlns:ns1="http://www.doc.state.nc.us/doccodes">
    <ns1:codename>
    facilityCode </ns1:codename>
    <ns1:codes>
    <ns1:code>
    <ns1:identifier>
    X001 </ns1:identifier>
    <ns1:description>
    DHO DISTRICT 1 </ns1:description>
    </ns1:code>
    <ns1:code>
    <ns1:identifier>
    X002 </ns1:identifier>
    <ns1:description>
    DHO DISTRICT 2 </ns1:description>
    </ns1:code>
    <ns1:code>
    <ns1:identifier>
    X003 </ns1:identifier>
    <ns1:description>
    DHO DISTRICT 3 </ns1:description>
    </ns1:code>
    </ns1:codes>
    </ns1:codeTable>
    My code to unmarshall this xml document is as follows:
    JAXBContext jc;
    try {
    jc = JAXBContext.newInstance( "nc.doc.nexus.code.jaxb.model");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    JAXBElement<CodeTable> codeTableElement =
    (JAXBElement<CodeTable>)unmarshaller.unmarshal(aDocument);
    catch (JAXBException e) {
         throw new DeserializerException(e);
    Now the problem. When I attempt to unmarshall this xml, I get the following UnmarshalException:
    unexpected element (uri:"", local:"ns1:codeTable"). Expected elements are <{http://www.doc.state.nc.us/doccodes}codeRequest>,<{http://www.doc.state.nc.us/doccodes}codeTable>
    I've made countless attempts to alter the unmarshal code in an attempt to determine if I had just coded it wrong, or whether jaxb is not able to interpret namespaces or schemas correctly. I have to assume the latter at this point. Can anybody shed any light on this?
    By the way, below is the xjc generated class CodeTable:
    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b26-ea3
    // See http://java.sun.com/xml/jaxb
    // Any modifications to this file will be lost upon recompilation of the source schema.
    // Generated on: 2007.08.22 at 10:42:51 AM EDT
    package nc.doc.nexus.code.jaxb.model;
    import javax.xml.bind.annotation.AccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlType;
    import nc.doc.nexus.code.jaxb.model.CodeTable;
    import nc.doc.nexus.code.jaxb.model.Codes;
    * <p>Java class for CodeTable complex type.
    * <p>The following schema fragment specifies the expected content contained within this class.
    * <pre>
    * <complexType name="CodeTable">
    * <complexContent>
    * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    * <sequence>
    * <element name="codename" type="{http://www.w3.org/2001/XMLSchema}string"/>
    * <element name="codes" type="{http://www.doc.state.nc.us/doccodes}Codes"/>
    * </sequence>
    * </restriction>
    * </complexContent>
    * </complexType>
    * </pre>
    @XmlAccessorType(AccessType.FIELD)
    @XmlType(name = "CodeTable", propOrder = {
    "codename",
    "codes"
    public class CodeTable {
    @XmlElement(namespace = "http://www.doc.state.nc.us/doccodes")
    protected String codename;
    @XmlElement(namespace = "http://www.doc.state.nc.us/doccodes")
    protected Codes codes;
    * Gets the value of the codename property.
    * @return
    * possible object is
    * {@link String }
    public String getCodename() {
    return codename;
    * Sets the value of the codename property.
    * @param value
    * allowed object is
    * {@link String }
    public void setCodename(String value) {
    this.codename = value;
    * Gets the value of the codes property.
    * @return
    * possible object is
    * {@link Codes }
    public Codes getCodes() {
    return codes;
    * Sets the value of the codes property.
    * @param value
    * allowed object is
    * {@link Codes }
    public void setCodes(Codes value) {
    this.codes = value;
    }

    UPDATE: I changed the unmarshal code to unmarshal a File instead of a DOM Document, and it works. This is the revelation I was hoping not to come to. I really don't want to have to serialize my Document to a file and then unmarshal that file from disk. This would not be an acceptable solution for a large J2EE application with many web services servicing 10000 clients. Does anybody know why the unmarshal method that accepts a DOM Document does not work?

  • Marshaling problem in creation of xml thru JAXB

    Hi java gurus,
    I am trying to create an XML which will has the data of database using JAXB. I am able to generate JAXB classes, but its giving some error the stack trace is like this
    java.lang.NoSuchMethodError: com.sun.xml.bind.marshaller.XMLWriter.setXmlDecl(Z)V
         at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:223)
         at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:238)
         at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.createWriter(MarshallerImpl.java:233)
         at org.bas.dss.common.vo.bii.impl.runtime.MarshallerImpl.marshal(MarshallerImpl.java:126)
         at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:66)
         at org.bas.dss.common.dao.MetaDAO.createInstInformation(MetaDAO.java:627)
         at org.bas.core.fidownload.DownloadActionHandler.getInstInfoXMLData(DownloadActionHandler.java:163)
         at org.bas.core.fidownload.DownloadActionHandler.performPreDownloadAction(DownloadActionHandler.java:74)
         at org.bas.core.fidownload.DownloadAction.perform(DownloadAction.java:129)
         at org.bas.core.fidownload.DownloadAction.execute(DownloadAction.java:79)
    the method is like this,
    valueObject = getInstInformation (registrationId, appVersionId);
    System.out.println("MetaDAO-->valueObject:"+valueObject); //here i am gettingthe object
    context = JAXBContext.newInstance("org.bas.dss.common.vo.bii");
    System.out.println("MetaDAO-->context:"+context); //here i am getting the context
    sumissionInfoMarshaller = context.createMarshaller();
    System.out.println("MetaDAO-->sumissionInfoMarshaller:"+sumissionInfoMarshaller); //here also i am getting some object type
    sumissionInfoMarshaller.setProperty(
    Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
    System.out.println("MetaDAO-->MetaDAO-->");
    sumissionInfoMarshaller.marshal (valueObject, streamToWrite); // the problem is coming here.
    anyone can suggest what will be the problem, and tell me how can i resolve this issue,
    thanks in advance,
    varma

    Pl post this question to SDK Forum

  • Java Mapping Using JAXB [Java Arch for XML Binding]

    Hi All,
    Anyone tried using JAXB  [Java Architecture for XML Binding API available with Java WebServices Pack] technique for XML processing in Java Mapping??
    I am facing the following problems..
    1. I am not able to generate namespace while marshalling target XML [In standalone mode and not tried in XI].
    2. What are the jar files we need to import?
       I tried importing the following jar files in XI.
    jaxb-api.jar,jaxb-impl.jar,jaxb-libs.jar,jax-qname.jar,namespace.jar,relaxngDatatype.jar
      and getting some errors while importing these files in XI.
    3. It throws error at runtime [Interface Mapping-Test Tab]
       like Resource not found:javax/xml/bind/Messages_en.properties,javax/xml/bind/Messages_en_US.properties
    4. Even after creating a copy of available file Messages.Properties with name: Messages_en.properties and Messages_en_US.properties.. it is not generating any messages in Target message tab
    Thanks in Advance,
    Ananth Chinnaraj

    Sravya ,
    I have searched wide and far for this, but no success.
    A lot on JAXB XI and Webdynpro, but nothing on JAXB, XI and mappings.
    Could you please post the url here ?
    Thanks and kind regards,
    Jan

  • Problems using JAXB in windows(Failed to load Main-Class manifest)

    Friends,
    I am trying to use JAXB in windows environment. I have already included rt and xjc jar files in my system classpath.
    I have sucessfully created java files using the xjc compiler(without the xjs map file). They rock!!
    But I am facing problems while creating .xjs file from my dtd. I tried looking into previously discussed topics, with no help. :(
    my command line:
    java -jar C:\jaxb-1.0-ea\lib\jaxb-rt-1.0-ea.jar mySchemaFile.dtd
    This is what i get :
    Failed to load Main-Class manifest attribute from
    C:\jaxb-1.0-ea\lib\jaxb-rt-1.0-ea.jar
    Please help, if you have come across this or similar issue..
    Or let me know how you create a .xjs file.
    Any idea what is the main file class in jaxb-rt-1.0-ea.jar that creates a xjs file ?
    All/any help appreciated. Thanks in advance.

    Hi,
    You cannot use xjs files with the JAXB Beta RI.
    This has been mentioned at http://java.sun.com/xml/jaxb
    "Note that this version is not API-level compatible with the previous released version of the specification and DTD schemas are no longer supported."
    You can generate code using the xjc binding compiler for schema documents.
    Pls let me know if you have more questions
    Thanks,
    Bhakti
    Friends,
    I am trying to use JAXB in windows environment. I have
    already included rt and xjc jar files in my system
    classpath.
    I have sucessfully created java files using the xjc
    compiler(without the xjs map file). They rock!!
    But I am facing problems while creating .xjs file from
    my dtd. I tried looking into previously discussed
    topics, with no help. :(
    my command line:
    java -jar C:\jaxb-1.0-ea\lib\jaxb-rt-1.0-ea.jar
    mySchemaFile.dtd
    This is what i get :
    Failed to load Main-Class manifest attribute from
    C:\jaxb-1.0-ea\lib\jaxb-rt-1.0-ea.jar
    Please help, if you have come across this or similar
    issue..
    Or let me know how you create a .xjs file.
    Any idea what is the main file class in
    jaxb-rt-1.0-ea.jar that creates a xjs file ?
    All/any help appreciated. Thanks in advance.

  • Problem Unmarshalling with JaxB

    I am running into a strange problem but I am sure there is a simple solution that I am overlooking. I currently have a Java application that uses JaxB. I build the application and run the jar file on my computer and everything runs fine. However when I try to run the jar file on another computer JaxB is unable to unmarshal the XML file. I am receiving a JAXBException with an error message stating:
    Provider com.sun.xml.bind.v2.ContextFactory not found
    I am unsure why the program runs fine on my computer but not on others. The computer the the program runs on is the computer that I used to develop the application. I am using Netbeans 5.5 if that matters.
    Any help with this would be well appreciated. Let me know if you have any additional questions.

    To make this problem even more difficult to figure out, I have determined that it does work on some computers, but doesn't work on some other computers.
    I have copied the dist folder that was created by Netbeans to a flash drive, and when I attempted to run it on one computer it failed with the above error. When I ran it on a second computer it worked exactly as intended. Any thoughts?

  • How to read the attribute of the xml file using jaxb

    Thanks,
    Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
    thanx in advance
    Rasool
    <contextmenu>
    <menu name='Lead' >
    <menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
    <menuitem name='editlead' desc='Edit Lead' action='' />
    <menuitem name='leadinfo' desc='Lead Information' action='' />
    </menu>
    <menu name='Cases' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    <menu name='Contact' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    </contextmenu>

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

Maybe you are looking for

  • Please Help! Hard Drive Problem

    Hi, I know there are various other posts with a similar problem but I have tried a lot of suggestions and keep hitting a brick wall. Apologies if this rambles on a bit or doesn't make a lot of sense. Two nights ago my 18 month old imac refused to sta

  • ORACLE 8i PASSWORD ROTECTED

    HI MATES i have a problem with my oracle 8i when i try to log in it asks for a password and i have entered the correct password but it still not recognized. please do help me coz some important documents are there and i need to retrieve it badly

  • Xcode "fails with exit code 1"

    I'm new to xcode, 13 years old, and it stopped compiling my code! I'm working in C++ command line. My first project worked fine, but when I tried to run a new project, the build failed (not from syntax errors or anything) and gave me this notificatio

  • Extending SpinnerListModel

    If you want functionality for looping the values of the JSpinner use this class: package mseries.utils; import java.util.List; import javax.swing.SpinnerListModel; import java.util.Arrays; * <p>Title: RespinnerListModel</p> * <p>Description: Extends

  • 6 calendars on iPhone.  Is it possible to view just 2 at the same time?

    I have 6 calendars synced to my iPhone, 5 from iCal on my Mac (sync via MobileMe) and 1 from Google Calendar. I need to see 2 of these calendars on my iPhone at the same time. Is it possible to select only 2, but not the others? The only options I ha