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

FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (no such file or directory) #634

Closed
dqing0 opened this issue Mar 29, 2019 · 10 comments · Fixed by #646
Labels
area/configuration Issues or PRs related to configurations of Sentinel good first issue Good for newcomers kind/enhancement Category issues or prs related to enhancement.

Comments

@dqing0
Copy link
Contributor

dqing0 commented Mar 29, 2019

Issue Description

FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (没有那个文件或目录)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at com.alibaba.csp.sentinel.datasource.FileWritableDataSource.write(FileWritableDataSource.java:73)
at com.alibaba.csp.sentinel.command.handler.ModifyRulesCommandHandler.writeToDataSource(ModifyRulesCommandHandler.java:108)
at com.alibaba.csp.sentinel.command.handler.ModifyRulesCommandHandler.handle(ModifyRulesCommandHandler.java:68)
at com.alibaba.csp.sentinel.transport.command.http.HttpEventTask.run(HttpEventTask.java:89)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

Describe what happened (or what feature you want)

i wanted to load local FlowRule.json,when i run application with jar,i found the error.
i think the new File(filepath) method dont work,when the file in jar

@sentinel-bot
Copy link
Collaborator

Hi @dqing0, we detect non-English characters in the issue. This comment is an auto translation from @sentinel-bot to help other users to understand this issue.
We encourage you to describe your issue in English which is more friendly to other users.

FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (no such file or directory)

Issue Description

FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (no such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at com.alibaba.csp.sentinel.datasource.FileWritableDataSource.write(FileWritableDataSource.java:73)
at com.alibaba.csp.sentinel.command.handler.ModifyRulesCommandHandler.writeToDataSource(ModifyRulesCommandHandler.java:108)
at com.alibaba.csp.sentinel.command.handler.ModifyRulesCommandHandler.handle(ModifyRulesCommandHandler.java:68)
at com.alibaba.csp.sentinel.transport.command.http.HttpEventTask.run(HttpEventTask.java:89)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

Describe what happened (or what feature you want)

i wanted to load local FlowRule.json,when i run application with jar,i found the error.
i think the new File(filepath) method dont work,when the file in jar

@sentinel-bot sentinel-bot changed the title FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (没有那个文件或目录) FileWritableDataSource :file:/xx/xx.jar!/BOOT-INF/classes!/FlowRule.json (no such file or directory) Mar 29, 2019
@sczyh30 sczyh30 added kind/question Category issues related to questions or problems area/configuration Issues or PRs related to configurations of Sentinel labels Mar 29, 2019
@sczyh30
Copy link
Member

sczyh30 commented Mar 29, 2019

Hi, please check whether your file path is correct.

@dqing0
Copy link
Contributor Author

dqing0 commented Mar 29, 2019

file path is correct, when i use intellij ,it work.But ,when i package, use 'java -jar xx.jar',it faild. i think the reason is that the method **new File(path) ** cannot read the file in jar

@sczyh30
Copy link
Member

sczyh30 commented Mar 29, 2019

@fangjian0423
Copy link
Contributor

@sczyh30

FileRefreshableDataSource needs java.io.File as constructor parameter and we couldn't get file in jar.

Maybe we need java.io.InputStream as the constructor parameter of FileRefreshableDataSource.

Then we could write a overload constructor method to accept java.io.InputStream.

@dqing0
Copy link
Contributor Author

dqing0 commented Mar 29, 2019

i know the way,but the load file in your sentinel-datasource-extension.jar,i cant rewrite

@dqing0
Copy link
Contributor Author

dqing0 commented Mar 29, 2019

@sczyh30

FileRefreshableDataSource needs java.io.File as constructor parameter and we couldn't get file in jar.

Maybe we need java.io.InputStream as the constructor parameter of FileRefreshableDataSource.

Then we could write a overload constructor method to accept java.io.InputStream.

you are right

@fangjian0423
Copy link
Contributor

@dqing0

welcome to contribute. You could create pull request to enhance it.

@dqing0
Copy link
Contributor Author

dqing0 commented Mar 29, 2019

@dqing0

welcome to contribute. You could create pull request to enhance it.

fine,i will do that,thanks @fangjian0423 @sczyh30

@sczyh30
Copy link
Member

sczyh30 commented Mar 29, 2019

Contributions are welcomed :)

@sczyh30 sczyh30 added kind/enhancement Category issues or prs related to enhancement. good first issue Good for newcomers and removed kind/question Category issues related to questions or problems labels Mar 29, 2019
CST11021 pushed a commit to CST11021/Sentinel that referenced this issue Nov 3, 2021
[ISSUE#403] add the conf/plain_acl.yml file for acl_feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration Issues or PRs related to configurations of Sentinel good first issue Good for newcomers kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
4 participants