java.lang.NoSuchMethodError: org.apache.activemq.thread.TaskRunnerFactory.setThreadClassLoader(Ljava/lang/ClassLoader;)V
at org.apache.activemq.broker.BrokerService.getTaskRunnerFactory(BrokerService.java:1265)
at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:2346)
at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:2305)
at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:1017)
at org.apache.activemq.broker.BrokerService.getAdminConnectionContext(BrokerService.java:2576)
at org.apache.activemq.broker.BrokerService.startVirtualConsumerDestinations(BrokerService.java:2717)
at org.apache.activemq.broker.BrokerService.startDestinations(BrokerService.java:2567)
at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:726)
at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:720)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:623)
at com.bp.pnc.publisher.app.PncPublisherApplication.main(PncPublisherApplication.java:77)
The code I am using is
BrokerService broker = new BrokerService();
TransportConnector connector = new TransportConnector();
connector.setUri(new URI("tcp://localhost:61616"));
broker.addConnector(connector);
broker.start();
The problem occurs at broker.start() method. I am using activemq 5.14.0. I am using Java 7. I looked at the documentation and exact line where this is happening.
this.taskRunnerFactory.setThreadClassLoader(this.getClass().getClassLoader());