Closed ghost closed 6 years ago
It just failed to setup a connection to the database, which you can already see in a previous exception. FlexibleLogin now documents that you should write MySQL even if use MariaDB.
Thanks a lot, but I have some approvals. Java null-pointer errors are usually the result of one or more programmer assumptions being violated. Most null pointer issues result in general software reliability problems. I'm not sayiang that something is bad, but it happens at com.github.games647.flexiblelogin.listener.prevent.AbstractPreventListener.checkLoginStatus(AbstractPreventListener.java:56) ~[AbstractPreventListener.class:?]
link
I guess getDatabase() are null and you did not checked it by yourself.
You can catch this null and throw new exception that database is not found (saying that database not initialized or smth), or process it some another way.
that place
Look what happens
try {
database = new Database(this);
database.createTable();
} catch (SQLException sqlEx) {
logger.error("Cannot connect to auth storage", sqlEx);
Sponge.getServer().shutdown();
}
If you catch SQLException your database will be equal null, but you did not checked it in other places like in AbstractPreventListener:56 Also Sponge.getServer().shutdown(); if it works normally then shutting down goes not immediately (your instructions can proceed).
Yes you are right getDatabases() is null otherwise plugin would be null, because NPE only happens when you access a null value.
You can catch this null and throw new exception that database is not found (saying that database not initialized or smth), or process it some another way.
NullPointerException should never be catched. The values should be checked against null, but in this case it should be a @NonNull
value.
If you catch SQLException your database will be equal null, but you did not checked it in other places like in AbstractPreventListener:56
Yes and then the server should should shutdown. Other places outside of the main class will never see the null value.
Also Sponge.getServer().shutdown(); if it works normally then shutting down goes not immediately (your instructions can proceed).
It should shutdown at least when the server started up correctly before any players could join.
NullPointerException should never be catched. The values should be checked against null, but in this case it should be a @NonNull value.
Yes, this is correct. I said that you can catch null value, not null-pointer exception. You did not catched it and i've got null-pointer exception during gameplay appeared in your module when you accesing @nullable database value (not @nonnull).
I insist on fixing
As I said the server should shutdown if the database is not available so the issue is somewhere else.
As I said the server should shutdown if the database is not available so the issue is somewhere else. Now I delayed the server shutdown using the scheduler. That works now.
I figured out look exceptions That happens after I use command login, not after server starts, that looks like your mod have lazy initialization or smth like that. I start server - OK. I login into game - NOT ok - not asking me to ligin or register. I type forcibly /login pass - null pointer spawned
Config. database=flexiblelogin2 type=MySql
From previous reply:
Of course it causes other errors as well, but it's still the same cause.
Sorry for lot strange messages. I fount something new. why server not stopped Did not recognized that crashes because of lots of spam in console.
That is still a SQLException and will be caught by the catch block where the bug was that the server doesn't shutdown.
Ok, but I still don't understand - if you are not printing stack trace into stdout console why exception-messages appears and why this messages goes next:
Could not pass FMLPreInitializationEvent to Plugin{id=flexiblelogin, name=FlexibleLogin
com.google.common.util.concurrent.UncheckedExecutionException: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: For input string: "@%DIR%"
Okay you are right, UncheckedExecutionException
is not caught. I'll fix that.
Sorry
Thanks a lot!
https://gist.github.com/ternsip/a7bd7c490d95265894d5c3e6308b2ac4 [19:33:44] [Server thread/ERROR] [Sponge]: Could not pass MoveEntityEvent$Impl to Plugin{id=flexiblelogin, name=FlexibleLogin, version=0.16.8, description=Second Auth plugin for Sponge minecraft servers, url=https://github.com/games647/FlexibleLogin, source=/opt/./mods/plugins/flexiblelogin-0.16.8.jar} I resolved: In config file we had mySql, but we used mariadb and that produced such exception. Perhaps it shoud be not null-pointer.