We've just moved into production with JBoss after developing for a year and have found a critical error inside of JBoss that I am hoping someone has a workaround. The following code works great inside a local area network; however, it locks up the client AND worse jboss when a user tries to connect from the internet through firewall. The firewall is completely open for all ports for the ip address. I have put print statements in my code and have determined that it hangs on the createSubscriber(topic) call below. Essentially, I am sending a message round trip so I need a publisher and subscriber. A call to createSubscriber subsequently locks the client and the JBoss server. I am using the latest 3.0 release with tomcat. Is this a bug that has been fixed (hopefully can get a patch) or am I missing something in the jms xml configuration that is non standard? I am creating temporary topics through mbean and the topic already exist. As I said before, internally, everything works great. HELP!!!
private void initializeTopicConnection() {
InitialContext jndiContext = null;
try {
jndiContext = new InitialContext();
JComboBox cb = getPortGroupComboBox();
String selectedObject = (String) cb.getSelectedItem();
TopicConnectionFactory topicFactory =
(TopicConnectionFactory) jndiContext.lookup("ConnectionFactory");
Topic topic = (Topic) jndiContext.lookup("topic/"+selectedObject);
topicConnection = topicFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(
// No transaction
false,
// Auto ack
Session.AUTO_ACKNOWLEDGE);
publisher = topicSession.createPublisher(topic);
TopicSubscriber subscriber = topicSession.createSubscriber(topic);
subscriber.setMessageListener(this);
topicConnection.start();
} catch (Exception e) {
System.out.println("Failed to initialize Topic Connection: " + e.toString());
} finally {
try {
if (jndiContext != null) {
jndiContext.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}