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

[BUG] Crash when using mongodb #15

Closed
molaeiali opened this issue Sep 27, 2021 · 2 comments
Closed

[BUG] Crash when using mongodb #15

molaeiali opened this issue Sep 27, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@molaeiali
Copy link

molaeiali commented Sep 27, 2021

Versions

  • EasyAuth 1.17.1-1.9.7
  • Fabric API 0.40.1+1.17

Describe the bug
I'm getting class not found error when trying to use mongodb:

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'easyauth'!
	at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50) ~[fabric-server-launch.jar:?]
	at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke(EntrypointUtils.java:33) ~[fabric-server-launch.jar:?]
	at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointServer.start(EntrypointServer.java:33) ~[fabric-server-launch.jar:?]
	at net.minecraft.server.Main.main(Main.java:97) [intermediary-server.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
	at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:234) [fabric-server-launch.jar:?]
	at net.fabricmc.loader.launch.knot.Knot.launch(Knot.java:153) [fabric-server-launch.jar:?]
	at net.fabricmc.loader.launch.knot.KnotServer.main(KnotServer.java:28) [fabric-server-launch.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
	at net.fabricmc.loader.launch.server.FabricServerLauncher.launch(FabricServerLauncher.java:68) [fabric-server-launch.jar:?]
	at net.fabricmc.loader.launch.server.FabricServerLauncher.setup(FabricServerLauncher.java:114) [fabric-server-launch.jar:?]
	at net.fabricmc.loader.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:56) [fabric-server-launch.jar:?]
Caused by: java.lang.NoClassDefFoundError: com/mongodb/ConnectionString
	at com.mongodb.client.MongoClients.create(MongoClients.java:61) ~[94984c79-61c2-47e9-af30-78cd60fd5e38.jar:?]
	at xyz.nikitacartes.easyauth.storage.database.MongoDB.initialize(MongoDB.java:25) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.storage.DBHelper.openConnection(DBHelper.java:18) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.EasyAuth.init(EasyAuth.java:81) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.EasyAuth.onInitialize(EasyAuth.java:108) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:47) ~[fabric-server-launch.jar:?]
	... 17 more
Caused by: java.lang.ClassNotFoundException: com.mongodb.ConnectionString
	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[?:?]
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
	at net.fabricmc.loader.launch.server.InjectingURLClassLoader.loadClass(InjectingURLClassLoader.java:57) ~[fabric-server-launch.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
	at net.fabricmc.loader.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:175) ~[fabric-server-launch.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
	at com.mongodb.client.MongoClients.create(MongoClients.java:61) ~[94984c79-61c2-47e9-af30-78cd60fd5e38.jar:?]
	at xyz.nikitacartes.easyauth.storage.database.MongoDB.initialize(MongoDB.java:25) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.storage.DBHelper.openConnection(DBHelper.java:18) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.EasyAuth.init(EasyAuth.java:81) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at xyz.nikitacartes.easyauth.EasyAuth.onInitialize(EasyAuth.java:108) ~[easyauth-mc1.17.1-1.9.7.jar:?]
	at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:47) ~[fabric-server-launch.jar:?]
	... 17 more

To Reproduce
config:

"main": {
...
    "useMongoDB": true,
...
    ]
  },
"mongoDBCredentials": {
    "username": "easyauth",
    "password": "easyauthpass",
    "userSourceDatabase": "admin",
    "host": "127.0.0.1",
    "port": 27017,
    "easyAuthDatabase": "easyauth",
    "useSsl": true
  },

Expected behavior
Connect to the database?

Additional context
I installed the mongodb 4.4.9 on ubuntu 20.04, created a user for it, tried to configure the mod to use it but looks like it has problems with mongodb driver

@molaeiali molaeiali added the bug Something isn't working label Sep 27, 2021
@NikitaCartes
Copy link
Owner

@molaeiali. thanks for report.

Yeah, i didn't tested MongoDB at all (until now).

I added in jar two more libraries which needed for sucesfull connection (idk how it worked previously, for me 1.7.5 didn't work).

You can download it here (click Artifacts button).
I'm not sure that it fully work but at least it don't crash server.

@NikitaCartes
Copy link
Owner

NikitaCartes commented Sep 28, 2021

@molaeiali

Change config.json a little bit.

Before:

"main": {
    ...
    "useMongoDB": true,
    ...
    ]
  },
"mongoDBCredentials": {
    "username": "easyauth",
    "password": "easyauthpass",
    "userSourceDatabase": "admin",
    "host": "127.0.0.1",
    "port": 27017,
    "easyAuthDatabase": "easyauth",
    "useSsl": true
  },

Now:

"main": {
  ...
  "useMongoDB": true,
  "MongoDBConnectionString": "mongodb://[username:password@]host[:port][/[defaultauthdb][?options]]",
  "MongoDBDatabase": "EasyAuthPlayerData",
  ...
},

That's harder for users but I think they know how to do it since they want to use MongoDB.

In your case it would be something like:
mongodb://easyauth:easyauthpass@127.0.0.1:27017/admin

You can download it here

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

2 participants