activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Gomes <e.se...@gmail.com>
Subject Re: No IConnectionFactory implementation found for connection URI: activemq:tcp://localhost:61616
Date Tue, 09 Apr 2013 16:34:15 GMT
Hello,

Your sample code works.  Here's what you need in order to run.


   1. The nmsprovider-activemq.config file is not necessary, since you are
   using the standard assemblies, so you can get rid of this if you want.
    It's an optional file, and I suggest not using it unless you are doing
   something advanced.
   2. You need to have Apache.NMS.dll, Apache.NMS.ActiveMQ.dll, and
   Ionic.Zlib.dll in your execution folder.  These are required.

I suspect that you are missing the Ionic.Zlib.dll.  The way I set up my
project is that I add a reference to Apache.NMS.dll.  I then add the
Apache.NMS.ActiveMQ.dll and Ionic.Zlib.dll as content files that are copied
to the output folder if they are newer, but I don't reference them directly.

Best,
Jim



On Tue, Apr 9, 2013 at 8:28 AM, JavyRocks <javy.rocks@gmail.com> wrote:

> Hi
> It doesn't work either
>
> still get the same error
> This is the stack trace
>
>  at Apache.NMS.NMSConnectionFactory.CreateConnectionFactory(Uri
> uriProvider,
> Object[] constructorParams) in
> c:\dev\NMS\src\main\csharp\NMSConnectionFactory.cs:line 123
>    at Apache.NMS.NMSConnectionFactory..ctor(Uri uriProvider, Object[]
> constructorParams)
>
> in c:\dev\NMS\src\main\csharp\NMSConnectionFactory.cs:line 86
>    at ConexionActiveMQ.Program.Main(String[] args)
>
> in C:\Users\Administrator\documents\visual studio
> 2010\Projects\ConexionActiveMQ\ConexionActiveMQ\Program.cs:line 54
>    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[]
> args)
>    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>    at System.Threading.ExecutionContext.RunInternal(ExecutionContext
> executionContext, ContextCallback callback, Object state, Boolean
> preserveSyncCtx)
>    at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state, Boolean
> preserveSyncCtx)
>    at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
> tabish121@gmail.com wrote
> > You need the Apache ActiveMQ NMS Provider.
> > http://activemq.apache.org/nms/apachenmsactivemq-v156.html
> >
> >
> > On 04/08/2013 07:44 PM, JavyRocks wrote:
> >> *I still get the "No IConnectionFactory implementation found for
> >> connection
> >> URI: activemq:tcp://localhost:61616" Error. I've paste and include in
> the
> >> compile project the archive "nmsprovider-activemq.config"
> >> I'm Working with .NET 4.0 and the references are
> >> Apache.NMS-1.5.1-bin.zip\net-4.0\release
> >>
> >> The code is very estandar and simple but I can't get throw the
> connection
> >> error*
> >>
> >>      using System;
> >> using System.Collections.Generic;
> >> using System.Linq;
> >> using System.Text;
> >> using Apache.NMS;
> >> using Apache.NMS.Util;
> >> using System.Collections;
> >> using System.Reflection;
> >> using System.IO;
> >>
> >> namespace ConexionActiveMQ
> >> {
> >>      class Program
> >>      {
> >>          private static string[] GetConfigSearchPaths()
> >>          {
> >>              ArrayList pathList = new ArrayList();
> >>
> >>              // Check the current folder first.
> >>              pathList.Add("");
> >>              AppDomain currentDomain = AppDomain.CurrentDomain;
> >>
> >>              // Check the folder the assembly is located in.
> >>
> >>
> >>
> pathList.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
> >>              if (null != currentDomain.BaseDirectory)
> >>              {
> >>                  pathList.Add(currentDomain.BaseDirectory);
> >>              }
> >>
> >>              if (null != currentDomain.RelativeSearchPath)
> >>              {
> >>                  pathList.Add(currentDomain.RelativeSearchPath);
> >>              }
> >>
> >>              return (string[])pathList.ToArray(typeof(string));
> >>          }
> >>
> >>          static void Main(string[] args)
> >>          {
> >>              string[] direcciones;
> >>              direcciones = GetConfigSearchPaths();
> >>              // Example connection strings:
> >>              //    activemq:tcp://localhost:61616
> >>              //    stomp:tcp://activemqhost:61613
> >>              //    ems:tcp://tibcohost:7222
> >>              //    msmq://localhost
> >>
> >>              Uri connecturi = new Uri("activemq:tcp://localhost:61616");
> >>
> >>              Console.WriteLine("About to connect to " + connecturi);
> >>
> >>              // NOTE: ensure the nmsprovider-activemq.config file exists
> >> in
> >> the executable folder.
> >>              IConnectionFactory factory = new
> >> NMSConnectionFactory(connecturi);
> >>
> >>              using (IConnection connection = factory.CreateConnection())
> >>              using (ISession session = connection.CreateSession())
> >>              {
> >>                  // Examples for getting a destination:
> >>                  //
> >>                  // Hard coded destinations:
> >>                  //    IDestination destination =
> >> session.GetQueue("FOO.BAR");
> >>                  //    Debug.Assert(destination is IQueue);
> >>                  //    IDestination destination =
> >> session.GetTopic("FOO.BAR");
> >>                  //    Debug.Assert(destination is ITopic);
> >>                  //
> >>                  // Embedded destination type in the name:
> >>                  //    IDestination destination =
> >> SessionUtil.GetDestination(session, "queue://FOO.BAR");
> >>                  //    Debug.Assert(destination is IQueue);
> >>                  //    IDestination destination =
> >> SessionUtil.GetDestination(session, "topic://FOO.BAR");
> >>                  //    Debug.Assert(destination is ITopic);
> >>                  //
> >>                  // Defaults to queue if type is not specified:
> >>                  //    IDestination destination =
> >> SessionUtil.GetDestination(session, "FOO.BAR");
> >>                  //    Debug.Assert(destination is IQueue);
> >>                  //
> >>                  // .NET 3.5 Supports Extension methods for a simplified
> >> syntax:
> >>                  //    IDestination destination =
> >> session.GetDestination("queue://FOO.BAR");
> >>                  //    Debug.Assert(destination is IQueue);
> >>                  //    IDestination destination =
> >> session.GetDestination("topic://FOO.BAR");
> >>                  //    Debug.Assert(destination is ITopic);
> >>
> >>                  IDestination destination =
> >> SessionUtil.GetDestination(session, "queue://FOO.BAR");
> >>                  Console.WriteLine("Using destination: " + destination);
> >>
> >>                  // Create a consumer and producer
> >>                  using (IMessageConsumer consumer =
> >> session.CreateConsumer(destination))
> >>                  using (IMessageProducer producer =
> >> session.CreateProducer(destination))
> >>                  {
> >>                      // Start the connection so that messages will be
> >> processed.
> >>                      connection.Start();
> >>                      //producer.Persisten = true;
> >>
> >>                      // Send a message
> >>                      ITextMessage request =
> >> session.CreateTextMessage("Hello
> >> World!");
> >>                      request.NMSCorrelationID = "abc";
> >>                      request.Properties["NMSXGroupID"] = "cheese";
> >>                      request.Properties["myHeader"] = "Cheddar";
> >>
> >>                      producer.Send(request);
> >>
> >>                      // Consume a message
> >>                      ITextMessage message = consumer.Receive() as
> >> ITextMessage;
> >>                      if (message == null)
> >>                      {
> >>                          Console.WriteLine("No message received!");
> >>                      }
> >>                      else
> >>                      {
> >>                          Console.WriteLine("Received message with ID:
> "
> >> +
> >> message.NMSMessageId);
> >>                          Console.WriteLine("Received message with text:
> "
> >> +
> >> message.Text);
> >>                      }
> >>                  }
> >>              }
> >>          }
> >>      }
> >> }
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://activemq.2283324.n4.nabble.com/No-IConnectionFactory-implementation-found-for-connection-URI-activemq-tcp-localhost-61616-tp4665743.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >
> >
> >
> >
> > --
> > Tim Bish
> > Sr Software Engineer | RedHat Inc.
>
> > tim.bish@
>
> >  | www.fusesource.com | www.redhat.com
> > skype: tabish121 | twitter: @tabish121
> > blog: http://timbish.blogspot.com/
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/No-IConnectionFactory-implementation-found-for-connection-URI-activemq-tcp-localhost-61616-tp4665743p4665767.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message