Thanks a lot for that detailed response and for fixing the problem.
Unfortunately I am not able to build the jar file from the source.

At first I tried to build the whole project and it seemed to work.

But there was no jar file in the target folder of node-impl-osgi
So I tried:

cd trunk/modules/node-impl-osgi
mvn

Then I got following errors:

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Invoking Tuscany Eclipse JDT compiler
[INFO] Compiling 31 to
/Users/alb/Development/glassfish_ODYSSEUS/tuscany/tuscany_src_trunk/trunk/mo
dules/node-impl-osgi/target/classes
[INFO] Resolving OSGi bundle: org.apache.tuscany.sca.node.osgi.impl
[INFO] OSGi bundle is resolved: org.apache.tuscany.sca.node.osgi.impl
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Compilation failure

org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiHelper.java:[147,533
1] The method createOSGiProperties(ServiceReference) is undefined for the
type OSGiImplementationFactory
org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiHelper.java:[153,575
9] The method createOSGiProperty() in the type OSGiImplementationFactory is
not applicable for the arguments (String, Object)
org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java:[64,
2617] The method getStringValue() is undefined for the type OSGiProperty
org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.jav
a:[68,3250] Only a type can be imported.
org.apache.tuscany.sca.implementation.osgi.SCAConfig resolves to a package
org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.jav
a:[452,20706] SCAConfig cannot be resolved to a type
org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.jav
a:[452,20721] Type mismatch: cannot convert from element type E to SCAConfig
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[36,1359] Only a type can be imported.
org.apache.tuscany.sca.implementation.osgi.SCAConfig resolves to a package
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[143,5855] SCAConfig cannot be resolved to a type
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[144,5950] extender.scaConfigs cannot be resolved or is not a field
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[189,7527] SCAConfig cannot be resolved to a type
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[189,7565] SCAConfig cannot be resolved to a type
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[196,7857] SCAConfig cannot be resolved to a type
org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.jav
a:[197,7905] scaConfigs cannot be resolved


By the way I posted the NPE problem to the glassfish mailing list and one
developer also thinks that may be a bug in the hk2. He wants me to file a
bug...


Thanks,
Alex

Am 08.12.09 20:30 schrieb "Raymond Feng" unter <enjoyj...@gmail.com>:

> I fixed the ArrayIndexOutOfBound issue. See
> http://svn.apache.org/viewvc?rev=888534&view=rev.
> 
> Thanks,
> Raymond
> --------------------------------------------------
> From: "Raymond Feng" <enjoyj...@gmail.com>
> Sent: Tuesday, December 08, 2009 11:16 AM
> To: <user@tuscany.apache.org>
> Subject: Re: Glassfish and Tuscany
> 
>> Further investigation shows that GlassFish (HK2) is a bit aggressive to
>> get the service object when the OSGi service is registered. We use a
>> ServiceFactory to create a service proxy for the client bundle that calls
>> BundleContext.getService(ServiceReference ...). As a result, the bundle is
>> the HK2 which doesn't have access to the SCA component business interface.
>> So a null is returned to the getService() call and HK2 doesn't like that.
>> 
>>        public Object getService(Bundle bundle, ServiceRegistration
>> registration) {
>>            Class<?> interfaceClass = null;
>>            try {
>>                interfaceClass = bundle.loadClass(interfaceName);
>>            } catch (ClassNotFoundException e) {
>>                return null;
>>            }
>>            ...
>>        }
>> 
>> I'm not sure if you should get GlassFish to fix the NPE or we should try
>> to return a non-null dummy object to work around it. My understanding of
>> the OSGi API [1] is that it's possible that getService() returns a null.
>> 
>> [1] 
>> http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html#getSe
>> rvice(org.osgi.framework.ServiceReference)
>> 
>> Thanks,
>> Raymond
>> --------------------------------------------------
>> From: "Alexander Blotny" <alexander.blo...@fokus.fraunhofer.de>
>> Sent: Tuesday, December 08, 2009 8:22 AM
>> To: <user@tuscany.apache.org>
>> Subject: Glassfish and Tuscany
>> 
>>> Hi,
>>> 
>>> I am trying to run the tuscany framework in the glassfisch web container.
>>> So
>>> far I managed to start everything without errors or exceptions...
>>> 
>>> The tutorial for starting tuscany in felix helped a lot (I am using
>>> glassfish with Felix as OSGi framework).
>>> 
>>> Then I tried to use some examples but until now I run into several
>>> problems.
>>> 
>>> For example if I try the dosgi-dynamic-calculator example.
>>> I am starting the bundle with the shell console of felix and got
>>> following
>>> error:
>>> 
>>> java.lang.NullPointerException
>>>    at
>>> com.sun.hk2.component.ExistingSingletonInhabitant.<init>(ExistingSingletonIn
>>> habitant.java:54)
>>>    at
>>> org.jvnet.hk2.osgiadapter.HK2Main$HK2ServiceTrackerCustomizer.addingService(
>>> HK2Main.java:212)
>>>    at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker
>>> .java:896)
>>>    at
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
>>>    at 
>>> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
>>>    at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.j
>>> ava:840)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallbac
>>> k(EventDispatcher.java:878)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDi
>>> spatcher.java:732)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispat
>>> cher.java:662)
>>>    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3587)
>>>    at org.apache.felix.framework.Felix.access$000(Felix.java:40)
>>>    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:625)
>>>    at
>>> org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.j
>>> ava:97)
>>>    at org.apache.felix.framework.Felix.registerService(Felix.java:2711)
>>>    at
>>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextIm
>>> pl.java:252)
>>>    at
>>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextIm
>>> pl.java:230)
>>>    at
>>> org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProvide
>>> r$1.run(OSGiImplementationProvider.java:125)
>>>    at
>>> org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProvide
>>> r$1.run(OSGiImplementationProvider.java:1)
>>>    at java.security.AccessController.doPrivileged(Native Method)
>>>    at
>>> org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProvide
>>> r.start(OSGiImplementationProvider.java:120)
>>>    at
>>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo
>>> siteActivatorImpl.java:510)
>>>    at
>>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo
>>> siteActivatorImpl.java:475)
>>>    at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:148)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiServiceImporter.impo
>>> rtService(OSGiServiceImporter.java:71)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.RemoteServiceAdminImpl.i
>>> mportService(RemoteServiceAdminImpl.java:265)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.TopologyManagerImpl.impo
>>> rtService(TopologyManagerImpl.java:369)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.TopologyManagerImpl.endp
>>> ointAdded(TopologyManagerImpl.java:336)
>>>    at
>>> org.apache.tuscany.sca.osgi.service.discovery.impl.AbstractDiscoveryService.
>>> triggerCallbacks(AbstractDiscoveryService.java:197)
>>>    at
>>> org.apache.tuscany.sca.osgi.service.discovery.impl.AbstractDiscoveryService.
>>> endpointChanged(AbstractDiscoveryService.java:274)
>>>    at
>>> org.apache.tuscany.sca.osgi.service.discovery.impl.DomainDiscoveryService.en
>>> dpointAdded(DomainDiscoveryService.java:90)
>>>    at
>>> org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryImpl.addEndpoint(E
>>> ndpointRegistryImpl.java:50)
>>>    at
>>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo
>>> siteActivatorImpl.java:543)
>>>    at
>>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo
>>> siteActivatorImpl.java:475)
>>>    at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:148)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiServiceExporter.expo
>>> rtService(OSGiServiceExporter.java:96)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.RemoteServiceAdminImpl.e
>>> xportService(RemoteServiceAdminImpl.java:123)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.TopologyManagerImpl.expo
>>> rtService(TopologyManagerImpl.java:181)
>>>    at
>>> org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.TopologyManagerImpl.addi
>>> ngService(TopologyManagerImpl.java:147)
>>>    at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker
>>> .java:896)
>>>    at
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
>>>    at 
>>> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
>>>    at
>>> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.j
>>> ava:840)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallbac
>>> k(EventDispatcher.java:878)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDi
>>> spatcher.java:732)
>>>    at
>>> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispat
>>> cher.java:662)
>>>    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3587)
>>>    at org.apache.felix.framework.Felix.access$000(Felix.java:40)
>>>    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:625)
>>>    at
>>> org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.j
>>> ava:97)
>>>    at org.apache.felix.framework.Felix.registerService(Felix.java:2711)
>>>    at
>>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextIm
>>> pl.java:252)
>>>    at
>>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextIm
>>> pl.java:230)
>>>    at
>>> calculator.dosgi.operations.impl.OperationsActivator.start(OperationsActivat
>>> or.java:68)
>>>    at
>>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
>>> a:640)
>>>    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
>>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
>>>    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
>>>    at
>>> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:1
>>> 14)
>>>    at
>>> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activa
>>> tor.java:286)
>>>    at org.apache.felix.shell.remote.Shell.run(Shell.java:109)
>>>    at java.lang.Thread.run(Thread.java:637)
>>> 
>>> 
>>> Furthermore I tried to register a simple service (did nothing than
>>> returning
>>> a value) as a web service via osgi bundle activator:
>>> 
>>> Node node;
>>> 
>>> public void start(BundleContext arg0) throws Exception {
>>>    node = NodeFactory.newInstance().createNode("bundle.composite",
>>> this.getClass().getClassLoader());
>>> 
>>>    node.start();
>>> }
>>> 
>>> public void stop(BundleContext arg0) throws Exception {
>>>    node.stop();
>>> }
>>> 
>>> I got the following error:
>>> 
>>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>>>    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
>>>    at java.util.ArrayList.get(ArrayList.java:322)
>>>    at
>>> org.apache.tuscany.sca.node.osgi.impl.OSGiNodeFactoryImpl.getNodeKey(OSGiNod
>>> eFactoryImpl.java:129)
>>>    at
>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.addNode(NodeFactoryImpl.jav
>>> a:113)
>>>    at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:115)
>>>    at launch.Launch.start(Launch.java:16)
>>>    at
>>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
>>> a:640)
>>>    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
>>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
>>>    at 
>>> org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1241)
>>>    at
>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:270)
>>>    at java.lang.Thread.run(Thread.java:637)
>>> |#]
>>> 
>>> 
>>> I also tried the cloud example (
>>> https://svn.apache.org/repos/asf/tuscany/sandbox/sca-cloud-tutorial/)
>>> mentioned before in this mailing list. When I deploy the war file
>>> (store-catalog-ibmcloud-webapp.war) and point on the index.html file
>>> there
>>> is the same IndexOutOfBounsException as above.
>>> 
>>> Does anyone has experience in combining glassfish and tuscany?
>>> 
>>> Thanks
>>> Alex
>>> 

Reply via email to