Rhino ServiceBus 启动时出现异常
我的系统分为两部分。两个部分相互通信 其他使用Rhino服务总线。 在Windows 7上没有问题,但是如果我在其他地方启动它 (WinXP,Server 2003,...)我得到以下异常 当我调用Rhino.ServiceBus.Hosting.DefaultHost.Start(..)时:
System.NullReferenceException: Object reference not set to an instance of an object.
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectFromFactoryObject(IFactoryObject factory, String objectName, RootObjectDefinition rod)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectForInstance(Object instance, String name, String canonicalName, RootObjectDefinition rod)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name)
at Spring.Context.Support.AbstractApplicationContext.GetObject(String name)
at Rhino.ServiceBus.Spring.ApplicationContextExtensions.Get(IApplicationContext context, Type type)
at Rhino.ServiceBus.Spring.ApplicationContextExtensions.Get[T](IConfigurableApplicationContext context)
at Rhino.ServiceBus.Spring.SpringBootStrapper.GetInstance[T]()
at Rhino.ServiceBus.Hosting.DefaultHost.InitailizeBus(String asmName)
at Rhino.ServiceBus.Hosting.DefaultHost.Start(String asmName)
这是Spring日志的片段:
2012-01-14 13:25:01,084 DEBUG Spring.Objects.Factory.Support.DefaultListableObjectFactory - Invoking IObjectPostProcessors after initialization of object '351a5f07-e33d-4be0-84cf-1738a8feba24'
2012-01-14 13:25:01,084 DEBUG Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: returning instance for objectname 351a5f07-e33d-4be0-84cf-1738a8feba24
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object Rhino.ServiceBus.Msmq.FlatQueueStrategy
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object Rhino.ServiceBus.Msmq.MsmqTransport
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object 1a769f24-5410-4cee-8d7a-76c3a91b1ce1
I have my system divided into 2 parts. Both parts communicate with each
other using Rhino Service Bus.
There is no problem on Windows 7, but if I start it anywhere else
(WinXP, Server 2003, ... ) I get the following exception
when I call Rhino.ServiceBus.Hosting.DefaultHost.Start(..)
:
System.NullReferenceException: Object reference not set to an instance of an object.
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectFromFactoryObject(IFactoryObject factory, String objectName, RootObjectDefinition rod)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectForInstance(Object instance, String name, String canonicalName, RootObjectDefinition rod)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name)
at Spring.Context.Support.AbstractApplicationContext.GetObject(String name)
at Rhino.ServiceBus.Spring.ApplicationContextExtensions.Get(IApplicationContext context, Type type)
at Rhino.ServiceBus.Spring.ApplicationContextExtensions.Get[T](IConfigurableApplicationContext context)
at Rhino.ServiceBus.Spring.SpringBootStrapper.GetInstance[T]()
at Rhino.ServiceBus.Hosting.DefaultHost.InitailizeBus(String asmName)
at Rhino.ServiceBus.Hosting.DefaultHost.Start(String asmName)
Here is fragment form Spring log:
2012-01-14 13:25:01,084 DEBUG Spring.Objects.Factory.Support.DefaultListableObjectFactory - Invoking IObjectPostProcessors after initialization of object '351a5f07-e33d-4be0-84cf-1738a8feba24'
2012-01-14 13:25:01,084 DEBUG Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: returning instance for objectname 351a5f07-e33d-4be0-84cf-1738a8feba24
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object Rhino.ServiceBus.Msmq.FlatQueueStrategy
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object Rhino.ServiceBus.Msmq.MsmqTransport
2012-01-14 13:25:01,084 ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object 1a769f24-5410-4cee-8d7a-76c3a91b1ce1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题已解决:
在 MSMQ 版本 3 或更低版本中(在 Windows XP、Windows Server 2003 等系统上),不支持子队列,因此 Rhino SB 使用 FlatQueueStrategy 来管理队列。
配置Spring对象容器时出现问题。具体来说,Rhino.ServiceBus.Spring.SpringBuilder类中有两个地方需要修改。
1) 方法RegisterMsmqTransport:
总是调用if语句的第二部分,因为FlatQueueStrategy没有参数为IQueueStrategy和Uri类型的构造函数。
但它甚至没有不带参数的构造函数。因此FlatQueueStrategy没有在对象容器中正确注册。
这部分的修改是:
2) 方法RegisterDefaultServices
下一个问题是在方法RegisterDefaultServices 中:
在IEndpointRouter 在对象容器中注册之前调用方法RegisterMsmqTransport。
IEndpointRouter 在 RegisterMsmqTransport 方法中使用(参见 1),因此方法调用
会产生异常。
这里的修改是:
Problem solved:
In the MSMQ version 3 or lower (on systems like Windows XP, Windows Server 2003), subqueues are not supported and therefore Rhino SB uses FlatQueueStrategy for manageing the queues.
Problems occurs when Spring object container is configured. Concretely there are two places in the class Rhino.ServiceBus.Spring.SpringBuilder where modifications need to be done.
1) method RegisterMsmqTransport:
the second part of if statement is always called, because FlatQueueStrategy doesn't have constructor with parameters of type IQueueStrategy and Uri.
But it doesn't even have the constructor without parametrs. So FlatQueueStrategy is not registered correctly in the object container.
The modification for this part would be:
2) method RegisterDefaultServices
Next problem is in the method RegisterDefaultServices:
the method RegisterMsmqTransport is called before IEndpointRouter is registered in object container.
IEndpointRouter is used in the method RegisterMsmqTransport (see 1) and therefore method call
produces an exception.
The modification here would be: