You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Bryan Hunt (JIRA)" <tu...@ws.apache.org> on 2007/05/18 15:34:16 UTC

[jira] Created: (TUSCANY-1293) SDO does not work with OSGi

SDO does not work with OSGi
---------------------------

                 Key: TUSCANY-1293
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-SDO-beta1
         Environment: OS X Eclipse 3.3 M7
            Reporter: Bryan Hunt
            Priority: Blocker


When I execute:

XSDHelper.INSTANCE.define(schema, null);

I end up with a NullPointerException.  I've tracked down root cause ...

The static initializer of the HelperProvider executes this code:

  provider = getInstance(HelperProvider.class.getClassLoader());

which ends up calling:

  HelperProvider provider = loadImplementation(cl, implName);

implName is null so

        if (implName == null) {
            implName = getImplementationName(cl);
        }

ends up calling

  implName = getImplementationName(cl);

which ends up calling:

  InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);

where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  

You can set

-Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl

to get around the above problem, but as soon as 

  return (HelperProvider) cl.loadClass(implName).newInstance();

executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.


 tried modifying the API manifest by hand to add

Eclipse-BuddyPolicy: dependent

and

Eclipse-BuddyPolicy: global


Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:


java.lang.ExceptionInInitializerError
at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
at java.lang.reflect.Field.get(Field.java:357)
at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
at notification.sdo.Application.start(Application.java:23)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
Caused by: java.lang.NullPointerException
at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
... 47 more


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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "bert.robben (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544783 ] 

bert.robben commented on TUSCANY-1293:
--------------------------------------

Do you want to go as far as automatically unregistering types when the bundle that contains the implementation classes becomes unavailable?

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568083#action_12568083 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

Amita,   I get clean build from a clean extraction.  Looking at runSDOTests()  for your run there ought to be 106 outputs to system.out of TestFalluire instances.  Can you take a look at these, and attach to the JIRA please?

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568126#action_12568126 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

I have applied your 2nd patch,  after seeing a clean build in my own environment.  I will now seek a continuum build

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi-export-patch.txt, sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar updated TUSCANY-1293:
-------------------------------------

    Fix Version/s:     (was: Java-SDO-Next)
                   Java-SDO-1.1

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-1.1
>
>         Attachments: sdo-osgi-export-patch.txt, sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Rajini Sivaram (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajini Sivaram updated TUSCANY-1293:
------------------------------------

    Attachment: sdo-osgi.txt

The attached patch sets up HelperProvider implementation when the SDO implementation bundle is loaded (in its bundle activator). Tests for running SDO in a multi-classloader environment and inside a Felix OSGi runtime have also been added. 

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567667#action_12567667 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

Rajini,
  sorry to take so long to get to this,  and thanks for the patch.  I'm working towards getting thsi in for the next release.  I note a couple of occasions in the tests where an exception is caught,  and then either output is made to the System.out,  or the exception is ignored.  Could you help me understand if in either of these cases the symptom is truly benign please?  If so i will add a comment to the code.  If not then I'll change to let the exception surface through the test infrastructure.

First is on OSGITestCase ...

		 // Start all the installed bundles
		 for (int i = 0; i < bundles.size(); i++) {
			 Bundle bundle = (Bundle)bundles.get(i);
			 try {
				bundle.start();
			} catch (Exception e) {
				e.printStackTrace();
				System.out.println("Could not start bundle " + bundle);
			}			 
		 }


second is in ClassLoaderTestCase  (I think I can see this is benign,  but could do with confirmation)

			for (int i = 0; i < parentLoaders.length; i++) {
				try {
					return parentLoaders[i].loadClass(className);					
				} catch (Exception e) {
				}
			}


> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568099#action_12568099 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

So it would seem that the failure is due to 106 repetitions of the same error,  reported to stdout as ...

Running org.apache.tuscany.sdo.test.osgi.OSGiTestCase
Runs 189, Errors: 106
testBasicsDO(org.apache.tuscany.sdo.test.ChangeSummaryOnDataObjectTestCase): org/xml/sax/ext/LexicalHandler
org/xml/sax/ext/LexicalHandler
testBasicsDG(org.apache.tuscany.sdo.test.ChangeSummaryOnDataObjectTestCase): org/xml/sax/ext/LexicalHandler
org/xml/sax/ext/LexicalHandler
......
......

investigating

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Rajini Sivaram (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajini Sivaram updated TUSCANY-1293:
------------------------------------

    Attachment: sdo-osgi-export-patch.txt

I have tried to recreate the problem with IBM JDK 1.4.2, 5.0 and 6.0, and the tests work fine with all of them with a clean build.

Based on the errors in continuum, the attached patch explictly exports/imports the packages that reported missing classes. I am not sure if they are sufficient to fix the test, but it is worth a try.



> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi-export-patch.txt, sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502730 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

I don't have a feel for how important this is for a next release,  and like Frank I don't have OSGi experience.  Can someone with a vested interest in this fix give an indication of the impact of this issue and ideally provide a solution.  That way it would have a chance of being fixed in the next release.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496882 ] 

Frank Budinsky commented on TUSCANY-1293:
-----------------------------------------

Hi Bryan,

Like I said before, I don't know much about OSGi, but my guess is something must be missing from in the MANIFEST.MF file (some kind of extension/extension_point information) that would make the impl bundle visible to the api bundle. This is just my guess anyway :-) 

Can you, or anyone with some OSGi expertise, please investigate and/or suggest a sollution, or better yet provide a patch?

Thanks,
Frank.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568078#action_12568078 ] 

Amita Vadhavkar commented on TUSCANY-1293:
------------------------------------------

-------------------------------------------------------------------------------
Test set: org.apache.tuscany.sdo.test.osgi.OSGiTestCase
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 8.469 sec <<< FAILURE!
test(org.apache.tuscany.sdo.test.osgi.OSGiTestCase)  Time elapsed: 8.438 sec  <<< ERROR!
org.osgi.framework.BundleException: Activator start error.
	at org.apache.felix.framework.Felix._startBundle(Felix.java:1580)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:354)
	at org.apache.tuscany.sdo.test.osgi.OSGiTestCase.test(OSGiTestCase.java:172)
Caused by: junit.framework.AssertionFailedError: expected:<0> but was:<106>
	at junit.framework.Assert.fail(Assert.java:47)
	at junit.framework.Assert.failNotEquals(Assert.java:282)
	at junit.framework.Assert.assertEquals(Assert.java:64)
	at junit.framework.Assert.assertEquals(Assert.java:201)
	at junit.framework.Assert.assertEquals(Assert.java:207)
	at org.apache.tuscany.sdo.test.osgi.TestBundleActivator.runSDOTests(TestBundleActivator.java:63)
	at org.apache.tuscany.sdo.test.osgi.TestBundleActivator.start(TestBundleActivator.java:40)
	at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
	at org.apache.felix.framework.Felix._startBundle(Felix.java:1536)
	... 29 more

Please see the exception during mvn

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson resolved TUSCANY-1293.
-------------------------------------

    Resolution: Fixed

Thanks for the patch Rajini.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568085#action_12568085 ] 

Amita Vadhavkar commented on TUSCANY-1293:
------------------------------------------

I am not clear about 106 outputs , but I see the same failure in [continuum] BUILD FAILURE: Apache Tuscany SDO Implementation Project latest mail.
Will you please check the details there?

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Rajini Sivaram (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568011#action_12568011 ] 

Rajini Sivaram commented on TUSCANY-1293:
-----------------------------------------

The first block tries to run bundle.start() on SDO bundles and its dependent bundles (EMF). It will throw an exception if one of these bundles could not be resolved. There is a testBundle.start() outside the loop which has dependencies on SDO (and hence on its dependencies). So if an exception is thrown by the loop, the following testBundle.start() will throw an uncaught exception ,causing the test to fail. I put the code to catch and print the exception from the loop rather than fail at the first exception so that all the bundles which failed to resolve can be identified in one run, rather than have to rerun after fixing one-by-one. The tests shouldn't really throw an exception now anyway, so please feel free to remove the try-catch block if you prefer.


The second catch block corresponds to delegation to the parent classloader during ClassLoader.loadClass(), and the exception there is deliberately caught and ignored (the child classloader loads the class if the parent classloader cannot). So the try-catch is necessary, and the exception doesn't reflect a failure.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568499#action_12568499 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

The patch seems to have fixed the continuum build issues.   http://vmbuild.apache.org/continuum/buildResult.action?buildId=49832&projectId=37

Amita,  please can you confirm you see the build as fixed.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi-export-patch.txt, sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Bryan Hunt (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503417 ] 

Bryan Hunt commented on TUSCANY-1293:
-------------------------------------

The fundamental issue is the use of class loaders.  This project (and others like it - Hibernate) assume that there is a single class loader and that all necessary classes can be found using this class loader.  This is fine until you want to use the technology with OSGi.  OSGi mandates one class loader per bundle.  When a class is loaded from a bundle, any classes the loaded class is dependent on must come from it's bundle, or a bundle that has been explicitly declared as a dependency it's MANIFEST.MF.  When you package something like SDO or hibernate as a bundle, there is no way to declare those dependencies.  

Eclipse has a "workaround" for this problem called the buddy policy.  There are various types of buddy policies that I won't discuss as you can find a much better explination by a simple google search on "eclipse buddy policy".  While this works for Eclipse, I don't believe it's part of the OSGi specification and won't work with other OSGi implementations.

For the sort term, you might consider removing the ability to build Eclipse plug-ins (OSGi bundles) from your pom.  For the long term, you might consider re-architecting the class loader to be compatible with OSGi.


> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by be...@agfa.com.
Do you want to go as far as automatically unregistering types when the 
bundle that contains the implementation classes becomes unavailable?


Bert




"Kelvin Goodson (JIRA)" <tu...@ws.apache.org> 
21/11/2007 12:16
Please respond to
tuscany-dev@ws.apache.org


To
tuscany-dev@ws.apache.org
cc

Subject
[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi








    [ 
https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544420 
] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

There's an offer of help from Rajini to get this fixed that's current on 
the tuscany-dev mailing list.  I'm actively trying to help Rajini with her 
request for info,  but if anyone watching this JRIA wan't to pitch in, 
please do so.
See http://marc.info/?l=tuscany-dev&m=119563682818977&w=2

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = 
"META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not 
exist in the API bundle.  It exists in the IMPL bundle and since you are 
using the class loader from the API bundle, it won't work. 
> You can set
> 
-Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you 
are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem 
(although I believe this is specific to eclipse and won't work for OSGi in 
general), but when HelperProvider is initializing, you get the following 
exception:
> java.lang.ExceptionInInitializerError
> at 
org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at 
org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at 
org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at 
org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at 
org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at 
org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at 
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at 
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at 
org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at 
org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at 
org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at 
org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at 
org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at 
org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at 
org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at 
org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at 
org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at 
commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at 
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at 
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at 
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at 
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at 
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at 
org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at 
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at 
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at 
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at 
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at 
org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at 
org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at 
org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at 
org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at 
org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at 
org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544420 ] 

Kelvin Goodson commented on TUSCANY-1293:
-----------------------------------------

There's an offer of help from Rajini to get this fixed that's current on the tuscany-dev mailing list.  I'm actively trying to help Rajini with her request for info,  but if anyone watching this JRIA wan't to pitch in,  please do so.
See http://marc.info/?l=tuscany-dev&m=119563682818977&w=2

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568889#action_12568889 ] 

Amita Vadhavkar commented on TUSCANY-1293:
------------------------------------------

yes, it's fixed now.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi-export-patch.txt, sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson updated TUSCANY-1293:
------------------------------------

    Patch Info: [Patch Available]

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>         Attachments: sdo-osgi.txt
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1293) SDO does not work with OSGi

Posted by "Bryan Hunt (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502889 ] 

Bryan Hunt commented on TUSCANY-1293:
-------------------------------------

I'll try to comment on this issue this weekend.  I've been swamped with work lately.

> SDO does not work with OSGi
> ---------------------------
>
>                 Key: TUSCANY-1293
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1293
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>         Environment: OS X Eclipse 3.3 M7
>            Reporter: Bryan Hunt
>            Priority: Blocker
>             Fix For: Java-SDO-Next
>
>
> When I execute:
> XSDHelper.INSTANCE.define(schema, null);
> I end up with a NullPointerException.  I've tracked down root cause ...
> The static initializer of the HelperProvider executes this code:
>   provider = getInstance(HelperProvider.class.getClassLoader());
> which ends up calling:
>   HelperProvider provider = loadImplementation(cl, implName);
> implName is null so
>         if (implName == null) {
>             implName = getImplementationName(cl);
>         }
> ends up calling
>   implName = getImplementationName(cl);
> which ends up calling:
>   InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);
> where SERVICE_RESORUCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"
> getResourceAsStream() return null because META-INF/services does not exist in the API bundle.  It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.  
> You can set
> -Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperProviderImpl
> to get around the above problem, but as soon as 
>   return (HelperProvider) cl.loadClass(implName).newInstance();
> executes, you get a CalssNotFoundException.  Again, this is because you are trying to load a class outside the bundle with the wrong class loader.
>  tried modifying the API manifest by hand to add
> Eclipse-BuddyPolicy: dependent
> and
> Eclipse-BuddyPolicy: global
> Either of those buddy policies will get past the class loader problem (although I believe this is specific to eclipse and won't work for OSGi in general), but when HelperProvider is initializing, you get the following exception:
> java.lang.ExceptionInInitializerError
> at org.apache.tuscany.sdo.impl.AttributeImpl.<clinit>(AttributeImpl.java:126)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl.createAttribute(SDOFactoryImpl.java:239)
> at org.apache.tuscany.sdo.impl.ClassImpl.<clinit>(ClassImpl.java:68)
> at org.apache.tuscany.sdo.impl.SDOFactoryImpl$SDOEcoreFactory.createEClass(SDOFactoryImpl.java:76)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createEClass(SDOPackageImpl.java:622)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.createPackageContents(SDOPackageImpl.java:550)
> at org.apache.tuscany.sdo.impl.SDOPackageImpl.init(SDOPackageImpl.java:259)
> at org.apache.tuscany.sdo.SDOPackage.<clinit>(SDOPackage.java:76)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
> at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
> at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
> at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.apache.tuscany.sdo.util.SDOUtil.registerStaticTypes(SDOUtil.java:196)
> at org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(ModelFactoryImpl.java:731)
> at org.apache.tuscany.sdo.model.ModelFactory.<clinit>(ModelFactory.java:41)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.getBuiltInModels(TypeHelperImpl.java:61)
> at org.apache.tuscany.sdo.helper.TypeHelperImpl.<init>(TypeHelperImpl.java:79)
> at org.apache.tuscany.sdo.helper.HelperContextImpl.<init>(HelperContextImpl.java:46)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.createDefaultHelpers(HelperProviderImpl.java:38)
> at org.apache.tuscany.sdo.rtlib.helper.HelperProviderBase.<init>(HelperProviderBase.java:78)
> at org.apache.tuscany.sdo.helper.HelperProviderImpl.<init>(HelperProviderImpl.java:31)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at commonj.sdo.impl.HelperProvider.loadImplementation(HelperProvider.java:157)
> at commonj.sdo.impl.HelperProvider.getInstance(HelperProvider.java:126)
> at commonj.sdo.impl.HelperProvider.<clinit>(HelperProvider.java:69)
> at commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:195)
> at notification.sdo.Application.start(Application.java:23)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 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:585)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:497)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:436)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1162)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1137)
> Caused by: java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.AttributeImpl.eStaticClass(AttributeImpl.java:73)
> at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:224)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseAdd(BasicEObjectImpl.java:1413)
> at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.eInverseAdd(EStructuralFeatureImpl.java:514)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1389)
> at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:282)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
> at org.eclipse.emf.ecore.impl.EPackageImpl.createEAttribute(EPackageImpl.java:745)
> at org.apache.tuscany.sdo.impl.FactoryBase.createDocumentRoot(FactoryBase.java:301)
> at org.apache.tuscany.sdo.impl.FactoryBase.initXSD(FactoryBase.java:156)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.createXSDMetaData(InternalFactoryImpl.java:211)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.initializeMetaData(InternalFactoryImpl.java:206)
> at org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init(InternalFactoryImpl.java:172)
> at org.apache.tuscany.sdo.model.internal.InternalFactory.<clinit>(InternalFactory.java:41)
> ... 47 more

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org