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

When using Seata Client 2.1.0, an error message is not found service provider for: org.apache.seata.config.ConfigurationProvider #6886

Closed
1 task done
linghengqian opened this issue Sep 28, 2024 · 3 comments
Labels
status: waiting-for-feedback Waiting for feedback

Comments

@linghengqian
Copy link
Member

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

[ERROR] 2024-09-28 12:57:19.535 [main] o.a.s.config.ConfigurationFactory - failed to load non-spring configuration :not found service provider for : org.apache.seata.config.ConfigurationProvider
org.apache.seata.common.loader.EnhancedServiceNotFoundException: not found service provider for : org.apache.seata.config.ConfigurationProvider

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------< io.github.linghengqian:seata-client-v210-error-test >---------
[INFO] Building seata-client-v210-error-test 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ seata-client-v210-error-test ---
[INFO] Deleting /home/linghengqian/TwinklingLiftWorks/git/public/seata-client-v210-error-test/target
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ seata-client-v210-error-test ---
[INFO] skip non existing resourceDirectory /home/linghengqian/TwinklingLiftWorks/git/public/seata-client-v210-error-test/src/main/resources
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ seata-client-v210-error-test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ seata-client-v210-error-test ---
[INFO] Copying 4 resources from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ seata-client-v210-error-test ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 4 source files with javac [debug target 22] to target/test-classes
[INFO] 
[INFO] --- surefire:3.2.5:test (default-test) @ seata-client-v210-error-test ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.github.linghengqian.SeataTest
[ERROR] 2024-09-28 12:57:19.535 [main] o.a.s.config.ConfigurationFactory - failed to load non-spring configuration :not found service provider for : org.apache.seata.config.ConfigurationProvider
org.apache.seata.common.loader.EnhancedServiceNotFoundException: not found service provider for : org.apache.seata.config.ConfigurationProvider
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.742 s -- in io.github.linghengqian.SeataTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.383 s
[INFO] Finished at: 2024-09-28T12:57:23+08:00
[INFO] ------------------------------------------------------------------------

Ⅲ. Describe what you expected to happen

  • This error can actually be reproduced under both HotSpot VM and GraalVM Native Image. Of course, the minimal reproducible unit test I wrote does not take GraalVM Native Image into account. The Error Log should not appear.

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. Install SDKMAN! and Docker Engine.
  2. Execute the following command to execute the unit test from https://github.com/linghengqian/seata-client-v210-error-test.
sdk install java 22.0.2-graalce
git clone [email protected]:linghengqian/seata-client-v210-error-test.git
cd ./seata-client-v210-error-test/
sdk use java 22.0.2-graalce
./mvnw clean test

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

  • Maybe not.

Ⅵ. Environment:

  • JDK version(e.g. java -version):
openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment GraalVM CE 22.0.2+9.1 (build 22.0.2+9-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 22.0.2+9.1 (build 22.0.2+9-jvmci-b01, mixed mode, sharing)
  • Seata client/server version: 2.1.0
  • Database version: Docker Image postgres:17.0-bookworm
  • OS(e.g. uname -a): Linux DESKTOP-2OCN434 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Others: Null
@funky-eyes
Copy link
Contributor

This is an ignorable exception, which is used solely for compatibility with lower versions of io.seata.

    private static Configuration getNonSpringConfiguration(String configTypeName) {
        try {
            io.seata.config.Configuration oldConfiguration = EnhancedServiceLoader.load(
                io.seata.config.ConfigurationProvider.class, Objects.requireNonNull(configTypeName)).provide();
            if (null != oldConfiguration) {
                Configuration configurationSPIInstanceProxy = (Configuration)Proxy.newProxyInstance(
                    ConfigurationFactory.class.getClassLoader(), new Class[] {Configuration.class},
                    new OldConfigurationInvocationHandler(oldConfiguration));
                return configurationSPIInstanceProxy;
            }
        } catch (EnhancedServiceNotFoundException ignore) {
            //ignore
        } catch (Exception exx) {
            LOGGER.error("failed to load non-spring configuration :{}", exx.getMessage(), exx);
        }
        try {
            Configuration configuration = EnhancedServiceLoader.load(ConfigurationProvider.class,
                Objects.requireNonNull(configTypeName), false).provide();
            return configuration;
        }  catch (Exception exx) {
            LOGGER.error("failed to load non-spring configuration :{}", exx.getMessage(), exx);
        }
        return null;
    }

It can be seen that the EnhancedServiceNotFoundException is the exception that needs to be ignored. However, for some reason, I didn't find any other exceptions in your error message, only the EnhancedServiceNotFoundException. Theoretically, EnhancedServiceNotFoundException should not log "failed to load non-spring configuration." Nevertheless, I have confirmed the code logic, and this exception does not affect usage.

@funky-eyes funky-eyes added the status: waiting-for-feedback Waiting for feedback label Oct 8, 2024
@linghengqian
Copy link
Member Author

However, for some reason, I didn't find any other exceptions in your error message, only the EnhancedServiceNotFoundException.

  • Because I added logback.xml to shield the logs except error. There are too many info logs for testcontainers-java.

  • Should I just close the current issue?

@funky-eyes
Copy link
Contributor

If you have tested reading the configuration information and found no issues, you can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback Waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants