Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: NDatabase has not loaded yet #11

Open
apollyon600 opened this issue Feb 20, 2024 · 5 comments
Open

java.lang.IllegalStateException: NDatabase has not loaded yet #11

apollyon600 opened this issue Feb 20, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@apollyon600
Copy link

I came across NDatabase and it looked like it had everything that I needed.
Decided to test it out but whenever I try to call the API of NDatabase, it always says it wasn't loaded.
I looked at logs and it seems like it had successfully connected to mongo, but no matter how long I wait to use the API, it says it hasn't been loaded.

I even compiled my own version of NDatabase that logs the exact moment of when the api had successfully been loaded via reflection, but to my own avail, it still isn't working.

@NivixX
Copy link
Owner

NivixX commented Feb 22, 2024

Hello, do you have any exception ? The NDatabaseAPI instance is indeed set using reflection to avoid exposing a set method, if something wrong happened with reflection, you should see a 'Failed to load NDatabase...' exception.
If not, maybe the resolved instance is null for some reason (I use Google Guice for dependency injection).

You can try to do that:

  • Verify if no exception is thrown.
  • Log the NDatabase resolved instance and check if it's null.
  • You can also try to run your server only with NDatabase + your plugin.

Here is where you can add logging
https://github.com/NivixX/NDatabase/blob/main/ndatabase-core/src/main/java/com/nivixx/ndatabase/core/PlatformLoader.java#L81

Let me know what is your Java/Spigot version so if your issue is not solved I can try to reproduce when I'm free.

@Hellcode48
Copy link

I'm having the same issue on 1.20.4.

I did everything correct, there's no errors at all

@NivixX
Copy link
Owner

NivixX commented Mar 22, 2024

I'm having the same issue on 1.20.4.

I did everything correct, there's no errors at all

Hello, If you could test with only NDatabase and your plugin and telling me what java version and what spigot fork you use, it would help me. I'm trying to reproduce the issue with paperSpigot 1.20.4 with java 17 and I don't have the issue

@Hellcode48
Copy link

I'm having the same issue on 1.20.4.
I did everything correct, there's no errors at all

Hello, If you could test with only NDatabase and your plugin and telling me what java version and what spigot fork you use, it would help me. I'm trying to reproduce the issue with paperSpigot 1.20.4 with java 17 and I don't have the issue

I can't really only test with it because my plugin requires a few other plugins. Here's my code, lmk if I'm doing something wrong.

It's 1.20.4 Paper Spigot Java 17

https://pastebin.com/m0JjqZJ8

https://pastebin.com/cD7q8ddn

https://pastebin.com/8gqgrjJ8

It's been a few years since I coded java so I'm not sure if I'm doing anything correctly lol

@NivixX NivixX added bug Something isn't working and removed resolved (but not confirmed) labels Mar 24, 2024
@NivixX
Copy link
Owner

NivixX commented Mar 24, 2024

I'm having the same issue on 1.20.4.
I did everything correct, there's no errors at all

Hello, If you could test with only NDatabase and your plugin and telling me what java version and what spigot fork you use, it would help me. I'm trying to reproduce the issue with paperSpigot 1.20.4 with java 17 and I don't have the issue

I can't really only test with it because my plugin requires a few other plugins. Here's my code, lmk if I'm doing something wrong.

It's 1.20.4 Paper Spigot Java 17

https://pastebin.com/m0JjqZJ8

https://pastebin.com/cD7q8ddn

https://pastebin.com/8gqgrjJ8

It's been a few years since I coded java so I'm not sure if I'm doing anything correctly lol

You are using the API correctly, therefore I'm not able to reproduce the issue with Java 1.20.4 and java 17
I did a small change that do some inforce and change dependency injection method, you can try
https://github.com/NivixX/NDatabase/releases/tag/1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants