You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Laws (JIRA)" <de...@tuscany.apache.org> on 2010/10/13 12:20:33 UTC

[jira] Commented: (TUSCANY-3708) SDO created with wrong type & errors on deserialization

    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920497#action_12920497 ] 

Simon Laws commented on TUSCANY-3708:
-------------------------------------

thanks for the example Sebastien

I note that you set the HelpContext up in the component impl but not in the DataServiceRMITest. I copied the following lines to the "setUpBeforeClass" method...

		HelperContext helperContext = HelperProvider.getDefaultContext();
		CatalogBaseTypeFactory.INSTANCE.register( helperContext );

With this the output is...

------------ SDO
com.softwareag.psp.catalog.base.type.CatalogBaseType
------------  SDO
com.softwareag.psp.catalog.base.type.CatalogBaseType

Is that what was expected?

> SDO created with wrong type & errors on deserialization
> -------------------------------------------------------
>
>                 Key: TUSCANY-3708
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3708
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.1
>         Environment: Tuscany 1.6 resp 1.7 snapshot, JDK 1.6.0_21, Eclipse Helios, Windows XP
>            Reporter: Sebastian Millies
>         Attachments: test.zip
>
>
> Creation of static SDOs for which classes have been generated from XSD does not work as expected. 
> In particular, I created a data object for a type which has a statically generated class, but unexpectedly 
> got back an instance of DynamicDataObjectImpl. 
> A trelated error maybe that even when I create the static SDO directly from the factory, when I later
> try to return it over an XMI binding, I get a PackageNotFoundException.
> Here are the details:
>  I created the types using XSD2JavaGenerator from this XSD:
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://psp.softwareag.com/catalogBaseType" 
> xmlns:catalogBaseType="http://psp.softwareag.com/catalogBaseType">
>     <complexType name="CatalogBaseType">
>         <attribute name="id" type="string"></attribute>
>         <attribute name="catalogID" type="string"></attribute>
>       <attribute name="fileName" type="string"></attribute>
>       <attribute name="catalogName" type="string"></attribute>
>       <attribute name="catalogStatus" type="string"></attribute>
>       <attribute name="supplierID" type="string"></attribute>
>       <attribute name="eclassVersion" type="string"></attribute>
>     </complexType>
>     <element name="catalogBaseType" type="catalogBaseType:CatalogBaseType"></element>
> </schema>
> The classes get generated in package com.softwareag.psp.catalog.base.type. I generated no interfaces ( I
> ran XSD2JavaGenerator with the following options: -noInterfaces  -noNotification -noUnsettable -prefix). 
> I have called the generated factory CatalogBaseTypeFactory.
> Then in my coding (SCA service implementation) I do the following:
> a)    statically register the factory with the default context
> static {
>             helperContext = HelperProvider.getDefaultContext();
>             CatalogBaseTypeFactory.INSTANCE.register( helperContext );
>    }
> b)    create a data object from the targetNamespace of the XSD and the type name
> DataObject obj = helperContext.getDataFactory().create(
> "http://psp.softwareag.com/catalogBaseType", "CatalogBaseType");
> Unexpectedly obj is an instance of DynamicDataObjectImpl, where I would have expected an instance 
> of CatalogBaseType instead.
> When I call the service that returns this SDO using a Java RMI client, I also get an exception when trying to 
> deserialize the dynamic data object:
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http://psp.softwareag.com/catalogBaseType' not found. (http:///temp.xml, 5, 24)
> which is caused by an underlying org.eclipse.emf.ecore.xmi.PackageNotFoundException.
> (see also my previous post with subject "SDO deserialization error")
> This exception also occurs when I use a SDO of the correct type created with a call to the CatalogBaseTypeFactory.
> Frank Budinsky commented on this on the mailing list:
> >From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> >Sent: Thursday, October 07, 2010 3:30 PM
> >To: user@tuscany.apache.org
> >Subject: Re: SDO instance creation and deserialization error
> >
> >I think that should work, so my only guess is that maybe the SCA component and runtime are not using the same classLoader and/or >HelperContext (scope). Maybe someone with more SCA knowledge can help.
> >
> >Frank.
> However, I suppose that the first problem (wrong type of SDO created) probably is not connected to SCA,
> because there is no SCA code involved. It doesn't matter for this problem what context the SCA runtime
> uses, because I use the default SDO context directly when registering the Factory and creating 
> the SDO.
> The second problem (the  PackageNotFoundException upon deserialization) may have to do with SCA, 
> because there is a mediating SCA transformer. 
> I attach an Eclipse project with the xsd, the generated classes and a test case.
> When you start the com.softwareag.DataServiceLauncher with assertions enabled (-ea) and then run
> com.softwareag.client.DataServiceRMITest, you will see
> a) the AssertionError in com.softwareag.impl.DataServiceImpl for the SDO with unexpected type in test case testGetData()
> b) the Exception on the client side when trying to receive the static SDO in test case testGetCatalogData()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.