Issues running multiple servers on the same machine

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
peter.dalton
Posts: 11
Joined: 10 Aug 2010, 21:51

Issues running multiple servers on the same machine

Post by peter.dalton »

I'm trying to run 2 different servers on the same machine under different ports. This is necessary to simulate a development and production environment without increasing hardware costs. However I get the following error when the 2nd server is started. I should mention that the servers are running on a Linux box. It also seems to be impossible to connect the admin tools to a server that isn't running under the default port of 9933.

14:35:34,334 INFO [main] api.SFSApi - Room created: [ Room: The Lobby, Id: 4, Group: default, isGame: false ]
14:35:34,352 DEBUG [main] Extensions - {Admin}: Admin Extension started
14:35:34,354 INFO [main] api.SFSApi - Room created: [ Room: AdminRoom, Id: 5, Group: default, isGame: false ]
14:35:34,362 INFO [main] core.AdminToolService - AdminTool Service started
14:35:36,036 ERROR [main] v2.SmartFoxServer -
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.net.BindException
Message: Address already in use
Description: Unexpected error during Server boot. The server cannot start.
Solution: Please email us the content of this error message, including the stack trace to support@smartfoxserver.com
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.nio.ch.Net.bind(Native Method)
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137)
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
org.mortbay.jetty.Server.doStart(Server.java:235)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
com.smartfoxserver.v2.http.SFSHttpServer.start(SFSHttpServer.java:93)
com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:197)
com.smartfoxserver.v2.Main.main(Main.java:31)
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

You have to configure the two server instances separately, before running them at the same time. Please notice you also have to configure the port used by the Admin Tool to connect to each instance.
Paolo Bax
The SmartFoxServer Team
peter.dalton
Posts: 11
Joined: 10 Aug 2010, 21:51

Post by peter.dalton »

I have configured the two server instances separately. Both are set to use the same IPs however one is on port 9933 and the other is on port 9940, however I get the error reported. I have also configured the admin tool to use port 9940 however I still can't connect. After numerous tests it is my belief that the admin tool can not connect to anything not using the default port of 9933.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

I think the bind error you are seeing is caused by the embedded Jetty webserver which runs on port 8080 and that must be configured separately.

You have two options. Either turn the webserver off or configure it so that it uses a free TCP port, maybe 8081 or so.
This is done by editing config/jetty/jetty.xml
Search for "8080" and substitute it with a free port number
Lapo
--
gotoAndPlay()
...addicted to flash games
peter.dalton
Posts: 11
Joined: 10 Aug 2010, 21:51

Post by peter.dalton »

The Jetty server was the problem, thanks a lot. Note that I still have issues trying to connect the admin tool to any server not using the default port of 9933.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yes, because you need to configure the Admin Port. Admin access is regulated by the port numbers that you have specified in the config.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply