yariplus / minecraft-nodebb-integration

A plugin for Minecraft servers for integration with a NodeBB forum.
Creative Commons Zero v1.0 Universal
9 stars 4 forks source link

Connection refused #28

Closed Couby closed 8 years ago

Couby commented 8 years ago

Hi,

Still trying to get minecraft-nodebb-integration working :blush: .

Now I'm having a connexion error.

[22:34:43 WARN]: java.net.ConnectException: Connection refused [22:34:43 WARN]: at java.net.PlainSocketImpl.socketConnect(Native Method) [22:34:43 WARN]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) [22:34:43 WARN]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) [22:34:43 WARN]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) [22:34:43 WARN]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [22:34:43 WARN]: at java.net.Socket.connect(Socket.java:589) [22:34:43 WARN]: at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) [22:34:43 WARN]: at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) [22:34:43 WARN]: at sun.net.NetworkClient.doConnect(NetworkClient.java:180) [22:34:43 WARN]: at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) [22:34:43 WARN]: at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) [22:34:43 WARN]: at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264) [22:34:43 WARN]: at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) [22:34:43 WARN]: at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) ...

For the moment I just rout the server port. Are there any other ports or network settings required by this plugin in order to work :question:

Regards

yariplus commented 8 years ago

Are you using SSL? I have not tested this without SSL.

Couby commented 8 years ago

Yes I'm using it on NodeBB side. But not on Bukkit server side.

yariplus commented 8 years ago

Could you post the your config.yml, without the apikey and messages section?

Couby commented 8 years ago

Yep :

forum:
  url: *https://myforumurl.com/*
  name: *MyForumName*
  apikey: *my_API_key_from_NBBForum*
socketio:
  address: *https://myforumurl.com/*
  transports:
  - polling
  - websocket
  namespace: plugins.MinecraftIntegration
yariplus commented 8 years ago

Thanks.

Does opening https://myforumurl.com/ in the browser get properly redirected?

What CA are you using? (Let's Encrypt, StartSSL, etc..) Are you using cloudflare at all?

yariplus commented 8 years ago

I'm trying to reproduce the error. The only way I can make it happen so far is when the forum url is misspelled.

Couby commented 8 years ago

I'll check again the config.yml and will also try with volontary misspelled url to see if there is a difference on my side. Could you share also your config.yml, without the apikey and messages section ?

Couby commented 8 years ago

Misspelling the url I have a different error message :

[19:14:13 ERROR]: [NodeBB-Integration] Can't connect to forum at https://minet4c.osezlejeu.co/
[19:14:13 ERROR]: [NodeBB-Integration] Use `/nodebb url URL` to set the forum address.

Trying to set the url this way give me the following error :

[19:14:49 INFO]: Unknown command. Type "help" for help.
yariplus commented 8 years ago

Sure thing

forum:
  url: https://yaricraft.com/
  name: '&aYaricraft Forums'
  apikey: seekrit
socketio:
  address: https://ika.yaricraft.com/
  transports:
  - polling
  - websocket
  namespace: plugins.MinecraftIntegration

I use a different socketio address because I use cloudflare, but yours should be the same as the forum url.

yariplus commented 8 years ago

nvm, I see you misspelled it on purpose, dang, that's very weird.

Couby commented 8 years ago

Result wit debug toggle :

[19:20:08 INFO]: [NodeBB-Integration] Reconnecting socket...
[19:20:08 INFO]: Reloaded PluginConfig.
[19:20:08 INFO]: [NodeBB-Integration] Reloaded PluginConfig.
[19:20:08 INFO]: [NodeBB-Integration] Getting Cookie.
[19:20:08 INFO]: [NodeBB-Integration] The forum URL was invalid.
[19:20:08 WARN]: java.net.ConnectException: Connexion refusée
[19:20:08 WARN]:    at java.net.PlainSocketImpl.socketConnect(Native Method)
[19:20:08 WARN]:    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
[19:20:08 WARN]:    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
[19:20:08 WARN]:    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
[19:20:08 WARN]:    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
[19:20:08 WARN]:    at java.net.Socket.connect(Socket.java:589)
[19:20:08 WARN]:    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
[19:20:08 WARN]:    at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
[19:20:08 WARN]:    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
[19:20:08 WARN]:    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
[19:20:08 WARN]:    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
[19:20:08 WARN]:    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
[19:20:08 WARN]:    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
[19:20:08 WARN]:    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
[19:20:08 WARN]:    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
[19:20:08 WARN]:    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
[19:20:08 WARN]:    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
[19:20:08 WARN]:    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
[19:20:08 WARN]:    at com.radiofreederp.nodebbintegration.socketio.SocketIOClient.getCookie(SocketIOClient.java:182)
[19:20:08 WARN]:    at com.radiofreederp.nodebbintegration.socketio.SocketIOClient.lambda$connectSocket$13(SocketIOClient.java:137)
[19:20:08 WARN]:    at com.radiofreederp.nodebbintegration.NodeBBIntegrationBukkit$1.run(NodeBBIntegrationBukkit.java:68)
[19:20:08 WARN]:    at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftTask.run(CraftTask.java:53)
[19:20:08 WARN]:    at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
[19:20:08 WARN]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[19:20:08 WARN]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[19:20:08 WARN]:    at java.lang.Thread.run(Thread.java:745)

Something is going wrong with the url format, looks crazy, sorry with this strange issue.

yariplus commented 8 years ago

You mean the 4 is causing the /nodebb url command to fail?

yariplus commented 8 years ago

Is the mc server running on the same machine as the forum? Maybe the issue is with port access as you originally suggested.

yariplus commented 8 years ago

Yep, same machine as the forum, also on a non-standard port.

yariplus commented 8 years ago

I can connect successfully to your forum from my machine, so I can only think it's some setting in your box. I can't imagine what it could be though.

yariplus commented 8 years ago

Nope, that all looks normal.

For the server IP field in the forum, this should be the server domain name, as it is only used for user display. The forum never connects to the mc server, only the mc server to the forum. The error just means the mc server has never connected.

I think you need root to read the access.log and error.log files. See if you can see them that way.

Couby commented 8 years ago

You mean mc server logs ?

I moved the forum and mc server on the same machine. I'm using http://127.0.0.1:4567 as url and socket live adress.

Things look a bit better. I don't have the error message anymore. But using nodebb toggle command I see the forum is not connected :

[22:16:18 INFO]: The server is currently DISCONNECTED from the forum.

yariplus commented 8 years ago

Well, that's something I guess.

Try /nodebb debug toggle /nodebb reload

Couby commented 8 years ago

Here is what I get, with a /nodebb debug just after :

nodebb reload [05:49:02 INFO]: [NodeBB-Integration] Reconnecting socket... [05:49:02 INFO]: Reloaded PluginConfig. [05:49:02 INFO]: [NodeBB-Integration] Reloaded PluginConfig. [05:49:02 INFO]: [NodeBB-Integration] Getting Cookie. [05:49:02 INFO]: [NodeBB-Integration] Got Cookie: null nodebb debug [05:49:07 INFO]: The server is currently DISCONNECTED from the forum. [05:49:07 INFO]: Forum Name is The Next Craft [05:49:07 INFO]: Forum URL is http://127.0.0.1:4567 [05:49:07 INFO]: Forum API Key is _my_apikey [05:49:07 INFO]: Socket Live Address is http://127.0.0.1:4567 [05:49:07 INFO]: Post bugs to https://goo.gl/qSy6BP [05:49:07 INFO]: Use /nodebb debug toggle to toggle verbose logging.

My setup :

System :

yariplus commented 8 years ago

I'm guessing that is from using the localhost address. I am getting a valid cookie using the full domain from my PC. I'm not sure why you can't use the domain from the same machine.

What is the result now after /nodebb url tnc.osezlejeu.com

Couby commented 8 years ago

What is the result now after /nodebb url tnc.osezlejeu.com

The same error :( :

[06:52:04 INFO]: Set forum url to tnc.osezlejeu.com [06:52:04 WARN]: java.net.ConnectException: Connexion refusée [06:52:04 WARN]: at java.net.PlainSocketImpl.socketConnect(Native Method) [06:52:04 WARN]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

Maybe I should try to reinstall "MC server"...

Couby commented 8 years ago

Tried with a vanilla server on my local computer. It works.

So I tried on the CT with a vanilla server. Doesn't work... That makes me think could be because it is a CT... will try with a VM.

Couby commented 8 years ago

... will try with a VM.

Not better :blush: . Clearly a local network setup issue...

yariplus commented 8 years ago

That's what I'm leaning towards. I just don't have enough network knowledge to tell you where to look for the problem.

Couby commented 8 years ago

Thanks anyway. If I find a solution, I'll report about it. Maybe my next attempt will be a local DNS to route correctly the https forum request from mc server locally...

Couby commented 8 years ago

That's it, yeeeaaahh. :blush:

I simply added an entry in /etc/hosts to force routing the https://[my forum url] request from MC Server to my local proxy machine.

Now that works :).