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]: Nacos reports an error when using nacos-postgresql-datasource-plugin-ext: java.lang.ClassCastException #12022

Closed
mikolls opened this issue Apr 24, 2024 · 3 comments · Fixed by #12031
Assignees
Labels
kind/bug Category issues or prs related to bug. plugin status/need feedback

Comments

@mikolls
Copy link
Contributor

mikolls commented Apr 24, 2024

Describe the bug
An error occurs when starting with the PostgreSQL plugin:java.lang.ClassCastException: com.sun.proxy.$Proxy114 cannot be cast to com.alibaba.nacos.plugin.datasource.mapper.Mapper

How to Reproduce

  1. Download the plugin and configure the PostgreSQL data source in the Nacos source code
  2. nacos-plugin url
  3. Turn on the database log: nacos.plugin.datasource.log.enabled=true
  4. Start nacos
  5. See errors
    image
  6. After trying, it was found that after settingnacos.plugin.datasource.log.enabled=true, the code will go through this part of the logic:
    image

But in fact, the interface cannot be obtained here

image

You can see that ConfigInfoMapperByPostgresql does not implement any interface

image

The one that implements the interface is ConfigInfoMapperByMySql

image
image
image
7. Therefore, only when using the database plugin and settingnacos.plugin.datasource.log.enabled=truewill an error occur, whereas Nacos’ built-in MySQL and Derby do not have this error.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version nacos2.3.2 or nacos2.4.0
  • Module naming-config

Additional context
Complete stack information
log.txt

@mikolls
Copy link
Contributor Author

mikolls commented Apr 24, 2024

If it needs to be fixed, please assign it to me

@mikolls mikolls changed the title Nacos reports an error when using nacos-postgresql-datasource-plugin-ext: java.lang.ClassCastException [Bug]:Nacos reports an error when using nacos-postgresql-datasource-plugin-ext: java.lang.ClassCastException Apr 24, 2024
@mikolls mikolls changed the title [Bug]:Nacos reports an error when using nacos-postgresql-datasource-plugin-ext: java.lang.ClassCastException [Bug]: Nacos reports an error when using nacos-postgresql-datasource-plugin-ext: java.lang.ClassCastException Apr 24, 2024
@KomachiSion KomachiSion added plugin kind/bug Category issues or prs related to bug. labels Apr 25, 2024
@KomachiSion
Copy link
Collaborator

I remember this problem has been fixed in new version. Can you try new version?

@mikolls
Copy link
Contributor Author

mikolls commented Apr 25, 2024

I remember this problem has been fixed in new version. Can you try new version?

I tried the latest version 2.4.0 and had the same bug
image

mikolls added a commit to mikolls/nacos that referenced this issue May 6, 2024
mikolls added a commit to mikolls/nacos that referenced this issue May 6, 2024
KomachiSion pushed a commit that referenced this issue May 15, 2024
#12031)

* [ISSUE#12022] Fix nacos datasource plugin ClassCastException bug (#12022)

* [ISSUE#12022] Fix nacos datasource plugin ClassCastException bug (#12022)

* [ISSUE#12022] Fix nacos datasource plugin ClassCastException bug (#12022)

* [ISSUE#12022] Fix nacos datasource plugin ClassCastException bug (#12022)

* [ISSUE#12022] Fix MapperManagerTest test (#12022)

* [ISSUE#12022] Fix MapperManagerTest test (#12022)
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 status/need feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants