Ich versuche, eine Remoteverbindung zu einem Thema herzustellen, das auf einem in einem JBOSS EAP 6.2 eingebetteten HornetQ konfiguriert ist. Ich habe verschiedene Ansätze tryied so zu tun, aber alle gaben mir den gleichen Fehler:Verbindung fehlgeschlagen zu einem HornetQ-Thema eingebettet in einem JBOSS EAP 6.2
javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:676)
at org.hornetq.jms.client.HornetQConnectionFactory.createTopicConnection(HornetQConnectionFactory.java:196)
at TesteTags.main(TesteTags.java:82)
Caused by: HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:950)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672)
... 2 more
Ich folgte die Informationen auf diesem Schnellstart: Jboss Eap Quickstart: helloworld-jms
meinen Code folgen:
try {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
env.put(Context.SECURITY_PRINCIPAL, "testuser");
env.put(Context.SECURITY_CREDENTIALS, "testpassword");
Context context = new InitialContext(env);
TopicConnectionFactory factory = (TopicConnectionFactory) context.lookup("jms/RemoteConnectionFactory");
Topic topic = (Topic) context.lookup("jms/topic/myTopic");
Connection connection = factory.createTopicConnection("testuser", "testpassword"); // The Error occurred here
connection.start();
Session session = connection.createSession(false, TopicSession.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(topic);
Message message = session.createTextMessage("My Test Message");
producer.send(message);
System.out.println("It Worked!");
} catch (Exception e) {
System.out.println("It Failed!");
e.printStackTrace();
}
I verwende ein Standalone-Full-Ha-Profil mit den Standardkonfigurationen.
Mache ich etwas falsch an meinem Code? Oder gibt es eine andere Konfiguration als die Standardeinstellungen, die ich tun muss?
ich diese Bibliothek bin mit: [jboss-as-jms-client-bom-7.2.0] (http://mvnrepository.com/ artefakt/org.jboss.as/jboss-als-jms-client-bom/7.2.0.Final) Beliebig Übrigens habe ich verschiedene Versionen ausprobiert und es machte keinen Unterschied. –