HouYuSource commented on issue #7701:
URL: 
https://github.com/apache/shardingsphere/issues/7701#issuecomment-1878215315

   > @ted-w-20230331 hi!,can you tell you how did you solve it? I also 
encountered this kind of problem
   
   You can debug the SQLParserFactory static code,
   
   1. The result of executing this code varies among different threads, and 
static only executes once, so the first result must be correct;
   2. This code should not be executed by an asynchronous thread because the 
ClassLoader of the asynchronous thread is uncertain, which may cause SPI to 
obtain an empty implementation class;
   3. If it is a SpringBoot application, the current thread's ClassLoader 
should be 'org.springframework.boot.loader.LaunchedURLClassLoader' to properly 
initialize.
   
   ```
   public final class SQLParserFactory {
       
       static {
           NewInstanceServiceLoader.register(SQLParserConfiguration.class);
       }
      // ...
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to