1
votes

I have an NServicebus project that I cannot start after upgrading from 2.6 to 3.2.7 The endpoint look like this:

namespace Customer.Project.SchemaImportService
{
    public class SchemaImportEndpoint : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
    {
    private IContainer _container;

    public void Init()
    {
        log4net.Config.XmlConfigurator.Configure();
        SetupStructureMap();

        Configure.With()
            .Log4Net()
            .StructureMapBuilder(_container)
            .DisableTimeoutManager()
            .XmlSerializer()
            .CreateBus();
    }

    private void SetupStructureMap()
    {
        // implementation omitted
    }
}

Furthermore, the app.config looks like this:

<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
</configSections>
<MsmqTransportConfig NumberOfWorkerThreads="1" MaxRetries="5" />
<Logging Threshold="DEBUG" /> 
<log4net debug="true"> <!-- logging details omitted -->  </log4net>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="Customer.Project.SchemaImportService.Error" />

When I debug the project I start the NServicebus.Host.exe file, I've tried switching profiles (Production, Integration and Lite) with the same result.

The exception that is gives (after leaving the init statement) look like this:

Message: "Exception when starting endpoint, error has been logged. Reason: Object reference not set to an instance of an object."
Source: NserviceBus.Host

StackTrace: at NServiceBus.Hosting.GenericHost.Start() in     c:\TeamCity\buildAgent\work\nsb.master_7\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45
at NServiceBus.Hosting.Windows.WindowsHost.Start() in     c:\TeamCity\buildAgent\work\nsb.master_7\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56
   at NServiceBus.Hosting.Windows.Program.<>c__DisplayClass8.<Main>b__4(WindowsHost service) in     c:\TeamCity\buildAgent\work\nsb.master_7\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 97
   at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in     c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18
   at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.    <set_StartAction>b__1(TService service) in    c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
   at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
   at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
   at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object     parameter) in :line 0

The following lines get logged in my log file:

INFO  2012-08-21 13:25:24,881 18494ms RoleManager            gureBusForEndpoint - Role NServiceBus.AsA_Server configured
DEBUG 2012-08-21 13:25:25,124 18738ms TransactionalTransport DebugFormat        - Setting throttling to: [1] message/s per second, sleep between receiving message: [800]
FATAL 2012-08-21 13:25:25,158 18772ms GenericHost            Start              - System.NullReferenceException: Object reference not set to an instance of an object.
   at NServiceBus.Unicast.Transport.Transactional.TransactionalTransport.NServiceBus.Unicast.Transport.ITransport.Start(Address address)
   at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action startupAction)
   at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start()
   at NServiceBus.Hosting.GenericHost.Start() in  c:\TeamCity\buildAgent\work\nsb.master_7\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 32

The last bit of information I can provide (but perhaps the most important one), is that if I delete all my messagequeues, the main queue is not automatically recreated.

these private queues get created:

customer.project.schemaimportservice.error
customer.project.schemaimportservice.retries

but the

customer.project.schemaimportservice

queue is missing, even though it matches my namespace (see top of posting).

What am I doing wrong? Must I manually configure the messagequeue name in version 3.2.7?

1

1 Answers

1
votes

I had to include .MsMqTransport() under the Configure.With() section of the Init class.