On Thu, Feb 28, 2008 at 9:06 AM, Guido Franz <[EMAIL PROTECTED]> wrote:
> Hello
>
>  Yesterday I tried to integrate a Spring application context into James,
>  that can be used within Mailets. It succeeded only halfway. My custom
>  component will be loaded during startup (I print out some loading
>  statements and spring logs some stuff), but I cannot access it with the
>  ServiceManager.
>
>  Assembly.xml looks like this:
>  ##########################
>   <block name="springcontext"
>  class="com.oneandone.ccsys.ccl.james.component.SpringContextLoader" />
>  ##########################
>
>
>  The .xinfo of the SpringContextLoader component implements a simple
>  interface:
>  ##########################
>   <services>
>     <service
>  name="com.oneandone.ccsys.ccl.james.component.SpringContext"/>
>   </services>
>  ##########################
>
>  The interface has a ROLE:
>  ##########################
>     String ROLE =
>  "com.oneandone.ccsys.ccl.james.component.SpringContext";
>  ##########################
>
>  But I cannot access the component with the ServiceManager:
>  #########################
>                         ServiceManager serviceManager =
>                                 (ServiceManager)
>  getMailetContext().getAttribute(
>
>  Constants.AVALON_COMPONENT_MANAGER);
>         SpringContext context =
>
>  (SpringContext)serviceManager.lookup(SpringContext.ROLE);
>  #########################
>
>
>  Error Message: 'Unable to provide implementation for SpringContext'.
>  When debugging, I cannot see my component in the map of the
>  ServiceManager, but I don't know how to register the component for this.
>  Do I have to implement a special interface like 'Contextualizable' or
>  something like that? This is an Avalon issue, but I don't understand how
>  to create components. There is not much documentation available for
>  Avalon, or let's say I cannot find it.

As far as I understand Avalon's overengineered component model, the
missing link is that you'd have to make the component known to the
_receiving_ component, too. Only then will it appear in the specific
serviceManager map. You can do this by adding a <dependency /> to
JamesMailetLoader.xinfo.

  Bernd

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

Reply via email to