2012-01-15 23 views
0

システムを2つに分割しました。両方の部分は、Rhinoサービスバスを使用して、それぞれ と通信します。 そこのWindows 7上の問題はありませんが、私はどこか他の (WinXPの、Server 2003は、...)私は次の例外 を呼び出しますRhino.ServiceBus.Hosting.DefaultHost.Start(..)、それを起動した場合:ここで Rhino ServiceBusの起動時に例外を受け取ります

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) 

があるフラグメントの形の春ログ:

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 

答えて

1

問題は解決: をする(Windows XP、Windows Server 2003でのようなシステム上の)MSMQバージョン3以下では、サブキューはサポートされていないため、RhinoのSBは、キューをmanageingためFlatQueueStrategyを使用しています。 Springオブジェクトコンテナが設定されているときに問題が発生します。具体的にはRhino.ServiceBus.Spring.SpringBuilderクラスに2つの場所があり、変更が必要です。

1)の方法RegisterMsmqTransport

if (queueStrategyType.GetConstructor(new[] { typeof(IQueueStrategy), typeof(Uri) }) != null) 
{ 
    applicationContext.RegisterSingleton(queueStrategyType, typeof (IQueueStrategy).FullName, applicationContext.Get<IEndpointRouter>(), config.Endpoint); 
} 
else 
{ 
    // use default 
    applicationContext.RegisterSingleton(queueStrategyType); 
} 

FlatQueueStrategyはタイプIQueueStrategyとウリのパラメータを持つコンストラクタを持っていないため、ステートメントは常に、呼び出された場合の第二部。 しかし、パラメータを持たないコンストラクタもありません。そのため、FlatQueueStrategyはオブジェクトコンテナに正しく登録されていません。 この部分の変形は次のようになります

if (queueStrategyType.GetConstructor(new[] { typeof(IEndpointRouter), typeof(Uri) }) != null) 
{ 
    applicationContext.RegisterSingleton(queueStrategyType, typeof (IQueueStrategy).FullName, applicationContext.Get<IEndpointRouter>(), config.Endpoint); 
} 
else 
{ 
    // use default 
    applicationContext.RegisterSingleton(queueStrategyType); 
} 

2)方法RegisterDefaultServices

次の問題は、メソッドRegisterDefaultServicesである:IEndpointRouterが登録される前に

applicationContext.RegisterSingleton<IServiceLocator>(() => new SpringServiceLocator(applicationContext)); 
    applicationContext.RegisterSingletons<IBusConfigurationAware>(typeof(IServiceBus).Assembly); 

    foreach (var busConfigurationAware in applicationContext.GetAll<IBusConfigurationAware>()) 
    { 
     busConfigurationAware.Configure(config, this); // here is the method RegisterMsmqTransport called 
    } 

    foreach (var module in config.MessageModules) 
    { 
     applicationContext.RegisterSingleton(module, module.FullName); 
    } 

    applicationContext.RegisterSingleton<IReflection>(() => new DefaultReflection()); 
    applicationContext.RegisterSingleton(config.SerializerType); 
    applicationContext.RegisterSingleton<IEndpointRouter>(() => new EndpointRouter()); 

方法RegisterMsmqTransportが呼び出されオブジェクトコンテナ内にある。 IEndpointRouterは方法RegisterMsmqTransportで使用される(1を参照)、したがって、メソッド呼び出し

applicationContext.Get<IEndpointRouter>() 

は、例外を発生します。 ここに変更があります:

applicationContext.RegisterSingleton<IServiceLocator>(() => new SpringServiceLocator(applicationContext)); 
    applicationContext.RegisterSingletons<IBusConfigurationAware>(typeof(IServiceBus).Assembly); 
    applicationContext.RegisterSingleton<IReflection>(() => new DefaultReflection()); 
    applicationContext.RegisterSingleton<IEndpointRouter>(() => new EndpointRouter()); 

    foreach (var busConfigurationAware in applicationContext.GetAll<IBusConfigurationAware>()) 
    { 
     busConfigurationAware.Configure(config, this); 
    } 

    foreach (var module in config.MessageModules) 
    { 
     applicationContext.RegisterSingleton(module, module.FullName); 
    } 

    applicationContext.RegisterSingleton(config.SerializerType); 
+0

あなたはあなたの答えをここに掲載しました!あなたの問題が解決されたことを誰もが分かるように、それも受け入れてください。 – Marijn

関連する問題