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#getService(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