dbms_java_dbms_java.grant_permission not working — oracle-tech
Hi, rp0428
I grant the user AAA with below right

using the below

My intention is to allow java to read all the files in the folder /cloudfs/tmp/aaa_shipping_data.
But when I run a java sftp program which need to read the files in /cloudfs/tmp/aaa_shipping_data , below error prompt
Java Error: 4: java.security.AccessControlException: the Permission (java.io.FilePermission /cloudfs/tmp/aaa_shipping_data/PT0000025442.txt read) has not been granted to AAA. The PL/SQL to grant this is dbms_java.grant_permission( 'AAA', 'SYS:java.io.FilePermission', '/cloudfs/tmp/aaa_shipping_data/PT0000025442.txt', 'read' ) at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:487) at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:368) at Sftp.executeSftp(Sftp:43) Caused by: java.security.AccessControlException: the Permission (java.io.FilePermission /cloudfs/tmp/aaa_shipping_data/PT0000025442.txt read) has not been granted to AAA. The PL/SQL to grant this is dbms_java.grant_permission( 'AAA', 'SYS:java.io.FilePermission', '/cloudfs/tmp/aaa_shipping_data/PT0000025442.txt', 'read' ) at java.security.AccessControlContext.checkPermission(AccessControlContext.java) at java.security.AccessController.checkPermission(AccessController.java) at java.lang.SecurityManager.checkPermission(SecurityManager.java) at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java) at java.lang.SecurityManager.checkRead(SecurityManager.java:873) at java.io.FileInputStream.(FileInputStream.java:113) at java.io.FileInputStream.(FileInputStream.java:79) at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:474) ... 2 more
However, if I read the file in /cloudfs , the java won't prompt me any error.
I wonder why Java won't allow the program access the files in /cloudfs/tmp/aaa_shipping_data even I have granted the same right the folder.
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)