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

2.4.2 创建命名空间失败/数据库语法问题 #12625

Closed
tm2018 opened this issue Sep 7, 2024 · 18 comments · Fixed by #12659
Closed

2.4.2 创建命名空间失败/数据库语法问题 #12625

tm2018 opened this issue Sep 7, 2024 · 18 comments · Fixed by #12659
Labels
kind/bug Category issues or prs related to bug. plugin

Comments

@tm2018
Copy link

tm2018 commented Sep 7, 2024

2.4.2开启鉴权后,登录web页面,输入初始密码,重新登录后,日志会报如下错误。

jdk版本:openjdk17.02
修改配置项目
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:security}
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:SecretKeyXLP62MnrR6vgScdgj3QvCb2HfgmcWeausN2gvwag4vfbQaAAtF345WsRe2}

日志详情:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT id,quota,usage,max_size,max_aggr_count,max_aggr_size,tenant_id FROM tenant_capacity WHERE tenant_id = ?]; nested exception is java.sql.SQLSyntaxErrorException: Lexical error at line 1, column 17. Encountered: "`" (96), after : "".
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:236)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1575)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:713)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:744)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:810)
at com.alibaba.nacos.config.server.service.capacity.TenantCapacityPersistService.getTenantCapacity(TenantCapacityPersistService.java:101)
at com.alibaba.nacos.config.server.service.NamespaceConfigInfoService.injectDetail(NamespaceConfigInfoService.java:48)
at com.alibaba.nacos.core.namespace.injector.NamespaceDetailInjectorHolder.injectDetail(NamespaceDetailInjectorHolder.java:54)
at com.alibaba.nacos.core.service.NamespaceOperationService.getNamespaceList(NamespaceOperationService.java:69)
at com.alibaba.nacos.console.controller.NamespaceController.getNamespaces(NamespaceController.java:73)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:903)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:809)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

@fuhouyu
Copy link
Contributor

fuhouyu commented Sep 7, 2024

看着是SQL出现了错误,请问数据库类型是Mysql吗?"`"是Mysql的语法,其它的数据库类型就会出错。

@tm2018
Copy link
Author

tm2018 commented Sep 7, 2024

看着是SQL出现了错误,请问数据库类型是Mysql吗?"`"是Mysql的语法,其它的数据库类型就会出错。

用的默认的数据库,不是mysql

看着是SQL出现了错误,请问数据库类型是Mysql吗?"`"是Mysql的语法,其它的数据库类型就会出错。

用的默认数据库,未修改配置文件中spring.sql.init.platform参数

@fuhouyu
Copy link
Contributor

fuhouyu commented Sep 7, 2024

erver.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.serve

我的意思是,你连接的外部数据库类型是否是Mysql。

@tm2018
Copy link
Author

tm2018 commented Sep 7, 2024

用的默认数据库,未设置使用任何外部数据库
nacos完整配置,:
server.servlet.contextPath=/nacos
server.error.include-message=ALWAYS
server.port=8848
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2
nacos.config.push.maxRetryTime=50
server.tomcat.mbeanregistry.enabled=true
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.rotate=true
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd-HH
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.basedir=file:.
nacos.security.ignore.urls=/,/error,//*.css,//.js,/**/.html,//*.map,//.svg,/**/.png,//*.ico,/console-ui/public/,/v1/auth/,/v1/console/health/,/actuator/,/v1/console/server/
nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=true
nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=false
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:security}
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:SecretKeyXLP62MnrR6vgScdgj3QvCb2HfgmcWeausN2gvwag4vfbQaAAtF345WsReRgT232}
nacos.istio.mcp.server.enabled=false

erver.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.serve

我的意思是,你连接的外部数据库类型是否是Mysql。

@fuhouyu
Copy link
Contributor

fuhouyu commented Sep 7, 2024

用的默认数据库,未设置使用任何外部数据库 nacos完整配置,: server.servlet.contextPath=/nacos server.error.include-message=ALWAYS server.port=8848 db.pool.config.connectionTimeout=30000 db.pool.config.validationTimeout=10000 db.pool.config.maximumPoolSize=20 db.pool.config.minimumIdle=2 nacos.config.push.maxRetryTime=50 server.tomcat.mbeanregistry.enabled=true management.metrics.export.elastic.enabled=false management.metrics.export.influx.enabled=false server.tomcat.accesslog.enabled=true server.tomcat.accesslog.rotate=true server.tomcat.accesslog.file-date-format=.yyyy-MM-dd-HH server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i server.tomcat.basedir=file:. nacos.security.ignore.urls=/,/error,//*.css,//.js,/**/.html,//*.map,//.svg,/**/.png,//*.ico,/console-ui/public/,/v1/auth/,/v1/console/health/,/actuator/,/v1/console/server/ nacos.core.auth.system.type=nacos nacos.core.auth.enabled=true nacos.core.auth.caching.enabled=true nacos.core.auth.enable.userAgentAuthWhite=false nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity} nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_KEY:security} nacos.core.auth.plugin.nacos.token.cache.enable=false nacos.core.auth.plugin.nacos.token.expire.seconds=18000 nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:SecretKeyXLP62MnrR6vgScdgj3QvCb2HfgmcWeausN2gvwag4vfbQaAAtF345WsReRgT232} nacos.istio.mcp.server.enabled=false

erver.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.serve

我的意思是,你连接的外部数据库类型是否是Mysql。

刚刚去验证了一下,确实会由于是mysql语法"`"的问题,导致sql执行出现了异常。在默认情况下,使用的是内嵌的数据库也会出现该问题。

@fuhouyu
Copy link
Contributor

fuhouyu commented Sep 7, 2024

@i will solve it@

@zffsdiamond
Copy link

同样的问题,不知这个怎么解决

@runBaby
Copy link

runBaby commented Sep 9, 2024

同样的问题,不知这个怎么解决

Version v2.4.0 can be rolled back

@fuhouyu
Copy link
Contributor

fuhouyu commented Sep 9, 2024

同样的问题,不知这个怎么解决

已经提交了PR修改了,当前2.4.2会存在这个问题,可以使用下之前的版本或者手动修改下源码,或者使用外部的Mysql进行存储,可以临时使用下。

@zffsdiamond
Copy link

当前2

好的,谢谢

@zffsdiamond
Copy link

同样的问题,不知道这个怎么解决

版本 v2.4.0 可回退

嗯嗯,谢谢,我回退到2.4.1,也可用

@KomachiSion KomachiSion added kind/bug Category issues or prs related to bug. plugin labels Sep 10, 2024
@HMYDK
Copy link
Contributor

HMYDK commented Sep 12, 2024

image

这里是不是把稳定版本先改成2.4.1?

@zffsdiamond
Copy link

image

这里是不是把稳定版本先改成2.4.1?

嗯,如果你docker下载的话先用V2.4.1这样,否则连接pg的话会出现上述问题,(已经提交了PR修改了,当前2.4.2会存在这个问题,可以使用下之前的版本或者手动修改下源码,或者使用外部的Mysql进行存储,可以临时使用下。这个是上面老哥的回复)

@KouShenhai
Copy link
Contributor

#12641

@bes2008
Copy link

bes2008 commented Sep 15, 2024

着急的话,可以有如下 几种方案:

  1. 退回到2.3.2;但是小于 2.4.1 有漏洞,2.4.1 启动存在偶发死锁问题
  2. 自己改插件,重新编译构建
  3. 使用第三方插件:https://github.com/bes2008/nacos-plugins

@nikbobo
Copy link

nikbobo commented Sep 17, 2024

什么时候退修复版本?2.4.3?

@KomachiSion KomachiSion changed the title 2.4.2开启鉴权后登录报数据库语法错误 2.4.2 创建命名空间失败/数据库语法问题 Sep 18, 2024
@KomachiSion KomachiSion reopened this Sep 18, 2024
@KomachiSion
Copy link
Collaborator

#12659 先回滚了导致问题的PR,但是问题其实没有彻底解决。

@tm2018
Copy link
Author

tm2018 commented Sep 29, 2024

2.4.2.1版本正常了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug. plugin
Projects
None yet
9 participants