On Thu, Jun 3, 2010 at 9:38 AM, Alexander Blotny
<alexander.blo...@fokus.fraunhofer.de> wrote:
> Hi,
>
> I already filed this issue to
> https://issues.apache.org/jira/browse/TUSCANY-3567
>
> At this time I tried only with Apache Felix to launch the example.
> Today I gave it a try to use the shipped equinox via:
>
> java -jar osgi-3.5.0-v20090520.jar -clean -console -configuration
> ..\features\configuration
>
> When I want to start the sample following error appears (the same as in the
> JIRA):
>
> 03.06.2010 10:26:11 org.apache.tuscany.sca.node.impl.NodeImpl start
> INFO: Starting node: http://tuscany.apache.org/sca/1.1/nodes/default0
> domain: tuscany.apache.org
> 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 calculator.CalculatorActivator.start(CalculatorActivator.java:42)
>    at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleConte
> xtImpl.java:782)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(Bu
> ndleContextImpl.java:773)
>    at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleConte
> xtImpl.java:754)
>    at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.j
> ava:352)
>    at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.updateWorker(Abstrac
> tBundle.java:625)
>    at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundl
> e.java:572)
>    at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundl
> e.java:555)
>    at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._update(Fr
> ameworkCommandProvider.java:380)
>    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:597)
>    at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute
> (FrameworkCommandInterpreter.java:155)
>    at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Framewor
> kConsole.java:303)
>    at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkC
> onsole.java:288)
>    at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConso
> le.java:224)
>    at java.lang.Thread.run(Thread.java:637)
>
> Does anyone before used the Activator to launch an SCA composite?
>
> The code looks like this:
>
>    public void start(BundleContext context) throws Exception {
>        try {
>            NodeFactory factory = NodeFactory.newInstance();
>            String url =
> ContributionLocationHelper.getContributionLocation(getClass());
>            Contribution contrib = new Contribution("c1", url);
>            node = factory.createNode("Calculator.composite", contrib);
>            node.start();
>        } catch (Throwable e) {
>            e.printStackTrace();
>        }
>    }
>
> Is there anything wrong?
>
> I am really stuck on this problem as I have to present some progress next
> week. My objective is to to integrate SCA functionality in our framework
> which is based on OSGi.
>
> If someone can help me on this issue I would appreciate that...
>
> Thanks,
> Alex
>
>

Hi Alex

Sorry it's taken me a long time to get to 3567 although I have fixed a
few related OSGi issues on the route to the M5 release.

I just ran up the calculator-osgi sample from the very latest trunk/M5
branch code by doing the following...

java -jar ..\..\modules\osgi-3.5.0-v20090520.jar -configuration
..\..\features\configuration -clean -console
install file:./target/sample-calculator-osgi.jar
start ???

the result was as follows...

osgi> start 264
03-Jun-2010 10:27:01 org.apache.tuscany.sca.node.impl.NodeImpl start
INFO: Starting node: http://tuscany.apache.org/sca/1.1/nodes/default0 domain: de
fault
03-Jun-2010 10:27:01 org.apache.tuscany.sca.core.DefaultModuleActivatorExtension
Point start
SEVERE: java.lang.IllegalStateException: org.objectweb.howl.log.LogConfiguration
Exception: LogFileManager.open: unable to obtain lock on file D:\sca-java-2.x\di
stribution\all\target\apache-tuscany-sca-all-2.0-SNAPSHOT.dir\tuscany-sca-2.0-SN
APSHOT\samples\calculator-osgi\target\logs\transaction_1.log
java.lang.IllegalStateException: java.lang.IllegalStateException: org.objectweb.
howl.log.LogConfigurationException: LogFileManager.open: unable to obtain lock o
n file D:\sca-java-2.x\distribution\all\target\apache-tuscany-sca-all-2.0-SNAPSH
OT.dir\tuscany-sca-2.0-SNAPSHOT\samples\calculator-osgi\target\logs\transaction_
1.log
        at org.apache.tuscany.sca.policy.transaction.runtime.geronimo.Transactio
nModuleActivator.start(TransactionModuleActivator.java:59)
        at org.apache.tuscany.sca.core.DefaultModuleActivatorExtensionPoint.star
t(DefaultModuleActivatorExtensionPoint.java:130)
        at org.apache.tuscany.sca.extensibility.ServiceHelper.start(ServiceHelpe
r.java:46)
        at org.apache.tuscany.sca.core.DefaultExtensionPointRegistry.addExtensio
nPoint(DefaultExtensionPointRegistry.java:75)
        at org.apache.tuscany.sca.core.DefaultExtensionPointRegistry.getExtensio
nPoint(DefaultExtensionPointRegistry.java:110)
        at org.apache.tuscany.sca.node.impl.NodeFactoryImpl.init(NodeFactoryImpl
.java:259)
        at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:106)
        at calculator.CalculatorActivator.start(CalculatorActivator.java:41)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(Bund
leContextImpl.java:782)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:773)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:754)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:352)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:280)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:272)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._st
art(FrameworkCommandProvider.java:253)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.
execute(FrameworkCommandInterpreter.java:155)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(F
rameworkConsole.java:303)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Fra
meworkConsole.java:288)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(Framewo
rkConsole.java:224)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: org.objectweb.howl.log.LogConfigurat
ionException: LogFileManager.open: unable to obtain lock on file D:\sca-java-2.x
\distribution\all\target\apache-tuscany-sca-all-2.0-SNAPSHOT.dir\tuscany-sca-2.0
-SNAPSHOT\samples\calculator-osgi\target\logs\transaction_1.log
        at org.apache.tuscany.sca.policy.transaction.runtime.geronimo.Transactio
nManagerWrapper.start(TransactionManagerWrapper.java:69)
        at org.apache.tuscany.sca.policy.transaction.runtime.geronimo.Transactio
nModuleActivator.start(TransactionModuleActivator.java:57)
        ... 24 more
Caused by: org.objectweb.howl.log.LogConfigurationException: LogFileManager.open
: unable to obtain lock on file D:\sca-java-2.x\distribution\all\target\apache-t
uscany-sca-all-2.0-SNAPSHOT.dir\tuscany-sca-2.0-SNAPSHOT\samples\calculator-osgi
\target\logs\transaction_1.log
        at org.objectweb.howl.log.LogFileManager.open(LogFileManager.java:782)
        at org.objectweb.howl.log.Logger.open(Logger.java:303)
        at org.objectweb.howl.log.xa.XALogger.open(XALogger.java:893)
        at org.apache.geronimo.transaction.log.HOWLLog.doStart(HOWLLog.java:224)

        at org.apache.tuscany.sca.policy.transaction.runtime.geronimo.Transactio
nManagerWrapper.start(TransactionManagerWrapper.java:66)
        ... 25 more
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyLogger info
INFO: jetty-6.1.x
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyLogger info
INFO: Started selectchannelconnec...@0.0.0.0:8080
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
ping
INFO: Added Servlet mapping: http://9.20.188.170:8080/dojo
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
ping
INFO: Added Servlet mapping: http://9.20.188.170:8080/dojo/*
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
ping
INFO: Added Servlet mapping: http://9.20.188.170:8080/tuscany
03-Jun-2010 10:27:01 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
ping
INFO: Added Servlet mapping: http://9.20.188.170:8080/tuscany/*
03-Jun-2010 10:27:02 org.apache.tuscany.sca.node.impl.NodeFactoryImpl loadContri
butions
INFO: Loading contribution: file:/D:/sca-java-2.x/distribution/all/target/apache
-tuscany-sca-all-2.0-SNAPSHOT.dir/tuscany-sca-2.0-SNAPSHOT/features/configuratio
n/org.eclipse.osgi/bundles/264/1/bundlefile
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@27425423)Endpoint:  URI = CalculatorServiceComponent#serv
ice-binding(CalculatorServiceImpl/CalculatorServiceImpl)
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@1861120)Endpoint:  URI = AddServiceComponent#service-bind
ing(AddServiceImpl/AddServiceImpl)
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@7119270)Endpoint:  URI = SubtractServiceComponent#service
-binding(SubtractServiceImpl/SubtractServiceImpl)
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@32030582)Endpoint:  URI = MultiplyServiceComponent#servic
e-binding(MultiplyServiceImpl/MultiplyServiceImpl)
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@24243550)Endpoint:  URI = DivideServiceComponent#service-
binding(DivideServiceImpl/DivideServiceImpl)
03-Jun-2010 10:27:05 org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryI
mpl addEndpoint
INFO: Add endpoint - (@9884354)Endpoint:  URI = CalculatorClient#service-binding
(CalculatorClient/CalculatorClient)
SCA API ClassLoader: org.eclipse.osgi.internal.baseadaptor.defaultclassloa...@71
9f1f
3 + 2=5.0
3 - 2=1.0
3 * 2=6.0
3 / 2=1.5

osgi>

So I'm seeing this transaction.log error reported elsewhere but I'm no
longer seeing the index out of bounds problem you're seeing.

What I'd like to have you do is to re-try the sample on M5-RC2 when
Kelvin creates that (hopefully later today) and see if you have more
success.

Re. the use of the Node API in the Activator question. There is not
particular reason why you can't use the Node API in this way in the
OSGi environment.

There there is some tighter integration between the Tuscany SCA
runtime and OSGi based on the new OSGi remote services specification.
I'm not completely up to speed myself on precisely how contribution
bundles are detected and launched in this environment however the
dosgi samples show this in action if you're interested

Regards.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to