Hi, I have tried a few permutations of this and it doesn't appear to be
functioning unless I change the @Service and remove the multiple interfaces.
I did notice that I did not correctly specify the componentName/seviceName
the first time. I left off the componentName. However when I add the
component name as specified in the default.scdl I receive an exception. I
assume the componentName will be taken for the
default.scdl and the serviceName's will be derived from the @Service
interface class names resulting in the string specified below?
Here is the client locate()
aConversationsClient = CurrentCompositeContext.*getContext*
().locateService(ConversationsClient.*class*, C
onversationsClient/ConversationsClient");
The @Service annotation:
@Service(interfaces={ConversationsClient.*class*,ConversationsClient2.*class
*})
The class definition: (note this client component also impliments a callback
interface)
*
public* *class* ConversationsClientImpl *implements* ConversationsClient,
ConversationsClient2, ConversationsCallback {
The default.scdl:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="ConversationsTest">
<component name="ConversationsClient">
<implementation.java class="
org.apache.tuscany.sca.test.ConversationsClientImpl"/>
<reference name="aService">
ConversationsService
</reference>
<reference name="anotherService">
AnotherService
</reference>
<reference name="aLifeCycleService">
ConversationLifeCycleService
</reference>
</component>
<component name="ConversationsService">
<implementation.java class="
org.apache.tuscany.sca.test.ConversationsServiceImpl"/>
</component>
<component name="AnotherService">
<implementation.java class="org.apache.tuscany.sca.test.AnotherServiceImpl
"/>
</component>
<component name="ConversationLifeCycleService">
<implementation.java class="
org.apache.tuscany.sca.test.ConversationsLifeCycleServiceImpl"/>
</component>
</composite>
The exception:
-------------------------------------------------------------------------------
Test set: org.apache.tuscany.sca.test.ConversationsITest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.01 sec <<<
FAILURE!
testConversations(org.apache.tuscany.sca.test.ConversationsITest) Time
elapsed: 0.01 sec <<< ERROR!
org.apache.tuscany.spi.component.TargetNotFoundException:
ConversationsClient/ConversationsClient
Context stack trace: [application]
at
org.apache.tuscany.spi.extension.CompositeComponentExtension.locateService(
CompositeComponentExtension.java:270)
at org.apache.tuscany.core.launcher.CompositeContextImpl.locateService(
CompositeContextImpl.java:65)
at org.apache.tuscany.sca.test.ConversationsITest.setUp(
ConversationsITest.java:17)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java
:210)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
AbstractDirectoryTestSuite.java:122)
at org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.run(
TuscanyITestMojo.java:122)
at org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.runSurefire(
TuscanyITestMojo.java:88)
at org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.execute(
TuscanyITestMojo.java:77)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:534)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:475)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:454)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
On 12/18/06, Jeremy Boynes (JIRA) <[email protected]> wrote:
[
http://issues.apache.org/jira/browse/TUSCANY-1000?page=comments#action_12459432]
Jeremy Boynes commented on TUSCANY-1000:
----------------------------------------
This should happen if you do not specify componentName/serviceName in the
call to locateService.
Please could you attach the code where you make that call (showing the
name passed in).
> Components do not support multiple services
> -------------------------------------------
>
> Key: TUSCANY-1000
> URL: http://issues.apache.org/jira/browse/TUSCANY-1000
> Project: Tuscany
> Issue Type: Bug
> Affects Versions: Java-M2
> Reporter: Lou Amodeo
>
> I have a component that implements multiple service interfaces at
runtime the locateService() receives an exception indicating that components
can only have 1 service. The C&I spec states that a component can declare
using @Service an array of interfaces.
> @Service(interfaces={ConversationsClient.class,
ConversationsClient2.class})
> public class ConversationsClientImpl implements ConversationsClient,
ConversationsClient2, ConversationsCallback {
>
-------------------------------------------------------------------------------
> Test set: org.apache.tuscany.sca.test.ConversationsITest
>
-------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.02 sec
<<< FAILURE!
> testCallBackSetCallback(org.apache.tuscany.sca.test.ConversationsITest) Time
elapsed: 0 sec <<< ERROR!
> org.apache.tuscany.spi.component.TargetException: Component must have
exactly one service
> at
org.apache.tuscany.core.implementation.java.JavaAtomicComponent.getServiceInstance
(JavaAtomicComponent.java:72)
> at
org.apache.tuscany.spi.extension.CompositeComponentExtension.locateService
(CompositeComponentExtension.java:268)
> at
org.apache.tuscany.core.launcher.CompositeContextImpl.locateService(
CompositeContextImpl.java:65)
> at org.apache.tuscany.sca.test.ConversationsITest.setUp(
ConversationsITest.java:17)
> at junit.framework.TestCase.runBare(TestCase.java:125)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:64)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:615)
> at org.apache.maven.surefire.junit.JUnitTestSet.execute(
JUnitTestSet.java:210)
> at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
AbstractDirectoryTestSuite.java:135)
> at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
AbstractDirectoryTestSuite.java:122)
> at org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.run(
TuscanyITestMojo.java:122)
> at
org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.runSurefire(
TuscanyITestMojo.java:88)
> at org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.execute(
TuscanyITestMojo.java:77)
> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:412)
> at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:534)
> at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:475)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:454)
> at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:306)
> at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:273)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:140)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:64)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:615)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(
Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira