I will like to use Activemq as a websocket message broker. I used it before, but always with TCP socket (topics). Activemq (version: 5.6.0) is running in same computer, but not as an embedded broker. Now I will like to use it with websocket.
The client side is done (webrowser with html5 and websockets), it connects to the broker, but I'm having problems in my Java application. My java application must send messages to broker and this to the clients, but when I try to create the connection in the java application with the broker, the following exception is thrown: "Could not create Transport. Reason: java.io.IOException: createTransport() method not implemented!" I don't know what is wrong. Here is my code: /***** public class WebSocketProducer implements ExceptionListener { private static WebSocketProducer instance = null; private Context ctx = null; private TopicSession session = null; private Properties properties = null; private TopicConnection connection = null; private WebSocketProducer() throws ProducerException{ init(); } private void init() throws ProducerException { try { Properties defaults = new Properties(); defaults.setProperty("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); defaults.setProperty("java.naming.provider.url", "ws://localhost:61614"); //read the configuration file (wjms.properties) properties = Utilities.getProperties("wjms.properties", defaults); ctx = new InitialContext(properties); TopicConnectionFactory connectionFactory = (TopicConnectionFactory) ctx.lookup("TopicConnectionFactory"); connection = connectionFactory.createTopicConnection(); connection.setExceptionListener(this); connection.start(); session = connection.createTopicSession( false, Session.AUTO_ACKNOWLEDGE); } catch (Exception e) { ProducerException mpe = new ProducerException(); mpe.initCause(e); throw mpe; } } public void publishMessage(String topic, Message message) throws MessageException { try { Topic myTopic = (Topic)ctx.lookup(topic); TopicPublisher publisher = session.createPublisher(myTopic); // Messages will expire in 24h publisher.setTimeToLive(86400000L); publisher.publish(message); publisher.close(); } catch (Exception e) { String messageId = ""; try { messageId = (message != null) ? message.getJMSMessageID() : ""; } catch (JMSException e1) { e1.printStackTrace(); } MessageException me = new MessageException(messageId); me.initCause(e); throw me; } } } *****/ -- View this message in context: http://activemq.2283324.n4.nabble.com/Could-not-create-Transport-Reason-java-io-IOException-createTransport-method-not-implemented-tp4678384.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.