Fixed now.
A subtle bug that had been introduced as these classes had been refactored from POJO's to hivemind services. The ServiceA was creating it's own instance of ServiceBImpl and overwriting the proxy hivemind had supplied. Hence this instance was never being wired up by hivemind.

Aleksej wrote:
Christopher Barran wrote:

I have created a set of services that depend on each other.
ServiceA depends on ServiceB which depends on ServiceC

If I write a unit test that builds the HiveMind registry.
I can get out ServiceC and test it, works OK

If I get ServiceB and test it works OK.

If I get ServiceA and test it, fails because
ServiceB has no reference to ServiceC.

I guess this is something to do with proxies ?

When I get ServiceB from the registry a proxy is created for ServiceC
and when I use the service it is instanciated.

However when I get ServiceA from the registry a Singlton proxy is created for ServiceB but I see no such message about autowiring a Single ton proxy for ServiceC. When the code tries to access ServiceC I get a NullPointerException. Any ideas.

<?xml version="1.0" encoding="UTF-8"?>
<module id="myModule"  version="1.0.0">
    <service-point id="ServiceC" interface="foo.bar.ServiceC">
    <create-instance class="foo.bar.ServiceCImpl" />
  <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>

   <service-point id="ServiceB" interface="foo.bar.ServiceB">
    <invoke-factory service-id="hivemind.BuilderFactory">
    <construct class="foo.bar.ServiceBImpl" autowire-services="true" />
    </invoke-factory>
  <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>


  <service-point id="ServiceA" interface="foo.bar.ServiceA" >
    <invoke-factory service-id="hivemind.BuilderFactory">
      <construct class="foo.bar.ServiceAImpl" autowire-services="true">
       <set property="country" value="GB" />
       <set property="company" value="COMPANY" />
       <set property="url" value="http://www.foo.com"; />
       <set property="script" value="/foo/bar.jsp" />
      </construct>
    </invoke-factory>
    <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>
</module>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Maybe it is because you use create-instance for ServiceC?
Also you can skip service-id="hivemind.BuilderFactory" because it is default ( as autowire-services="true" )

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Dr Chris Barran
Senior Systems Developer
Internet Technologies Team
CiCS
The University of Sheffield
Tel: +44 114 2221193
begin:vcard
fn:Chris Barran
n:Barran;Chris
org:The University of Sheffield;CiCS
email;internet:[EMAIL PROTECTED]
title:Senior Developer
tel;work:+44 114 2221193
x-mozilla-html:FALSE
version:2.1
end:vcard


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to