When an exception occurs in the code that's called from the handler, the host tries it for 5 times and then shuts down the service with the following message:
2013-10-17 08:57:12,091 [13] FATAL NServiceBus.Faults.Forwarder.FaultManager [(null)] - Could not forward failed message to error queue.
Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
2013-10-17 08:57:12,139 [13] FATAL NServiceBus [(null)] - Fault manager failed to process the failed message with id e0fc75b2-4eef-4f90-a450-a25901130c9a
System.InvalidOperationException: Could not forward failed message to error queue. ---> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Here's my config:
<configSections>
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
<UnicastBusConfig ForwardReceivedMessagesTo="audit">
<MessageEndpointMappings />
</UnicastBusConfig>
Here's my Bus initialization code:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, AsA_Publisher, UsingTransport<Msmq>
{
}
NServiceBus.SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
NServiceBus.Unicast.Config.ConfigUnicastBus busConfig = Configure.With()
.Log4Net()
.DefaultBuilder()
.MsmqSubscriptionStorage()
.UnicastBus();
Bus = busConfig.CreateBus().Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());
I am not quite sure why it is not able to try the SLR after failing 5 times and also forwarding it to the error queue after that.
Any help is appreciated!
Thanks
Prasad
Take a look here: https://github.com/sfarmar/Samples/tree/master/HalloWorldWithPubSub
I'm hoping this can guide you in the right direction
Related
Service does not start - ArgumentNullException value cannot be null parameter name ip.
My Service does not start and I see following exception in the EventViewer.
Service cannot be started. System.Runtime.Remoting.RemotingException: Remoting configuration failed with the exception 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: ip
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupMachineName()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
When I debug, the exception happened at line :
-> RemotingConfiguration.Configure(configFile, false);
My configfile Remoting Configuration is as below:
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton" objectUri="PersonalityModule.rem" type="Ideas.Instructor.PersonalityModules.SPPA.PersonalityModule, PM_SPPA"/>
</service>
<channels>
<channel ref="tcp" port="7676" >
<formatter ref="binary" typeFilterLevel="Full" />
</channel>
</channels>
</application>
<customErrors mode="Off"/>
</system.runtime.remoting>
I have limited knowledge on Remoting. I am not understanding what is causing this error and how to fix it. Kindly suggest. Thank you in advance.
I am using jboss-5.1 to deploy message driven bean which is used to subscribe messages from a third party queue.
Around 16 messages were posted to that queue but they remained pending in our subscriber queue. I restarted the server and the messages were readily picked.
As much as I have analysed, I think maxsize and maxsession could have affected it, as both are 15. But I do not understand if there was some real issue, how it got solved by just restarting.
The logs were in error mode. I did not get the full stack trace.
This is the snippet of that error log.
[2012-10-30 17:01:00,228] [MQQueueAgent (GQH1_PLANNING_MDM_001)]
[ERROR] STDERR: 2012.10.30 17:01:00 MQJMS1023E rollback failed
[2012-10-30 17:01:00,228] [exceptionDelivery0] [WARN ]
org.jboss.resource.adapter.jms.inflow.JmsActivation: Failure in jms activation
org.jboss.resource.adapter.jms.inflow.JmsActivationSpec#85d0d(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter#b21aae
destination=remotewsmq/NOTIFICATION_PLANNING_MDM_001.SUBQ
destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=RemoteWSMQJMSProvider
user=null maxMessages=1 minSession=1 maxSession=5 keepAlive=60000 useDLQ=false)
GQH1_PLANNING_MDM_001: The name of the queue used for subscribing.
The files that I use to configure the properties of the MDBs are as follows.
1.ejb3-interceptors-aop.xml
<domain name="Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<!-- TODO: Authorization? -->
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
<!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
<stack-ref name="EJBInterceptors"/>
</bind>
<annotation expr="class(*) AND !class(#org.jboss.ejb3.annotation.Pool)">
#org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
</annotation>
</domain>
2.standardjboss.xml
<invoker-proxy-binding>
<name>message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
<CreateJBossMQDestination>false</CreateJBossMQDestination>
<!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
<MinimumSize>1</MinimumSize>
<MaximumSize>15</MaximumSize>
<KeepAliveMillis>30000</KeepAliveMillis>
<MaxMessages>1</MaxMessages>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>queue/DLQ</DestinationQueue>
<MaxTimesRedelivered>10</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
</proxy-factory-config>
</invoker-proxy-binding>
<activation-config-property>
<activation-config-property-name>maxSession</activation-config-property-name>
<activation-config-property-value>15</activation-config-property-value>
</activation-config-property>
3.jms-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<!-- ==================================================================== -->
<!-- JMS Stuff -->
<!-- ==================================================================== -->
<!--
The JMS provider loader. Currently pointing to a non-clustered ConnectionFactory. Need to
be replaced with a clustered non-load-balanced ConnectionFactory when it becomes available.
See http://jira.jboss.org/jira/browse/JBMESSAGING-843.
-->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.messaging:service=JMSProviderLoader,name=JMSProvider">
<attribute name="ProviderName">DefaultJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
<attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
<attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
</mbean>
<!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<xa-transaction/>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<max-pool-size>20</max-pool-size>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<depends>jboss.messaging:service=ServerPeer</depends>
</tx-connection-factory>
</connection-factories>
Please help.
If the listener did not try to reconnect, then it might be the messages pending which caused it to fail.
According to the error, a transaction ROLLBACK call failed. After the failure, the queue manager probably held those messages in an outstanding unit of work. Restarting the server would have closed the connection at which point the queue manager will have rolled back the transaction on behalf of the application. On restart, the application will create a new UOW and retrieve the messages.
Look in WebSphere MQ's queue manager error logs and global error logs to determine whether the error was caused by a resource shortage. It may be necessary to increase the size of the queue manager transaction logs or to tune transaction parameters such as MAXUOW.
You may also need to update the MQ client version or Queue Manager version. According to this Technote, WebSphere MQ JMS classes were updated as of 6.0.2.3 to fix a bug that resulted in MQJMS1023E errors. If you need to update the client version, it is available as a free download as SupportPac MQC75. A new client is able to run with any back level queue manager. After upgrading, the app benefits from the bug fixes and performance enhancements of the new client code and provides API functionality appropriate for the version of Queue Manager to which it connects. What version of WebSphere MQ JMS client is currently installed? What version of WebSphere MQ queue manager is currently installed?
I am running into issues with forwarding failed messages to error queue as ISendMessages was not configured.
I have the following sections in my app.config file
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<MessageForwardingInCaseOfFaultConfig ErrorQueue="nservicebus_error" />
<add key="ConnectivityRetryPeriod" value="30" />
<add key="FatalRetryCount" value="2" />
<add key="RetryFrequency" value="2" />
However, when the FatalRetryCount is exceeded, I get the following exception
System.InvalidOperationException occurred
Message=Could not forward failed message to error queue, reason: System.ArgumentException: NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type.
at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild)
at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]()
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason).
Source=NServiceBus.Core
StackTrace:
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason)
InnerException: System.ArgumentException
Message=NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type.
Source=NServiceBus.ObjectBuilder.Spring
StackTrace:
at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild)
at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]()
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason)
In specific, this exception is logged in the following lien in the FaultManager.cs in the NServiceBus.Faults.Forwarder namespace
Here is the App.Config section and the Config code that I use
Got the fix to this issue from the NServiceBus support team and it looks like the ISendMessages gets registered when I explicitly call .MsmqTransport(). I updated the config code to call .MsmqTransport() and FaultManager stopped throwing this exception
Scenario:
I'm using NServiceBus with MSMQ Transport.
I have messages from an app dropped into QUEUE-A.
I have a NServiceBus Gateway grab messages from QUEUE-A and send them to another Gateway
I the Destination Gateway receives the messages and places them into the respective queue.
Source Gateway throws a Null Reference Exception and send the messages 5 total times (max retries).
Destination Gateway receives all messages and shows that it's Sending the HTTP response in the log.
The error that the Destination Gateway throws is:
WARN NServiceBus.Unitcast.Transport.Msmq.MsmqTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=GUID
System.NullReferenceException: Object reference not set to an instance of an object.
This error initially was setup on 2 different servers though it occurs when I run the scenario locally, under admin rights, on my local computer (just listening on different ports). I'm setting the SetHttpToHeader() of the message to the proper destination address.
The gateway configs are as follows:
Gateway1:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway1Pickup"/>
<add key="ErrorQueue" value="Gateway1Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway1Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Gateway2:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway2Pickup"/>
<add key="ErrorQueue" value="Gateway2Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway2Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Does anyone know where I'm going wrong on this?
At first I got a solid repro and then I realized that NSB does not handle creating the Audit queues for you. If you remove them from the config or create the Audit queues, you should be all set.
I found this above problem showed up when I didn't have some dependent assemblies in the service directory. I found the error attached to the message in the MSMQ queue. I used Queue Explorer, but I presume other tools would show the same.
I am trying to configure my message endpoint mapping in my NServiceBus configuration by sending messages from different namespaces to different endpoints.
As such, I have configured the following in my web.config:
<MessageEndpointMappings>
<add Messages="Company.Messages.Accounts" Endpoint="ServiceInput" />
<add Messages="Company.Messages.Payments" Endpoint="ServiceInput" />
<add Messages="Company.Messages.Cancellations" Endpoint="ServiceInput" />
<add Messages="Company.Messages.Notifications" Endpoint="ServiceInput" />
</MessageEndpointMappings>
However, when my application starts, I receive the following exception:
Spring.Objects.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested PropertyAccessExceptions are:
[Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.Hashtable] to required type [System.Collections.IDictionary] for property 'MessageOwners'., Inner Exception: System.ArgumentException: Problem loading message assembly: Company.Messages.Payments ---> System.IO.FileNotFoundException: Could not load file or assembly 'Company.Messages.Payments' or one of its dependencies. The system cannot find the file specified.
File name: 'Company.Messages.Payments'
What I find interesting is that it seems to have found Company.Messages.Accounts but failed on the second configured line. I thought that maybe it didn't like have them all go to the same endpoint, but changing this configuration to have them go different endpoints didn't change the error message I received.
What am I doing wrong? Is it not possible to segment messages by namespace (all I have seen is by type and by assembly)?
Thanks,
Steve
NSB only supports mapping of assemblies or individual types to endpoints. Namespaces are not supported, I suggest you split you message assembly into separate assemblies for each of your endpoints.
According to this page you can specify a type:
http://docs.particular.net/nservicebus/messaging/message-owner
Specific types can be configured by using their qualified name: "namespace.type, assembly".
As of NServiceBus v3.3 namespaces can be used to filter message mappings
http://docs.particular.net/nservicebus/messaging/message-owner