You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org> on 2010/10/08 10:53:32 UTC

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

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.


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

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930342#action_12930342 ] 

Sebastian Millies commented on TUSCANY-3708:
--------------------------------------------

Meantime I discovered why the XSD wins. It is registered first when the composite
is loaded. When one afterwards tries to register a generated factory, that will
have no effect, because the generated code for register() contains the following check:

  if (((HelperContextImpl)scope).getExtendedMetaData().getPackage(NAMESPACE_URI) != null)
    return;

If one comments out that check, the static factory will replace the metadata from the XSD.


> 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.


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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
    [ 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.


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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921307#action_12921307 ] 

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

On the second point I think that under the covers SDO is exteranlized to XML and hence the context on the client side needs to be initialized to read that XML back in correctly. Now I don't know if SDO can be configured to work in a different way. I'll have to defer to the SDO experts on that.

> 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.


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

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930343#action_12930343 ] 

Sebastian Millies commented on TUSCANY-3708:
--------------------------------------------

Please close this issue, as it is not a bug after all.

> 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.


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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921304#action_12921304 ] 

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

I'm told that SDO generates different things depending on what types you register and how. I may be over simplifying but this is what I think happens...

register an XSD = SDO generates DynamicDataObjectImpl 
register a static factory = SDO generates static  types
register nothing = SDO generates AnyTypeDataObject

I note that in the sample DataServiceImpl registers the static factory as follows

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

The composite file registers the XSD as follows

              <dbsdo:import.sdo location="SDOTypes/catalogBaseType.xsd"/>

I'm guessing that the XSD wins. If I comment out the xsd registration the static type is returned. 



> 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.


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

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920777#action_12920777 ] 

Sebastian Millies commented on TUSCANY-3708:
--------------------------------------------

That is only half the story. Even with your change, when you 
run the DataServiceLauncher with assertions enabled, you will still see
the SDO created with the wrong type in method DataServiceImpl#getData().

With regard to the second issue, that is apparently resolved with your
change, I am still not quite satisfied. Although explicitly registering 
the factory on the client side will recreate the object with the expected type,
why should this registration be necessary?

I thought it would work like this: When the client calls a service, it
really calls a generated proxy (returned from the RMI registry). This
proxy, having been generated on the server side in the first place, should 
already know that the SDO must be deserialized using the factory. Therefore,
it should suffice that the factory is on the client's classpath. Indeed, the client code
may want to treat the service result in a generic way (as in the example method
testGetData()) and not even care what concrete type it has and what factory
is needed to produce it. Do I really have to register every factory in every context
in my distributed application?


> 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.


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

Posted by "Sebastian Millies (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Millies updated TUSCANY-3708:
---------------------------------------

    Attachment: test.zip

Eclipse project containing an illustration of this problem, with test case

> 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.