Hi,

I am trying to use activemq-cpp as a message producer and I cannot get the system setup. I have built and installed activemq-cpp using the distro versions of apr and aprutil on Ubuntu 17.04. When I try and create a ConnectionFactory with the following code (simplified from my process for isolating the problem) I get a segfault:

#include <activemq/core/ActiveMQConnectionFactory.h>
#include <activemq/util/Config.h>
#include <activemq/library/ActiveMQCPP.h>
#include <cms/Connection.h>
#include <cms/Session.h>
#include <cms/TextMessage.h>

#include <iostream>
#include <sstream>
#include <string>

using namespace std;
using namespace cms;
using namespace activemq;
using namespace activemq::core;

int main(int argc, char **argv)
{
    ConnectionFactory *mFactory;
    Connection *mConnection;
    Session *mSession;
    Destination *mDestination;
    MessageProducer *mProducer;

    string brokerURI = "tcp://localhost:61613?wireFormat=stomp";

    try
    {
mFactory = ConnectionFactory::createCMSConnectionFactory(brokerURI);
        if (!mFactory)
throw runtime_error("Failed to create ActiveMQ Connection Factory");

...

    }
    catch (CMSException &e)
    {
        throw runtime_error(e.what());
    }

    return 0;
}

And the segfault is:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77a1707 in decaf::internal::util::concurrent::Threading::lockThreadsLib () at decaf/internal/util/concurrent/Threading.cpp:866
866         PlatformThread::lockMutex(library->globalLock);
(gdb) where
#0 0x00007ffff77a1707 in decaf::internal::util::concurrent::Threading::lockThreadsLib () at decaf/internal/util/concurrent/Threading.cpp:866 #1 0x00007ffff7830916 in decaf::util::concurrent::Mutex::lock (this=0x5555557724c0) at decaf/util/concurrent/Mutex.cpp:120 #2 0x00007ffff7830535 in decaf::util::concurrent::Lock::lock (this=0x7fffffffda30) at decaf/util/concurrent/Lock.cpp:54 #3 0x00007ffff7830665 in decaf::util::concurrent::Lock::Lock (this=<optimized out>, object=<optimized out>, intiallyLocked=<optimized out>) at decaf/util/concurrent/Lock.cpp:32 #4 0x00007ffff74de552 in activemq::core::ActiveMQConnectionFactory::setBrokerURI (this=this@entry=0x55555576f9e0, uri=...) at activemq/core/ActiveMQConnectionFactory.cpp:471 #5 0x00007ffff74de809 in activemq::core::ActiveMQConnectionFactory::ActiveMQConnectionFactory (this=0x55555576f9e0, uri="tcp://localhost:61613?wireFormat=stomp", username="",
    password="") at activemq/core/ActiveMQConnectionFactory.cpp:257
#6 0x00007ffff74dea99 in cms::ConnectionFactory::createCMSConnectionFactory (brokerURI="tcp://localhost:61613?wireFormat=stomp") at activemq/core/ActiveMQConnectionFactory.cpp:245 #7 0x0000555555554db4 in main (argc=<optimized out>, argv=<optimized out>) at test.cpp:28


Am I doing something wrong?

Thanks,
Eric

Reply via email to