Switched my service locator code to use Windsor 3.1 Typed Factories. It 
seems to work for some factory calls but then for another factory call it 
blows up with the following error.   Is there something wrong with my code 
or registration?

ComponentNotFoundException occurred
  HelpLink=groups.google.com/group/castle-project-users
  HResult=-2146233088
  Message=Requested component named '' was not found in the container. Did 
you forget to register it?
There is one other component supporting requested service 
'CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinter'. Is it what you were 
looking for?
  Source=Castle.Windsor
  Name=""
  StackTrace:
       at 
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(String
 
key, Type service, IDictionary arguments, IReleasePolicy policy)
  InnerException: 


    public class DocumentPrinterResolver : IDocumentPrinterResolver
    {
        private readonly IObjectFactory<IDocumentPrinter> 
m_docPrinterFactory;
        private readonly IObjectFactory<IDocumentPrinter2> 
m_docPrinter2Factory;

        public DocumentPrinterResolver(IObjectFactory<IDocumentPrinter> 
docPrinterFactory, IObjectFactory<IDocumentPrinter2> docPrinter2Factory)
        {
            m_docPrinterFactory = docPrinterFactory;
            m_docPrinter2Factory = docPrinter2Factory;
        }

        public IDocumentPrinter GetDocumentPrinter()
        {
            //assume only single document printer 
            //return (IDocumentPrinter) m_kernel.Resolve(typeof 
(IDocumentPrinter));

            return m_docPrinterFactory.Get();  //we blow up here with 
ComponentNotFoundException 
        }






Full Stack Trace at first chance exception:

> Castle.Windsor.dll!Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(string
>  
key, System.Type service, System.Collections.IDictionary arguments, 
Castle.MicroKernel.IReleasePolicy policy) Line 605 C#
  
Castle.Windsor.dll!Castle.Facilities.TypedFactory.TypedFactoryComponentResolver.Resolve(Castle.MicroKernel.IKernelInternal
 
kernel, Castle.MicroKernel.IReleasePolicy scope) Line 48 + 0x53 bytes C#
  
Castle.Windsor.dll!Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Resolve(Castle.DynamicProxy.IInvocation
 
invocation) Line 78 + 0x39 bytes C#
  
Castle.Windsor.dll!Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Intercept(Castle.DynamicProxy.IInvocation
 
invocation) Line 51 C#
  Castle.Core.dll!Castle.DynamicProxy.AbstractInvocation.Proceed() Line 170 
+ 0x73 bytes C#
  DynamicProxyGenAssembly2!Castle.Proxies.IObjectFactory`1Proxy_1.Get() + 
0xcc bytes 
  
CT.Acme.Sdk.Documents.Utils.Impl.dll!CT.Acme.Sdk.Documents.Utils.Impl.DocumentPrinterResolver.GetDocumentPrinter()
 
Line 23 + 0x33 bytes C#
  
CT.Acme.Sdk.Documents.Svcs.Impl.dll!CT.Acme.Sdk.Documents.Svcs.Impl.DocumentService.PrintDocument(string
 
docKeyString, string pageRangeString, string documentTitle, bool 
includeDocNotes, bool realizeAnnotations) Line 966 + 0x41 bytes C#
  
CT.Acme.Apps.Web.Search.dll!CT.Acme.Apps.Web.Search.Controllers.DocumentController.PrintDocument(string
 
encodedDocKey, string pageRange, bool includeDocNotes, bool 
realizeAnnotations) Line 565 + 0x6c bytes C#
  [Lightweight Function] 


<component id="AcmePrinterResolver" lifestyle="transient" 
service="CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinterResolver, 
CT.Acme.Sdk.Documents.Utils.Int" 
type="CT.Acme.Sdk.Documents.Utils.Impl.DocumentPrinterResolver, 
CT.Acme.Sdk.Documents.Utils.Impl" />
      <component id="AcmePdfPrinter2" lifestyle="transient" 
service="CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinter2, 
CT.Acme.Sdk.Documents.Utils.Int" 
type="CT.Acme.Sdk.Documents.Utils.Impl.PdfDocumentPrinter2, 
CT.Acme.Sdk.Documents.Utils.Impl" />
      <component id="AcmePdfPrinter" lifestyle="transient" 
service="CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinter, 
CT.Acme.Sdk.Documents.Utils.Int" 
type="CT.Acme.Sdk.Documents.Utils.Impl.PdfDocumentPrinter, 
CT.Acme.Sdk.Documents.Utils.Impl" />
 
.
.
.     

<facilities>
      <facility id="TypedFactoryFacility" 
type="Castle.Facilities.TypedFactory.TypedFactoryFacility, Castle.Windsor">
        <factories>
          <factory id="TffIdentityProviderEnrollerFactory" 
interface="CT.Acme.Sdk.Security.Objects.Int.IIdentityProviderEnrollerFactory, 
CT.Acme.Sdk.Security.Objects.Int" 
selector="${ComponentIdComponentSelector}" />
          <factory id="TffSqlCommandBuilderFactory" 
interface="CT.Acme.Kernel.Objects.Int.IObjectFactory`1[[CT.Acme.Dal.Documents.Int.ISqlCommandBuilder,
 
CT.Acme.Dal.Documents.Int]], CT.Acme.Kernel.Objects.Int" />
          <factory id="TffDocumentPrinterFactory" 
interface="CT.Acme.Kernel.Objects.Int.IObjectFactory`1[[CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinter,
 
CT.Acme.Sdk.Documents.Utils.Int]], CT.Acme.Kernel.Objects.Int" />
          <factory id="TffDocumentPrinter2Factory" 
interface="CT.Acme.Kernel.Objects.Int.IObjectFactory`1[[CT.Acme.Sdk.Documents.Utils.Int.IDocumentPrinter2,
 
CT.Acme.Sdk.Documents.Utils.Int]], CT.Acme.Kernel.Objects.Int" />
          <factory id="TffDocumentExporterFactory" 
interface="CT.Acme.Kernel.Objects.Int.IObjectFactory`1[[CT.Acme.Sdk.Documents.Utils.Int.IDocumentExporter,
 
CT.Acme.Sdk.Documents.Utils.Int]], CT.Acme.Kernel.Objects.Int" 
selector="${ComponentIdComponentSelector}" />
        </factories>
      </facility>
    </facilities>


public interface IObjectFactory<T> where T: class
    {
        T Get();
        T[] GetAll();
        T Get(string key);

        void Release(T obj);
        void ReleaseAll(T[] obj);

    }


-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to