hanxu00920 commented on issue #10216:
URL: 
https://github.com/apache/shardingsphere/issues/10216#issuecomment-828918784


   Did you really test and use a hybrid architecture?
   I googled other people's examples, and tried to use the 4.0.1 version of the 
dependency, and excluded many of the dependencies he said. 
   ```
   <dependency>
        <groupId>org.apache.shardingsphere</groupId>
        <artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
        <version>4.0.1</version>
        <exclusions>
                <exclusion>
                        <groupId>org.apache.curator</groupId>
                        <artifactId>curator-framework</artifactId>
                </exclusion>
        </exclusions>
   </dependency>
   <dependency>
        <groupId>org.apache.shardingsphere</groupId>
        <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
        <version>4.0.1</version>
        <exclusions>
                <exclusion>
                        <groupId>org.apache.curator</groupId>
                        <artifactId>curator-framework</artifactId>
                </exclusion>
                <exclusion>
                        <groupId>org.apache.curator</groupId>
                        <artifactId>curator-recipes</artifactId>
                </exclusion>
                <exclusion>
                        <groupId>org.apache.curator</groupId>
                        <artifactId>curator-client</artifactId>
                </exclusion>
        </exclusions>
   </dependency>
   <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-framework</artifactId>
        <version>2.10.0</version>
   </dependency>
   <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-recipes</artifactId>
        <version>2.10.0</version>
   </dependency>
   ```
   The jdbc application is successfully started and the configuration is shared 
to zookeeper, but the shardingsphere-proxy cannot be started through the 
configuration center.
   proxy error log:
   ```
   Exception in thread "main" java.lang.NullPointerException
        at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
        at java.util.regex.Matcher.reset(Matcher.java:309)
        at java.util.regex.Matcher.<init>(Matcher.java:229)
        at java.util.regex.Pattern.matcher(Pattern.java:1093)
        at 
org.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.java:64)
        at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:47)
        at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:427)
        at 
org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:129)
        at 
org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:116)
        at 
org.apache.shardingsphere.orchestration.core.configcenter.ConfigCenter.loadAuthentication(ConfigCenter.java:292)
        at 
org.apache.shardingsphere.shardingproxy.Bootstrap.startWithRegistryCenter(Bootstrap.java:133)
        at 
org.apache.shardingsphere.shardingproxy.Bootstrap.main(Bootstrap.java:87)
   ```
   So I first emptied the configuration center, and then shared the 
configuration to zookeeper through shardingsphere-proxy, but the jdbc 
application failed to start.
   jdbc error log:
   ```
   Caused by: java.lang.NullPointerException
        at 
org.apache.shardingsphere.orchestration.internal.registry.config.service.ConfigurationService.isEncryptRule(ConfigurationService.java:194)
        at 
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration.dataSource(OrchestrationSpringBootConfiguration.java:175)
        at 
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$f6d755b2.CGLIB$dataSource$4(<generated>)
        at 
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$f6d755b2$$FastClassBySpringCGLIB$$891609a6.invoke(<generated>)
        at 
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at 
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
        at 
org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration$$EnhancerBySpringCGLIB$$f6d755b2.dataSource(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 44 more
   ```
   I guarantee that the orchestration.name and registry.namespace 
configurations are accurate, and that jdbc and proxy match.
   It's really hard.


-- 
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.

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


Reply via email to