d03n3rfr1tz3 / Bukkit.JSONAPI

A simple JSON API for Minecraft Bukkit-Server, based on https://github.com/alecgorge/jsonapi
http://mcjsonapi.com
6 stars 2 forks source link

Plugin doesn't work properly #2

Closed frdmn closed 9 years ago

frdmn commented 9 years ago

Hello @d03n3rfr1tz3

I have a little issue with your fork. For me it loads, but it doesn't accept any requests.

For some reason I don't have anything in the jsonapi.log and I am not quite sure how to troubleshoot this.

All I can say is that I updated our MC server to 1.8 and during this, we swtiched to your fork.

The listener is available for sure and also "speaks" HTTP.

Got an idea, how to debug this?

System informations:

krisdb2009 commented 9 years ago

If there are any errors that say anything about "Groups" not existing, then erase the jsonapi folder and restart the server.

BTW Thanks @d03n3rfr1tz3 For this awesome fork!!! Works great for me!

frdmn commented 9 years ago

@krisdb2009 No, nothing in the console.log nor in my external jsonapi.log:

2015-06-30 09:39:20 [INFORMATION] [JSONAPI] Loaded methods.json.
2015-06-30 09:39:20 [INFORMATION] [JSONAPI] Waiting 2,000 seconds to load methods so that all the other plugins load...
2015-06-30 09:39:20 [INFORMATION] [JSONAPI] Any requests in this time will not work...
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] Remote Toolkit cannot be loaded because it depends on a plugin that is not installed: 'RemoteToolkitPlugin'
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] 446 methods loaded in 8 namespaces.
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] ------[Connection information]-------
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] JSON Server listening on 20059
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] JSON Stream Server listening on 20060
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] JSON WebSocket Stream Server listening on 20061
2015-06-30 09:39:22 [INFORMATION] [JSONAPI] Active and listening for requests.
2015-06-30 09:39:23 [INFORMATION] [JSONAPI] -------------------------------------
krisdb2009 commented 9 years ago

You checked that it was listening by using a browser to visit http://whatever:20059 ? and when you try a query on the api it fails?

frdmn commented 9 years ago

No, I use since years JSONAPI for our automated application system (http://apply.yeahwh.at), to promote and demote players as well as announce messages ingame.

This used to work great, until I switched to 1.8 and during this upgrade I also switched to @d03n3rfr1tz3's forks. Unfortunately since then, the communication between apply center and JSONAPI stopped working.

As stated in the OP, the HTTP server on 20059 seems to work fine:

$ curl -IL localhost:20059/api/2/call
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 30 Jun 2015 07:55:52 GMT
Access-Control-Allow-Origin: *
Content-Length: 2
krisdb2009 commented 9 years ago

Did you notice that in the console it told you it was gonna wait 2,000 seconds to load any API methods? Thats ~ 33 minutes. Check your config.

frdmn commented 9 years ago

@krisdb2009 i guess the formatting is just "german" since my system locale is german. We use , as decimal seperators instead of ..

krisdb2009 commented 9 years ago

Try jsonapi on a blank server with the necessities like protocol-lib and vault. And a newly generated config.

d03n3rfr1tz3 commented 9 years ago

First: No you don't need to install the Vault plugin with my fork, as it isn't a complete copy with an updated MC version. I removed some dependencies and with them some methods (Vault, Adminium), that it's more like a vanilla server with a json api. That might not fit everyone and could be the real problem here.

Nevertheless, that whole thing sounds strange. I rechecked some code (as I didn't write 99% of it) and thinked about this whole problem, but I'm still a bit lost. I'm sure you checked your console for the line "Logging to file: ..." and "Logging to console: ..." and your configuration. Maybe a clean install of the JSONAPI (not the whole server) could help, but I can't imagine why something could prevent logging (except wrong config values). But wether it's logging to a file, it should still log errors (if there are errors) to the console.

If I would be in your situation and the logs are empty or not helpful, I would check what calls are made by your automated application system and doing them manually. If this doesn't help, I would use Fiddler or Wireshark to analyse the requests and their result. If the results of both tests are looking ok (json data with values and no "method doesn't exist"-result) there must be a problem in your automated application system. As the basic implementation for 1.8 is still from alec and I just "cleaned up" some things while increasing the MC version to 1.8.3+, there could be some breaking changes. But that's just wild guessing.

BTW: Thanks @krisdb2009 but the real Kudos still go to @alecgorge ;)

frdmn commented 9 years ago

@d03n3rfr1tz3 I just noticed something while looking at a clean and fresh config.yml. I am still using the use-new-api directive/feature in my config, which is set to false. But I cant find it in the newly generated one. Did you somehow got rid of that option?

d03n3rfr1tz3 commented 9 years ago

Ah yes, that's one of the changes. I removed the backwards compatibility and thus forced the "new" v2 API. So if your app is using the v1 API, it needs an update. Sorry for that. :-)

frdmn commented 9 years ago

Well, that explains all of this :)

I'll update my app accordingly. Thanks!