users@jaxb.java.net

javax.xml.bind.UnmarshalException- with linked exception:[com.sun.msv.verifier.ValidityViolation: unexpected attribute

From: nkak <nkakkera_at_yahoo.com>
Date: Sun, 13 Apr 2008 22:11:41 -0700 (PDT)

Hi All,

I am using JAXB1.0 on JDK 1.4.2

My code is working fine on Tomcat server, but it is failing on OC4J
Application server.

I am getting below exception
***********************************************************************

2008-04-13 23:25:45,725 ERROR
[com.threeht.elease.admin.bus.impl.ParseXMLServiceImpl] -
<UnmarshalException while parsing data::::::>
 
javax.xml.bind.UnmarshalException
 
 - with linked exception:
 
[com.sun.msv.verifier.ValidityViolation: unexpected attribute
"xmlns:elease"]
 
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:306)
 
    at
com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:134)
 
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:139)
 
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:144)
 
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:153)
 
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171)
 
    at
com.threeht.elease.admin.bus.impl.ParseXMLServiceImpl.parseXMLData(Unknown
Source)
*******************************************************************************
Here is my code:

***********************
String packageName = ObjectFactory.class.getPackage().getName();
JAXBContext jc = JAXBContext.newInstance(packageName);
Unmarshaller u = jc.createUnmarshaller();
u.setValidating(true);
u.setEventHandler(new ValidationEventHandler() {
        public boolean handleEvent(ValidationEvent ve) {
        if (ve.getSeverity() != ValidationEvent.WARNING) {
               ValidationEventLocator vel = ve.getLocator();
           String retMsg = "XML file is not valid because of the follwing
reason:Line:Col["
        + vel.getLineNumber()+ ":"+ vel.getColumnNumber()+ "]:" + ve.getMessage();
        log.error(retMsg);
}

        return false;
}
});

Object unObj = u.unmarshal(xmlfile);

***************************

XSD file:

**************************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:elease="http://www.3ht.com/eLease"
        targetNamespace="http://www.3ht.com/eLease">
        <annotation>
                <documentation xml:lang="en">
                        This schema defines the XML format necessary to update
                        eLease Census broker task data.
                </documentation>
        </annotation>
        <element name="data-updates">
                <annotation>
                        <documentation>
                                The root node of the document specifying data updates to
                                be performed.
                        </documentation>
                </annotation>
                <complexType>
                        <sequence>
                                <element name="project" type="elease:project"
                                        minOccurs="1" maxOccurs="unbounded" />
                        </sequence>
                </complexType>
        </element>
        <complexType name="project">
                <annotation>
                        <documentation>
                                A project is a collection of tasks and associated data.
                        </documentation>
                </annotation>
                <sequence>
                        <element name="project-number" type="elease:project-number"
                                minOccurs="1" maxOccurs="1" />
                        <element name="task-updates" type="elease:task-update"
                                minOccurs="1" maxOccurs="31" />
                </sequence>
        </complexType>
        <complexType name="task-update">
                <annotation>
                        <documentation>
                                A task update specifies data about the changes made to a
                                specific task.
                        </documentation>
                </annotation>
                <sequence>
                        <element name="task-id" minOccurs="1" maxOccurs="1">
                                <annotation>
                                        <documentation>
                                                A unique identifier from eLease that maps to the
                                                task name.
                                        </documentation>
                                </annotation>
                                <simpleType>
                                        <restriction base="positiveInteger"></restriction>
                                </simpleType>
                        </element>
                        <element name="task-name" minOccurs="1" maxOccurs="1">
                                <annotation>
                                        <documentation>
                                                The name of task as specified in eLease.
                                        </documentation>
                                </annotation>
                                <simpleType>
                                        <restriction base="string">
                                                <maxLength value="200"></maxLength>
                                        </restriction>
                                </simpleType>
                        </element>
                        <element name="task-comments" minOccurs="1" maxOccurs="1">
                                <annotation>
                                        <documentation>
                                                Additional information regarding the task.
                                        </documentation>
                                </annotation>
                                <simpleType>
                                        <restriction base="string">
                                                <maxLength value="500"></maxLength>
                                        </restriction>
                                </simpleType>
                        </element>
                        <element name="task-estimated-completion-dt" minOccurs="1"
                                maxOccurs="1" type="elease:date">
                                <annotation>
                                        <documentation>
                                                The target estimated date on which the task will
                                                be completed.
                                        </documentation>
                                </annotation>
                        </element>
                        <element name="task-begin-dt" minOccurs="0" maxOccurs="1"
                                type="elease:date-empty">
                                <annotation>
                                        <documentation>
                                                The date work began on the task.
                                        </documentation>
                                </annotation>
                        </element>
                        <element name="task-completion-dt" minOccurs="0"
                                maxOccurs="1" type="elease:date-empty">
                                <annotation>
                                        <documentation>
                                                The date work completed on the task.
                                        </documentation>
                                </annotation>
                        </element>
                        <element name="task-completed-by" type="elease:user-id"
                                minOccurs="1" maxOccurs="1">
                                <annotation>
                                        <documentation>
                                                The eLease user id of the person who
                                                begin/completed work on the task.
                                        </documentation>
                                </annotation>
                        </element>
                        <element name="task-last-update-dttm" type="elease:datetime"
                                minOccurs="1" maxOccurs="1">
                                <annotation>
                                        <documentation>
                                                The exact timestamp the task data was last
                                                updated.
                                        </documentation>
                                </annotation>
                        </element>

                </sequence>
        </complexType>
        <simpleType name="project-number">
                <annotation>
                        <documentation>
                                A project number uniquely identifies the project for
                                which the task updates are performed.
                        </documentation>
                </annotation>
                <restriction base="string">
                        <pattern value="[0-9]{1}[A-Z]{2}[0-9]{4}" />
                </restriction>
        </simpleType>
        <simpleType name="user-id">
                <annotation>
                        <documentation>
                                A user-id uniquely identifies a user in eLease to whom
                                the updates will be attributed. It is also used to check
                                the validity of the update. The user must be assigned to
                                the project and have the appropriate roles in order to
                                make the desired update.
                        </documentation>
                </annotation>
                <restriction base="string">
                        <pattern value="[^@]+@[^\.]+\..+" />
                        <maxLength value="100"></maxLength>
                </restriction>
        </simpleType>
        <simpleType name="date">
                <annotation>
                        <documentation>
                                A date is a basic date formatted MM/DD/YYYY in Eastern
                                Time (GMT-0500).
                        </documentation>
                </annotation>
                <restriction base="string">
                        <pattern value="[0-9]{2}\/[0-9]{2}\/[0-9]{4}" />
                </restriction>
        </simpleType>
        <simpleType name="datetime">
                <annotation>
                        <documentation>
                                A datetime is a basic date and time formatted MM/DD/YYYY
                                in Eastern Time (GMT-0500).
                        </documentation>
                </annotation>
                <restriction base="string">
                        <pattern
                                value="[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}\:[0-9]{2}\:[0-9]{2}" />
                </restriction>
        </simpleType>
        <simpleType name="date-empty">
                <annotation>
                        <documentation>
                                A date is a basic date formatted MM/DD/YYYY in Eastern
                                Time (GMT-0500) or a blank.
                        </documentation>
                </annotation>
                <union>
                        <simpleType>
                                <restriction base="elease:date"></restriction>
                        </simpleType>
                        <simpleType>
                                <restriction base="string">
                                        <length value="0" />
                                </restriction>
                        </simpleType>
                </union>
        </simpleType>
</schema>


**********************************************************************

XML file:

*******************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<elease:data-updates xmlns:elease="http://www.3ht.com/eLease"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.3ht.com/eLease elease-equis-census-data.xsd">
        <project>
                <project-number>1CO0230</project-number>
                <task-updates>
                        <task-id>51</task-id>
                        <task-name>Acquisition Plan</task-name>
                        <task-comments>Comment 0</task-comments>
                        <task-estimated-completion-dt>12/31/2004</task-estimated-completion-dt>
                        <task-begin-dt></task-begin-dt>
                        <task-completion-dt>11/12/2009</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>11/11/2007 13:20:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>532</task-id>
                        <task-name>Requirements Development and Approval</task-name>
                        <task-comments>Comment 11</task-comments>
                        <task-estimated-completion-dt>11/30/2007</task-estimated-completion-dt>
                        <task-begin-dt></task-begin-dt>
                        <task-completion-dt></task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/20/2007 13:20:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>53</task-id>
                        <task-name>Delineated Areas Received</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>02/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>07/01/2007</task-begin-dt>
                        <task-completion-dt>12/31/2007</task-completion-dt>
                        <task-completed-by>christopher.larson_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:21:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>75</task-id>
                        <task-name>Initial OA Issued</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>01/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>10/31/2007</task-completion-dt>
                        <task-completed-by>christopher.larson_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:22:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>27</task-id>
                        <task-name>Advertisement</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>10/15/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/20/2007</task-begin-dt>
                        <task-completion-dt>08/25/2007</task-completion-dt>
                        <task-completed-by>matthew.attaway_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:23:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>85</task-id>
                        <task-name>Market Survey Scheduled</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>12/31/2007</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>12/15/2007</task-completion-dt>
                        <task-completed-by>user01_at_equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:24:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>757</task-id>
                        <task-name>Market Survey Phase Complete (Forms/Report)</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>11/30/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/01/2007</task-begin-dt>
                        <task-completion-dt>12/15/2007</task-completion-dt>
                        <task-completed-by>user01_at_equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:25:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>69</task-id>
                        <task-name>Project Orientation (Kick-Off Call)</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>02/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>07/01/2007</task-begin-dt>
                        <task-completion-dt>12/31/2007</task-completion-dt>
                        <task-completed-by>user01_at_equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:26:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>107</task-id>
                        <task-name>SFO Issued</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>01/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>10/31/2007</task-completion-dt>
                        <task-completed-by>user01_at_equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:27:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>266</task-id>
                        <task-name>Receipt of Initial Offers</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>10/15/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/20/2007</task-begin-dt>
                        <task-completion-dt>08/25/2007</task-completion-dt>
                        <task-completed-by>user01_at_equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:28:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>566</task-id>
                        <task-name>Final Acceptance Inspection</task-name>
                        <task-comments>Comment 4</task-comments>
                        <task-estimated-completion-dt>12/31/2007</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>12/15/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:29:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>648</task-id>
                        <task-name>Construction Drawings Received</task-name>
                        <task-comments>Comment 5</task-comments>
                        <task-estimated-completion-dt>11/30/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/01/2007</task-begin-dt>
                        <task-completion-dt>12/15/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:30:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>132</task-id>
                        <task-name>Construction Drawings Approved</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>02/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>07/01/2007</task-begin-dt>
                        <task-completion-dt>12/31/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:31:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>343</task-id>
                        <task-name>TI Costs Received/TI Negotiations Commence</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>01/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>10/31/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:32:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>276</task-id>
                        <task-name>Draft Lease To GSA</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>10/15/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/20/2007</task-begin-dt>
                        <task-completion-dt>08/25/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:33:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>359</task-id>
                        <task-name>Final Acceptance Inspection</task-name>
                        <task-comments>Comment 6</task-comments>
                        <task-estimated-completion-dt>12/31/2007</task-estimated-completion-dt>
                        <task-begin-dt>01/01/2008</task-begin-dt>
                        <task-completion-dt>12/15/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:34:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>419</task-id>
                        <task-name>Construction Drawings Received</task-name>
                        <task-comments>Comment 7</task-comments>
                        <task-estimated-completion-dt>11/30/2007</task-estimated-completion-dt>
                        <task-begin-dt>06/01/2007</task-begin-dt>
                        <task-completion-dt>12/15/2008</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:35:15</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>582</task-id>
                        <task-name>Construction Drawings Approved</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>02/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>07/01/2008</task-begin-dt>
                        <task-completion-dt>12/31/2008</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:36:17</task-last-update-dttm>
                </task-updates>
                <task-updates>
                        <task-id>585</task-id>
                        <task-name>TI Costs Received/TI Negotiations Commence</task-name>
                        <task-comments></task-comments>
                        <task-estimated-completion-dt>01/01/2008</task-estimated-completion-dt>
                        <task-begin-dt>10/01/2007</task-begin-dt>
                        <task-completion-dt>10/01/2007</task-completion-dt>
                        <task-completed-by>brian.adelstein_at_ugl-equis.com</task-completed-by>
                        <task-last-update-dttm>06/19/2007 13:37:15</task-last-update-dttm>
                </task-updates>
        </project>
</elease:data-updates>

*********************************************************************

Request you all to help me resolving this problem.

Thanks in advance,

NK

-- 
View this message in context: http://www.nabble.com/javax.xml.bind.UnmarshalException--with-linked-exception%3A-com.sun.msv.verifier.ValidityViolation%3A-unexpected-attribute-tp16670497p16670497.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.