Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Issue with declarative services implementation?

Chris,

I believe you ran into DS' lazy loading of implementation classes.
Since your component configurations checked out, DS went ahead and
registered a ServiceFactory proxy in place of your
com.cra.shared.instantiator.Instantiator.  At this point, the service
was actually provided.  Once the com.cra.shared.container.Container
came along and actually requested the service object, DS's
ServiceFactory proxy attempted to instantiate the service object and
it bombed.  This would not have happened if you had declared the
Instantiator as an immediate component.  The lazy instantiation of
component objects is outlined in the DS spec.

Hope that helps,
Jeremy

On 4/30/07, Chris Hopkins <chopkins@xxxxxxx> wrote:




Hi all –



We are using the Declarative Services implementation within Eclipse 3.2.2 as
we are interested in exploring the use of DS. I'm running into an issue
right now where the implementation is not acting as I would expect. I have
one bundle that declares the following component:



<?xml version="1.0" encoding="UTF-8"?>

<component name="instantiator">

      <implementation
class="com.cra.shared.instantiator.InstantiatorImpl"/>

      <service>

            <provide
interface="com.cra.shared.instantiator.Instantiator"/>

      </service>

</component>



Another bundle defines another component thusly:



<?xml version="1.0" encoding="UTF-8"?>

<component name="container">

      <implementation
class="com.cra.shared.container.DefaultContainer"/>

      <service>

            <provide
interface="com.cra.shared.container.Container"/>

      </service>

      <reference

            name="instantiator"


interface="com.cra.shared.instantiator.Instantiator"

            cardinality="1..1"

            bind="bindInstantiator"

            unbind="unbindInstantiator"

      />

</component>



I would expect that the container service would not be started until the
instantiator service was available. However, I mistakenly had the
InstantiatorImpl class package private instead of public so, apparently, it
was not able to be instantiated. As I wouldn't have expected, the container
service was started and, having a null Instantiator, it blew up.



Am I trying to hook things up incorrectly?



Thanks,

Chris


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




Back to the top