Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)

We have createt a C# Dll using ActiveMq.NMS

We create a connection

 public void Init(string amqUrl)
        {
            try
            {
                ConnectionFactory connectionFactory = new 
ConnectionFactory(amqUrl);
                _connection = connectionFactory.CreateConnection();
                _session = 
_connection.CreateSession(AcknowledgementMode.ClientAcknowledge);
                _connection.Start();
            }
            catch (NMSException e)
            {
                Console.WriteLine(e);
                throw;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }


We then create a consumer
 public void CreateConsumer(string queueName)
        {
            if (!consumerDictionary.ContainsKey(queueName))
            {
                try
                {
                   IDestination destination = _session.GetQueue(queueName);
                   IMessageConsumer consumer = 
_session.CreateConsumer(destination);
                   consumerDictionary.Add(queueName, consumer);
                }
                catch (NMSException e)
                {
                    Console.WriteLine(e);
                    throw;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }

        }
Then we calle receivestring and wait for  a message
 public string ReceiveString(string consumerName)
        {
            if (consumerDictionary.ContainsKey(consumerName))
            {
                try
                {
                    IMessageConsumer consumer = 
(MessageConsumer)consumerDictionary[consumerName];
                    _message = consumer.Receive();
                    if (_message is Message)
                    {
                        ITextMessage msg = (ITextMessage)_message;
                        return msg.Text;
                    }

                    return null;

                }
                catch (NMSException e)
                {
                    Console.WriteLine(e);
                    throw;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }

            }

            return null;
        }
 After an our an exception occurs as follows

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)

Have anybody experienced similar problem?


Torgeir Sjur Lund, System Developer
Vitec Aloc
Telefon +45 2999 7122

Sendt fra min mobiltelefon

Reply via email to