Linux – Connection Refused Error Java/Linux

javalinuxportsocket

I'm trying to move an existing project over to a new (linux) server environment (note, I have no direct access to the code nor do I have any knowledge about the project in general – talk about a great start), upon starting the project I receive the following error:

Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: <servername>:1459 [Root exception is javax.naming.CommunicationException: Failed to connect to server <servername>:1459 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server <servername>:1459 [Root exception is java.net.ConnectException:     Connection refused]]]
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.jboss.Shutdown.main(Shutdown.java:214)
Caused by: javax.naming.CommunicationException: Failed to connect to server <servername> [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server <servername>:1459 [Root exception is java.net.ConnectException: Connection refused]]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
    ... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server <servername>:1459 [Root exception is java.net.ConnectException: Connection refused]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
    ... 5 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:478)
    at java.net.Socket.<init>(Socket.java:375)
    at java.net.Socket.<init>(Socket.java:276)
    at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
    at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
    ... 5 more

Now, I've opened the port in question to see whether there are any changes when I do so, alas, nothing happens.

I'm sorry about this very vague level of information, but it's really all I have, I'll gladly provide what I can if you have any ideas what could be at fault here.

Regards,

Dennis

Best Answer

It's simple, no one listen on port 1459. You configured jboss not exactly as on previous setup. Here is defaults for varios jboss versions http://shrubbery.mynetgear.net/c/display/W/JBoss+Ports and https://docs.jboss.org/author/display/AS7/Interfaces+and+ports?_sscc=t

and snipplets from articles:

JBoss 7.x Ports

Defined in standalone.xml (or what you're using for start jboss)

<socket-binding name="jndi" port="1099"/>
   <socket-binding name="jmx-connector-registry" port="1090"/>
   <socket-binding name="jmx-connector-server" port="1091"/>
   <socket-binding name="http" port="8080"/>
   <socket-binding name="https" port="8443"/>
   <socket-binding name="jacorb" port="3528"/>
   <socket-binding name="jacorb-ssl" port="3529"/>
   <socket-binding name="osgi-http" port="8090"/>
   <socket-binding name="remoting" port="4447"/>
   <socket-binding name="txn-recovery-environment" port="4712"/>
   <socket-binding name="txn-status-manager" port="4713"/>
   <socket-binding name="messaging" port="5445"/>
   <socket-binding name="messaging-throughput" port="5455"/>
</socket-binding-group>

JBoss 6.X Ports Most of the default ports are listed in server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml.

1090 RMI/JRMP for Remote JMX
1091 RMI server socket
1098 Naming Service - RMI requests from client proxies
1099 Naming Service - Main port
3873 EJB3 Remoting Connector
4446 JBoss Remoting Connector - Unified Invoker
4712 JBossTS Recovery Manager
4713 JBossTS Transaction Status Manager
4714 JBossTS - used to create a unique process id
5445 HornetQ
5455 Socket for HornetQ throughput connection factory
5500 Non-SSL Remoting
5501 SSL Remoting
8009 AJP Port
8080 HTTP Port
8083 Dynamic class and resource loading 

JBoss 4.x Ports

 1099 ./conf/jboss-service.xml or ./naming.sar/META-INF/jboss-service.xml Bootstrap JNP port. 
 1098 (anon) ./conf/jboss-service.xml or ./naming.sar/META-INF/jboss-service.xml RMI naming service port. Use '0' for an anonymous port. 
 4444 ./conf/jboss-service.xml or ./deploy/invokers-service.xml RMI/JRMP invoker port
 4445 ./conf/jboss-service.xml or ./deploy/invokers-service.xml Pooled invoker
 8083 ./conf/jboss-service.xml or ./deploy/dynclassloader-service.xml RMI dynamic class loader port
 8080 ./deploy/jbossweb-tomcat55.sar/server.xml HTTP port for the web container
 8009 ./deploy/jbossweb-tomcat55.sar/server.xml AJP port for the web container
 8093 ./deploy/jms/uil2-service.xml UIL for JMS.
 8443 (optional) ./deploy/jbossweb-tomcat55.sar/server.xml HTTPS port for the web container