the error occurs when the composite with the promoted binding
is activated in isolation, independent of whether it is used
as a component implementation.

The service name that is registered twice in the rmiregistry
is the serviceName attribute of the binding.rmi element, in
this case "LogAdapterServiceRMI".

One way to work around the error would be to provide an explicit
RMI binding for the promoted service using a new RMI-name, e. g.:

 <service name="SLF4JLogAdapterService" 
promote="SLF4JAdapterComponent/LogAdapterService">
        <ts:binding.rmi host="localhost" port="1099" 
serviceName="PromotedLogAdapterServiceRMI"/>
  </service>

But this seems somewhat counterintuitive - if no binding is specified for a
promoted service, the binding for the component service should simply
be taken from the original service definition. So I would still classify 
Tuscany's 
behaviour as a minor bug.

-- Sebastian

> -----Original Message-----
> From: Simon Laws [mailto:[email protected]]
> Sent: Tuesday, September 21, 2010 11:24 AM
> To: [email protected]
> Subject: Re: FW: RMI cannot be promoted
> 
> On Mon, Sep 20, 2010 at 3:16 PM, Millies, Sebastian
> <[email protected]> wrote:
> > by the way, the obvious thing (it seems to me) would be to use
> > Naming.rebind() instead of Naming.bind(). Is there a particular
> > reason why Naming.bind() is used? -- Sebastian
> >
> >
> >> -----Original Message-----
> >> From: Millies, Sebastian [mailto:[email protected]]
> >> Sent: Monday, September 20, 2010 1:10 PM
> >> To: [email protected]
> >> Subject: Bug: RMI cannot be promoted
> >>
> >> Hello there,
> >>
> >> is this a known bug in Tuscany 1.6? Couldn't find it in JIRA,
> >> but maybe my search was not good.
> >>
> >> A service with an RMI binding cannot be promoted, because when
> >> the binding for the promoted service is processed, the Tuscany
> >> CompositeActivatorImpl attempts to start the
> RMIServiceBindingProvider
> >> a second time, which leads to the DefaultRMIHost wanting to bind the
> >> service under the same name in the RMI registry, which produces an
> >> AlreadyBoundException.
> >>
> >> Here's a snippet from the composite.xml:
> >>
> >> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> >> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
> >> xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0";
> >> name="logger_composite" targetNamespace="http://ps.softwareag.com/";>
> >>   <component name="SLF4JAdapterComponent">
> >>     <implementation.java
> >>
> class="com.softwareag.ps.platform.logadapter.impl.SLF4JAdapterImpl"/>
> >>     <service name="LogAdapterService">
> >>       <interface.java
> >>
> interface="com.softwareag.ps.platform.logadapter.LogAdapterService"/>
> >>       <binding.sca/>
> >>       <ts:binding.rmi host="localhost" port="1099"
> >> serviceName="LogAdapterServiceRMI"/>  <!-- *** -->
> >>     </service>
> >>   </component>
> >>   <service name="SLF4JLogAdapterService"
> >> promote="SLF4JAdapterComponent/LogAdapterService"/> <!-- *** -->
> >> </composite>
> >>
> >> -- Sebastian
> >>
> >
> 
> Hi Sebastien
> 
> Is the promoted service being used by a component implemented using
> implementation.composite? What is the service name that it thinks is
> being registered twice?
> 
> Simon
> 
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to