Issue With creating WindsorContainer

77 views
Skip to first unread message

Tim

unread,
Nov 17, 2016, 4:07:44 PM11/17/16
to Castle Project Users
Hello,

We are using Castle and Windsor to connect with solr. The WindsorContainer is created in an .dll that is referenced by my unit testing project. The connection works fine outside of the unit testing. The following code produces errors:

WindsorContainer m_oWindsorContainer = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));



web.config:
<configSections>
   
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
 
</configSections>
 
<castle>
   
<facilities>
     
<facility id="solr" type="Castle.Facilities.SolrNetIntegration.SolrNetFacility, SolrNet">
       
<solrURL>http://solrmainserver:8080/solr/products</solrURL>
       
<cores>
         
<core id="primary">
           
<documentType>FramesDirectAPIs.SolrProductCorecl, app_code</documentType>
           
<url>http://solrmainserver:8080/solr/products</url>
         
</core>
         
<core id="secondary">
           
<documentType>FramesDirectAPIs.SolrProductCorecl, app_code</documentType>
           
<url>http://solrbackupserver:8080/solr/products</url>
         
</core>
         
<core id="primarywebpages">
           
<documentType>FramesDirectAPIs.SolrWebPagesCorecl, app_code</documentType>
           
<url>http://solrmainserver:8080/solr/webpages</url>
         
</core>
         
<core id="secondaryWebpages">
           
<documentType>FramesDirectAPIs.SolrWebPagesCorecl, app_code</documentType>
           
<url>http://solrbackupserver:8080/solr/webpages</url>
         
</core>
         
<core id="primarycustomer">
           
<documentType>FramesDirectAPIs.SolrCustomerCorecl, app_code</documentType>
           
<url>http://solrmainserver:8080/solr/customers</url>
         
</core>
         
<core id="secondarycustomer">
           
<documentType>FramesDirectAPIs.SolrCustomerCorecl, app_code</documentType>
           
<url>http://solrbackupserver:8080/solr/customers</url>
         
</core>
       
</cores>
     
</facility>
   
</facilities>
 
</castle>


Stack Trace:
System.ArgumentNullException was unhandled by user code
 
HResult=-2147467261
 
Message=Value cannot be null.
 
Source=mscorlib
 
StackTrace:
       at
System.RuntimeType.MakeGenericType(Type[] instantiation)
       at
Castle.Facilities.SolrNetIntegration.SolrNetFacility.RegisterCore(SolrCore core)
       at
Castle.Facilities.SolrNetIntegration.SolrNetFacility.Init()
       at
Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Facilities\AbstractFacility.cs:line 86
       at
Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:line 327
       at
Castle.Windsor.WindsorContainer.AddFacility(String key, IFacility facility) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line 552
       at
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:line 177
       at
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:line 52
       at
Castle.Windsor.WindsorContainer.RunInstaller() in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line 316
       at
Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter interpreter) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line 88
       at
FramesDirectAPIs.SearchCatalogcl.ProcessText() in c:\Code\utils\qc\UnitTesting\Web App\admin webapp\Old_App_Code\SearchCatalogcl.cs:line 53
       at
AdminUnitTesting.Tests.SearchCatalogTestscl.SearchCatalogcl_Test(String sSearchText, Int32 iWebsiteId) in c:\Code\utils\qc\UnitTesting\AdminUnitTesting\AdminUnitTesting\Tests\SearchCatalogTestscl.cs:line 40
 
InnerException:



I've checked the XmlConfiguration as well as the ConfigResource objects and both of them have values and are not null. Any help would be appreciated.

Thanks,
Tim

hammett

unread,
Nov 18, 2016, 11:57:13 AM11/18/16
to castle-pro...@googlegroups.com
See

> at FramesDirectAPIs.SearchCatalogcl.ProcessText() in c:\Code\utils\qc\UnitTesting\Web App\admin webapp\Old_App_Code\SearchCatalogcl.cs:line 53

and

> at System.RuntimeType.MakeGenericType(Type[] instantiation)
> at Castle.Facilities.SolrNetIntegration.SolrNetFacility.RegisterCore(SolrCore core)
> at Castle.Facilities.SolrNetIntegration.SolrNetFacility.Init()

I'd guess that you're missing some assembly references, which is
causing the runtime error.
> --
> 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-u...@googlegroups.com.
> To post to this group, send email to castle-pro...@googlegroups.com.
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.



--
Cheers,
hammett
http://www.d-collab.com/
http://www.hammettblog.com/

Mauricio Scheffer

unread,
Nov 18, 2016, 12:07:43 PM11/18/16
to castle-pro...@googlegroups.com
Looks like you're referencing the special "app_code" assembly, which is only available in an ASP.NET context and not in a test.


--
Mauricio

--
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+unsub...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages