0

I am trying to create a Java app on windows machine. I need to connect to a Wildfly server running on Linux VM to access the Topics on Wildfly server. But I am getting the below error : Failed to connect to any server. Servers tried: [http-remoting://[myhostname]:8080 (java.net.ConnectException: Connection refused: The Wildfly server is running on default standalone configuration with messaging capabilities.

My code :

Properties jndiProperties = new Properties();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put("jboss.naming.client.ejb.context", "true");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "http-remoting://[myhostname]");
//Create and start connection  
InitialContext ctx=new InitialContext(jndiProperties);  
TopicConnectionFactory f=(TopicConnectionFactory)ctx.lookup("jms/RemoteConnectionFactory");  
TopicConnection con=f.createTopicConnection(); 

This works correctly when I use localhost, but not when I try to connect to Wildfly on VM.

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
Gaurav
  • 1

0 Answers0