Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] case problem in OXM project with eclipselink 1.0.2

Hi Senthil,

The descriptor QName in XMLContext is built based on the information provided in the mappings .xml file generated by the workbench. If the workbench is showing the default-root-element for your descriptor as "Tag", but the generated mappings file has it as "tag" this may be a bug.

If you'd like, you can send me your deployment.xml/sessions.xml and your schema etc, and I'll take a closer look at it.

-Matt

senthilkumar_ks wrote:
Hi

I have a weird problem when settingup a OXM project.  I have a simple Java
model which stores the "tags" for a particular document.  So, the DB model
would look like


Doc id -> Tags (1 to many )



So, I create a OXM project as detailed http://www.oracle.com/technology/products/ias/toplink/technical/tips/ox/index.htm
here  based on the java objects.  I also created a Schema document for this
which would be
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Tag">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Phrase" type="xs:string"/>
				<xs:element name="DocId" type="xs:string" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

After I am done creating the project, sessions etc.  I create a TestClient
and unmarshall an instance document like this

<Tag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="Tag.xsd">
	<Phrase>java</Phrase>
<DocId>docId</DocId>
</Tag>

which fails with an exception stack trace
javax.xml.bind.UnmarshalException
 - with linked exception:
[Exception [EclipseLink-25008] (Eclipse Persistence Services - 1.0.2 (Build
20081024)): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element Tag was not
found in the project]
	at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:289)
	at
com.proquest.services.tags.model.TagsOXMClient.testOXM(TagsOXMClient.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: Exception [EclipseLink-25008] (Eclipse Persistence Services -
1.0.2 (Build 20081024)):
org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element Tag was not
found in the project
	at
org.eclipse.persistence.exceptions.XMLMarshalException.noDescriptorWithMatchingRootElement(XMLMarshalException.java:125)
	at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshallerHandler.startElement(SAXUnmarshallerHandler.java:197)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3088)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:914)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
	at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:533)
	at
org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:103)
	at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:564)
	at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:478)
	at
org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:448)
	at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:276)
	... 20 more


I tried debugging and found that the descriptorQName created in
org.eclipse.persistence.oxm.XMLContext is a tag and not a Tag (Note the case
change). So, I changed my instance document to this

<?xml version="1.0" encoding="UTF-8"?>
<tag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="Tag.xsd">
	<phrase>asdfasfd</phrase>
</tag>

and I am able to Unmarshall it successfully.
Can anybody explain this for me?

Regards
Senthil




Back to the top