Now I understood the problem. It is happening in scenario like if we load two XSDs from different classes with same URI but different types in them, XSDHelper is keeping only types from first XSD. Here, two different classes mean their class loaders are different. If we load same two XSDs from single class then there is no issue. is this the expected behavior?
Regards Raman _____________________________________________ From: Malisetti, Ramanjaneyulu Sent: Wednesday, 25 November 2009 5:39 PM To: 'tuscany-u...@ws.apache.org' Subject: RE: SDO UnmarshalException Hi Kelvin, << File: SDO-Marshall-Exception.zip >> After so many trails I found the problem. The issue is where we are loading Schemas and XML files with XMLHelpter.INSTANCE object. For example, if we write one facade class to encapsulate all calls to SDO Api, it is leading to issues like, "Feature not Found" while loading XML resource after loading XSDs or ClassCastException: The feature 'xxxx's type 'DataObject' does not permit a value of type 'xxx'. This is kind of issues can be avoided if we call XMLHelpter.INSTANCE.define/load in our implementation. Here I attached sample source which is slightly complex example. I have taken this scenario to replicate marshall error. However, I got symptoms of the issue before I reach to RMI. So, you can see the issue from very begining of the running Test from sdo.rmi.sample.hello RemoteDescriptor. To illustrate the issue w.r.t attached sample... - sdo.rmi.sampl.impl.util.BeanXmlHelper.java is a façade class which encapsulate SDO APIs - I load XSDs and XML with help of BeanXmlHelper in sdo.rmi.sample.hello.HelloDescriptor and sdo.rmi.sampl.impl.XMLDescriptor - I use HelloDescriptor in HelloConnector. What is the right way of loading XSDs and XMLs so that I can have dynamic types in my code and can use them without in issues across different classloaders? I don't have much exp in using SDO APIs, please bear me if these questions are very basic. I appreciate your help. Thanks in advance.. Regards Raman _____________________________________________ From: Malisetti, Ramanjaneyulu Sent: Monday, 23 November 2009 4:29 PM To: 'tuscany-u...@ws.apache.org' Subject: RE: SDO UnmarshalException Thanks Kelvin for quick response. I am trying to reproduce with sample program so that I can share that with you. Apparently, no luck. It means there is something we are doing differently. I have been trying to identify that.. I'll post progress. Regards Raman to be sure about this, I'd need to be able to recreate the problem with a bit of test code, and I've not played with SDO using RMI calls, but the SDO metadata associated with the namespace URI must be available when the XML document is parsed. This would be made available when either the XSDHelper is used to load a schema or generated SDO classes are registered with the environment, and it is going to need to be available in the jvm that the xml parsing is happening. Kelvin. _____________________________________________ From: Malisetti, Ramanjaneyulu Sent: Friday, 20 November 2009 5:21 PM To: 'tuscany-u...@ws.apache.org' Subject: SDO UnmarshalException Hi, We have a class called Descriptor that loads XML and XSD files to build SDO objects, this we are doing in its constructor. We have another class called Container that contains Descriptor class. If we make Container class object as Remotable (Exported as RMI object) and call a method on remotable object on RMI client side to get descriptor, it is throwing the following exception . The below "not found URI" is there in XML file. We are not getting what is the problem. Could you helps us here what is going wrong? BTW, we ensured all required interfaces as Remote so that there is nothing wrong on RMI side. java.rmi.UnmarshalException: error unmarshalling return; nested exception is: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http://www.abc.com/connex' not found. (http:///temp.xml, 3, 106) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at $Proxy8.getDescriptor(Unknown Source) at com.abc.connector.impl.infrastructure.rmi.RemoteRMIConnectorProxy.getDescriptor(RemoteRMIConnectorProxy.java:66) at com.abc.connector.impl.infrastructure.rmi.test.TestRMIConnector.setUpBeforeClass(TestRMIConnector.java:79) 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 org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74) at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) 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: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http://www.abc.com/connex' not found. (http:///temp.xml, 3, 106) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:589) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79) at org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readDataObject(HelperProviderBase.java:229) at org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readExternal(HelperProviderBase.java:161) at commonj.sdo.impl.ExternalizableDelegator.readExternal(ExternalizableDelegator.java:83) at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readDataObject(HelperProviderBase.java:238) at org.apache.tuscany.sdo.spi.HelperProviderBase$ResolvableImpl.readExternal(HelperProviderBase.java:161) at commonj.sdo.impl.ExternalizableDelegator.readExternal(ExternalizableDelegator.java:83) at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155) ... 19 more Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.abc.com/connex' not found. (http:///temp.xml, 3, 106) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2350) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2188) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTypeName(XMLHandler.java:1828) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:1787) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1569) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createDocumentRoot(XMLHandler.java:1237) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1165) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1247) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:883) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:405) 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:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268) ... 50 more Regards Raman