lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.48k stars 520 forks source link

远程连接报ConfigException: Failed to register storage engine: AOSE #159

Closed fuzi1996 closed 2 years ago

fuzi1996 commented 2 years ago

version

lealone: 5.0.0-rc-14
java: 1.8.0_201

问题

org.lealone.common.exceptions.ConfigException: Failed to register storage engine: AOSE
        at org.lealone.main.Lealone.checkException(Lealone.java:340)
        at org.lealone.main.Lealone.registerAndInitEngines(Lealone.java:317)
        at org.lealone.main.Lealone.initStorageEngineEngines(Lealone.java:236)
        at org.lealone.main.Lealone.initPluggableEngines(Lealone.java:229)
        at org.lealone.main.Lealone.init(Lealone.java:211)
        at org.lealone.main.Lealone.run(Lealone.java:128)
        at org.lealone.main.Lealone.start(Lealone.java:84)
        at org.lealone.main.Lealone.main(Lealone.java:41)
Caused by: org.lealone.common.exceptions.DbException: Class "AOSE" not found [90086-0]
        at org.lealone.common.exceptions.DbException.get(DbException.java:162)
        at org.lealone.common.util.Utils.loadUserClass(Utils.java:599)
        at org.lealone.common.util.Utils.newInstance(Utils.java:770)
        at org.lealone.main.Lealone.lambda$0(Lealone.java:239)
        at org.lealone.main.Lealone.registerAndInitEngines(Lealone.java:314)
        ... 6 more
Caused by: org.lealone.common.exceptions.JdbcSQLException: Class "AOSE" not found [90086-0]
        at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:342)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: AOSE
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.lealone.common.util.Utils.loadUserClass(Utils.java:594)
        ... 9 more

另外,以上报错是我是用最新lealone-5.0.0-rc-14客户端连接远程数据库出现的, 我使用lealone本地单元测试连接远程数据库报以下错误

Exception in thread "main" org.lealone.common.exceptions.DbException: Connection is broken: "org.lealone.common.exceptions.DbException: Admin rights are required for this operation; SQL statement:
SET DEFAULT_STORAGE_ENGINE 'AOSE' [90040-0]: xx.xx.xx.xx:9210" [90067-0]
    at org.lealone.common.exceptions.DbException.get(DbException.java:162)
    at org.lealone.client.session.ClientSessionFactory.lambda$createSession$0(ClientSessionFactory.java:72)
    at org.lealone.db.async.AsyncCallback.setAsyncResult(AsyncCallback.java:157)
    at org.lealone.client.session.ClientSessionFactory.lambda$null$2(ClientSessionFactory.java:119)
    at org.lealone.db.async.AsyncCallback.setAsyncResult(AsyncCallback.java:157)
    at org.lealone.db.async.AsyncCallback.setAsyncResult(AsyncCallback.java:144)
    at org.lealone.net.TcpClientConnection.handleResponse(TcpClientConnection.java:114)
    at org.lealone.net.TransferConnection.handle(TransferConnection.java:130)
    at org.lealone.net.nio.NioEventLoop.read(NioEventLoop.java:213)
    at org.lealone.net.nio.NioEventLoopClient.run(NioEventLoopClient.java:74)
    at org.lealone.net.nio.NioEventLoopClient.lambda$createNioEventLoop$0(NioEventLoopClient.java:46)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.lealone.common.exceptions.JdbcSQLException: Connection is broken: "org.lealone.common.exceptions.DbException: Admin rights are required for this operation; SQL statement:
SET DEFAULT_STORAGE_ENGINE 'AOSE' [90040-0]: xx.xx.xx.xx:9210" [90067-0]
    at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:342)
    ... 12 more
Caused by: org.lealone.common.exceptions.DbException: Admin rights are required for this operation; SQL statement:
SET DEFAULT_STORAGE_ENGINE 'AOSE' [90040-0]
    at org.lealone.common.exceptions.DbException.convert(DbException.java:281)
    at org.lealone.net.TransferConnection.parseError(TransferConnection.java:83)
    at org.lealone.net.TcpClientConnection.handleResponse(TcpClientConnection.java:96)
    ... 5 more
Caused by: org.lealone.common.exceptions.JdbcSQLException: Admin rights are required for this operation; SQL statement:
SET DEFAULT_STORAGE_ENGINE 'AOSE' [90040-0]
    at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:342)
    at org.lealone.common.exceptions.DbException.get(DbException.java:173)
    at org.lealone.common.exceptions.DbException.get(DbException.java:150)
    at org.lealone.common.exceptions.DbException.get(DbException.java:139)
    at org.lealone.db.auth.User.checkAdmin(User.java:185)
    at org.lealone.sql.dml.SetDatabase.update(SetDatabase.java:50)
    at org.lealone.sql.executor.YieldableLocalUpdate.executeInternal(YieldableLocalUpdate.java:23)
    at org.lealone.sql.executor.YieldableBase.run(YieldableBase.java:97)
    at org.lealone.sql.StatementBase.syncExecute(StatementBase.java:521)
    at org.lealone.sql.StatementBase.executeUpdate(StatementBase.java:580)
    at org.lealone.db.session.ServerSessionFactory.initSession(ServerSessionFactory.java:95)
    at org.lealone.db.session.ServerSessionFactory.createServerSession(ServerSessionFactory.java:48)
    at org.lealone.db.session.ServerSessionFactory.createSession(ServerSessionFactory.java:38)
    at org.lealone.db.ConnectionInfo.createSession(ConnectionInfo.java:631)
    at org.lealone.server.TcpServerConnection.createSession(TcpServerConnection.java:122)
    at org.lealone.server.TcpServerConnection.readInitPacket(TcpServerConnection.java:104)
    at org.lealone.server.TcpServerConnection.handleRequest(TcpServerConnection.java:73)
    at org.lealone.net.TransferConnection.handle(TransferConnection.java:127)
    at org.lealone.net.nio.NioEventLoop.read(NioEventLoop.java:213)
    at org.lealone.server.Scheduler.handleSelectedKeys(Scheduler.java:380)
    at org.lealone.server.Scheduler.doAwait(Scheduler.java:369)
    at org.lealone.server.Scheduler.executeNextStatement(Scheduler.java:211)
    at org.lealone.server.Scheduler.run(Scheduler.java:92)

    at org.lealone.net.TransferConnection.parseError(TransferConnection.java:72)
    ... 6 more
fuzi1996 commented 2 years ago

使用DataGrip连接 设置DEFAULT_STORAGE_ENGINE=AOSE;时报错 image 当不设置DEFAULT_STORAGE_ENGINE=AOSE;时报错 image 但是已经使用admin运行lealone image

fuzi1996 commented 2 years ago

找到原因了,出现Failed to register storage engine: AOSE和权限问题系连接参数多了DEFAULT_STORAGE_ENGINE=AOSE; 至于数组溢出系url连接时最后不能加;

codefollower commented 2 years ago

连接远程服器是用 test 这个普通用户连,所以没有执行 set DEFAULT_STORAGE_ENGINE aose 这个语句的权限。 url 最后是可以加分号的,把你的 url 发出来我测一下看看。

fuzi1996 commented 2 years ago

连接远程服器是用 test 这个普通用户连,所以没有执行 set DEFAULT_STORAGE_ENGINE aose 这个语句的权限。 url 最后是可以加分号的,把你的 url 发出来我测一下看看。

今天试了下没问题了

另外使用lealone-client时要指定-client,否则就会报

java -jar .\lealone-client-5.0.0.jar -host xxx.xxx.xxx.xxx -port 9210 -database test -user test -password test
Lealone version: 5.0.0-SNAPSHOT
Use default config
Base dir: .\lealone_data
Fatal error: unable to start lealone. See log for stacktrace.
org.lealone.common.exceptions.ConfigException: Failed to register storage engine: AOSE
        at org.lealone.main.Lealone.checkException(Lealone.java:340)
        at org.lealone.main.Lealone.registerAndInitEngines(Lealone.java:317)
        at org.lealone.main.Lealone.initStorageEngineEngines(Lealone.java:236)
        at org.lealone.main.Lealone.initPluggableEngines(Lealone.java:229)
        at org.lealone.main.Lealone.init(Lealone.java:211)
        at org.lealone.main.Lealone.run(Lealone.java:128)
        at org.lealone.main.Lealone.start(Lealone.java:84)
        at org.lealone.main.Lealone.main(Lealone.java:41)
Caused by: org.lealone.common.exceptions.DbException: Class "AOSE" not found [90086-0]
        at org.lealone.common.exceptions.DbException.get(DbException.java:162)
        at org.lealone.common.util.Utils.loadUserClass(Utils.java:599)
        at org.lealone.common.util.Utils.newInstance(Utils.java:770)
        at org.lealone.main.Lealone.lambda$0(Lealone.java:239)
        at org.lealone.main.Lealone.registerAndInitEngines(Lealone.java:314)
        ... 6 more
Caused by: org.lealone.common.exceptions.JdbcSQLException: Class "AOSE" not found [90086-0]
        at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:342)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: AOSE
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.lealone.common.util.Utils.loadUserClass(Utils.java:594)
        ... 9 more
codefollower commented 2 years ago

lealone-client.jar 是我临时传上去的,已经删除了

codefollower commented 2 years ago

可以构建出一个独立的 lealone 客户端了: github.com/lealone/Lealone/releases/tag/lealone-5.0.0-rc-14 启动 leaone 数据库: java -jar lealone-5.0.0.jar 启动 leaone 客户端: java -jar lealone-client-5.0.0.jar 用 java -jar lealone-5.0.0.jar -client 也可以启动客户端。