From ed598ba427036351027eaad55543e2968dcdcbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E6=99=93=E6=B3=A2?= Date: Fri, 22 Nov 2019 17:49:26 +0800 Subject: [PATCH 1/2] add some warnings for classpath file datasource You could use absolute path when you use File datasource & fat jar. --- .../sentinel-core-example/readme.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md index 8cc2f53eb..01fcf7b25 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md @@ -193,6 +193,18 @@ Now ReadableDataSource type support 5 categories: `file`, `nacos`, `zk`, `apollo If you want to use `nacos`, `zk`, `apollo` or `redis` ReadableDataSource, you could add `sentinel-datasource-nacos`, `sentinel-datasource-zookeeper`,`sentinel-datasource-apollo` or `sentinel-datasource-redis` dependency. +## warning +You should use `file` ReadableDataSource in a fatjar carefully or you may get error like this below + +``` +java.lang.RuntimeException: [Sentinel Starter] DataSource ds1 handle file [classpath: flowrule.json] error: class path resource [flowrule.json] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:xxx/xxx.jar!/BOOT-INF/classes!/flowrule.jso +``` +You could use absolute path when you use File datasource & fat jar. +It is recommended to use Nacos/Apollo/Zookeeper/Redis datasource to store rules. +https://github.com/alibaba/spring-cloud-alibaba/issues/428 + + + When ReadableDataSource load rule data successfully, console will print some logs: ``` @@ -203,4 +215,4 @@ When ReadableDataSource load rule data successfully, console will print some log ## More For more information about Sentinel, see [Sentinel Project](https://github.com/alibaba/Sentinel). -If you have any ideas or suggestions for Spring Cloud Sentinel starter, please don't hesitate to tell us by submitting github issues. \ No newline at end of file +If you have any ideas or suggestions for Spring Cloud Sentinel starter, please don't hesitate to tell us by submitting github issues. From 460daaf1d8976743971bd4dc6036fb06182fa96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E6=99=93=E6=B3=A2?= Date: Fri, 22 Nov 2019 17:58:45 +0800 Subject: [PATCH 2/2] Update readme.md --- .../sentinel-core-example/readme.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md index 01fcf7b25..1856a4a05 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/readme.md @@ -193,16 +193,6 @@ Now ReadableDataSource type support 5 categories: `file`, `nacos`, `zk`, `apollo If you want to use `nacos`, `zk`, `apollo` or `redis` ReadableDataSource, you could add `sentinel-datasource-nacos`, `sentinel-datasource-zookeeper`,`sentinel-datasource-apollo` or `sentinel-datasource-redis` dependency. -## warning -You should use `file` ReadableDataSource in a fatjar carefully or you may get error like this below - -``` -java.lang.RuntimeException: [Sentinel Starter] DataSource ds1 handle file [classpath: flowrule.json] error: class path resource [flowrule.json] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:xxx/xxx.jar!/BOOT-INF/classes!/flowrule.jso -``` -You could use absolute path when you use File datasource & fat jar. -It is recommended to use Nacos/Apollo/Zookeeper/Redis datasource to store rules. -https://github.com/alibaba/spring-cloud-alibaba/issues/428 - When ReadableDataSource load rule data successfully, console will print some logs: @@ -211,6 +201,17 @@ When ReadableDataSource load rule data successfully, console will print some log [Sentinel Starter] DataSource ds1-sentinel-file-datasource load 3 DegradeRule [Sentinel Starter] DataSource ds2-sentinel-nacos-datasource load 2 FlowRule ``` +## Warning +You should use `file` ReadableDataSource in a fatjar carefully or you may get error like this below + +``` +java.lang.RuntimeException: [Sentinel Starter] DataSource ds1 handle file [classpath: flowrule.json] error: class path resource [flowrule.json] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:xxx/xxx.jar!/BOOT-INF/classes!/flowrule.jso +``` + +You could use absolute path when you use File datasource & fat jar. +It is recommended to use Nacos/Apollo/Zookeeper/Redis datasource to store rules. + +https://github.com/alibaba/spring-cloud-alibaba/issues/428 ## More For more information about Sentinel, see [Sentinel Project](https://github.com/alibaba/Sentinel).