You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Brad Cox <bc...@virtualschool.edu> on 2009/03/22 13:41:02 UTC

tuscany.sdo???

I'm trying to use tuscany-sdo-1.1 but everything I try seems to fail. Is 
this project supposed to be working?

--------------------------------------------------------------
- Running with commentary level for a novice user            -
- Edit the sample program's constructor argument to one from -
- COMMENTARY_FOR_NOVICE                                      -
- COMMENTARY_FOR_INTERMEDIATE or                             -
- COMMENTARY_FOR_ADVANCED                                    -
- in order to alter the level of commentary you are seeing   -
--------------------------------------------------------------

--------------------------------------------------------------------------------
------------
-     Tuscany SDO Java Sample 
org.apache.tuscany.samples.sdo.basic.CreatePurchas
eOrder     -
-     This sample is aimed at a novice user 

            -
--------------------------------------------------------------------------------
------------

------------------------------------------------------------------------------
- This sample is based upon Fuhwei Lwo's paper 
      -
- 
http://www-128.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/ -
- and demonstrates creating a purchaseOrder DataObject from an 
      -
- existing XSD and then persisting to disk. 
      -
------------------------------------------------------------------------------

--------------------------------------------------------------------------------
----------------
- All MetaData for SDO types can be viewed as being scoped within an 
instance of
  HelperContext -
- The Helper Context instance provides access to a collection of other 
helpers
                -
- that you will see exercised in the SDO samples 

                -
- All the Helpers related to a given helper context instance know about 
the same
  set of types  -
- 

                -
- The SDO specification doesn't state how an SDO implementation should 
create a
HelperContext  -
- So we use a Tuscany specific API to do this ... 

                -
- 

                -
- HelperContext scope = SDOUtil.createHelperContext(); 

                -
--------------------------------------------------------------------------------
----------------

------------------------------------------------------------------------------
- If you want to create types dynamically by loading an XML schema you 
      -
- use an instance of XSDHelper. You get that helper from a 
HelperContext.    -
- After successful loading of a schema, the new types are available to 
every -
- other helper belonging to the HelperContext instance 
      -
- 
      -
- XSDHelper xsdHelper = scope.getXSDHelper(); 
      -
- xsdHelper.define(inputStream, null); 
      -
------------------------------------------------------------------------------

java.lang.NullPointerException
	at 
org.apache.crimson.tree.ElementNode2.getAttributeNodeNS(ElementNode2.java:43
2)
	at 
org.apache.crimson.tree.ElementNode2.hasAttributeNS(ElementNode2.java:388)
	at 
org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getEcoreAttribute(SDOXSDEco
reBuilder.java:433)
	at 
org.eclipse.xsd.ecore.XSDEcoreBuilder.getEcoreAttribute(XSDEcoreBuilder.java
:2758)
	at 
org.apache.tuscany.sdo.helper.BaseSDOXSDEcoreBuilder.getEStructuralFeature(B
aseSDOXSDEcoreBuilder.java:1621)
	at 
org.apache.tuscany.sdo.helper.BaseSDOXSDEcoreBuilder.generate(BaseSDOXSDEcor
eBuilder.java:1674)
	at 
org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:246)
	at 
org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:224)
	at 
org.apache.tuscany.samples.sdo.SampleBase.loadTypesFromXMLSchemaFile(SampleB
ase.java:113)
	at 
org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.runSample(CreatePur
chaseOrder.java:80)
	at 
org.apache.tuscany.samples.sdo.internal.SampleInfrastructure.run(SampleInfra
structure.java:311)
	at 
org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.main(CreatePurchase
Order.java:66)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!
! Something unexpected has gone wrong with the execution of this sample 
program
                !
! Please take a look at the exception and see if its something wrong 
with your e
nvironment     !
! If you can't figure it out please send a note to the 
tuscany-user@ws.apache.or
g mailing list !
! including the text of the exception and any other useful information, 
thanks
                !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!

java.lang.IllegalArgumentException
	at 
org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:263)
	at 
org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:224)
	at 
org.apache.tuscany.samples.sdo.SampleBase.loadTypesFromXMLSchemaFile(SampleB
ase.java:113)
	at 
org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.runSample(CreatePur
chaseOrder.java:80)
	at 
org.apache.tuscany.samples.sdo.internal.SampleInfrastructure.run(SampleInfra
structure.java:311)
	at 
org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.main(CreatePurchase
Order.java:66)
--------------------------------------------------------------------------------
----------------------
- We are creating a DataObject using a DataFactory by specifying the URI 
and nam
e of                 -
- the Type that we want to use for the DataObject. 

                      -
- 

                      -
- DataFactory factory = scope.getDataFactory(); 

                      -
- DataObject purchaseOrder = 
factory.create(SampleInfrastructure.PO_NAMESPACE, "
PurchaseOrderType"); -
--------------------------------------------------------------------------------
----------------------


Re: tuscany.sdo???

Posted by Raymond Feng <en...@gmail.com>.
Hi,

You hit a known bug with Crimson DOM. Tuscany SDO is implemented on top of
EMF. See:

http://wiki.eclipse.org/MDT/XSD/FAQ/Sun_JDK14_Crimson_DOM

Please use a different DOM parser such as Apache Xerces.
Thanks,
Raymond
On Sun, Mar 22, 2009 at 5:41 AM, Brad Cox <bc...@virtualschool.edu> wrote:

> I'm trying to use tuscany-sdo-1.1 but everything I try seems to fail. Is
> this project supposed to be working?
>
> --------------------------------------------------------------
> - Running with commentary level for a novice user            -
> - Edit the sample program's constructor argument to one from -
> - COMMENTARY_FOR_NOVICE                                      -
> - COMMENTARY_FOR_INTERMEDIATE or                             -
> - COMMENTARY_FOR_ADVANCED                                    -
> - in order to alter the level of commentary you are seeing   -
> --------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> ------------
> -     Tuscany SDO Java Sample
> org.apache.tuscany.samples.sdo.basic.CreatePurchas
> eOrder     -
> -     This sample is aimed at a novice user
>           -
>
> --------------------------------------------------------------------------------
> ------------
>
>
> ------------------------------------------------------------------------------
> - This sample is based upon Fuhwei Lwo's paper     -
> -
> http://www-128.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/-
> - and demonstrates creating a purchaseOrder DataObject from an     -
> - existing XSD and then persisting to disk.     -
>
> ------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> ----------------
> - All MetaData for SDO types can be viewed as being scoped within an
> instance of
>  HelperContext -
> - The Helper Context instance provides access to a collection of other
> helpers
>               -
> - that you will see exercised in the SDO samples
>               -
> - All the Helpers related to a given helper context instance know about the
> same
>  set of types  -
> -
>               -
> - The SDO specification doesn't state how an SDO implementation should
> create a
> HelperContext  -
> - So we use a Tuscany specific API to do this ...
>               -
> -
>               -
> - HelperContext scope = SDOUtil.createHelperContext();
>               -
>
> --------------------------------------------------------------------------------
> ----------------
>
>
> ------------------------------------------------------------------------------
> - If you want to create types dynamically by loading an XML schema you
> -
> - use an instance of XSDHelper. You get that helper from a HelperContext.
>  -
> - After successful loading of a schema, the new types are available to
> every -
> - other helper belonging to the HelperContext instance     -
> -     -
> - XSDHelper xsdHelper = scope.getXSDHelper();     -
> - xsdHelper.define(inputStream, null);     -
>
> ------------------------------------------------------------------------------
>
> java.lang.NullPointerException
>        at
> org.apache.crimson.tree.ElementNode2.getAttributeNodeNS(ElementNode2.java:43
> 2)
>        at
> org.apache.crimson.tree.ElementNode2.hasAttributeNS(ElementNode2.java:388)
>        at
> org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getEcoreAttribute(SDOXSDEco
> reBuilder.java:433)
>        at
> org.eclipse.xsd.ecore.XSDEcoreBuilder.getEcoreAttribute(XSDEcoreBuilder.java
> :2758)
>        at
> org.apache.tuscany.sdo.helper.BaseSDOXSDEcoreBuilder.getEStructuralFeature(B
> aseSDOXSDEcoreBuilder.java:1621)
>        at
> org.apache.tuscany.sdo.helper.BaseSDOXSDEcoreBuilder.generate(BaseSDOXSDEcor
> eBuilder.java:1674)
>        at
> org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:246)
>        at
> org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:224)
>        at
> org.apache.tuscany.samples.sdo.SampleBase.loadTypesFromXMLSchemaFile(SampleB
> ase.java:113)
>        at
> org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.runSample(CreatePur
> chaseOrder.java:80)
>        at
> org.apache.tuscany.samples.sdo.internal.SampleInfrastructure.run(SampleInfra
> structure.java:311)
>        at
> org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.main(CreatePurchase
> Order.java:66)
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!!!!!!!!!!!!!!!
> ! Something unexpected has gone wrong with the execution of this sample
> program
>               !
> ! Please take a look at the exception and see if its something wrong with
> your e
> nvironment     !
> ! If you can't figure it out please send a note to the
> tuscany-user@ws.apache.or
> g mailing list !
> ! including the text of the exception and any other useful information,
> thanks
>               !
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!!!!!!!!!!!!!!!
>
> java.lang.IllegalArgumentException
>        at
> org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:263)
>        at
> org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:224)
>        at
> org.apache.tuscany.samples.sdo.SampleBase.loadTypesFromXMLSchemaFile(SampleB
> ase.java:113)
>        at
> org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.runSample(CreatePur
> chaseOrder.java:80)
>        at
> org.apache.tuscany.samples.sdo.internal.SampleInfrastructure.run(SampleInfra
> structure.java:311)
>        at
> org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder.main(CreatePurchase
> Order.java:66)
>
> --------------------------------------------------------------------------------
> ----------------------
> - We are creating a DataObject using a DataFactory by specifying the URI
> and nam
> e of                 -
> - the Type that we want to use for the DataObject.
>                     -
> -
>                     -
> - DataFactory factory = scope.getDataFactory();
>                     -
> - DataObject purchaseOrder =
> factory.create(SampleInfrastructure.PO_NAMESPACE, "
> PurchaseOrderType"); -
>
> --------------------------------------------------------------------------------
> ----------------------
>
>