`AccessControlException` thrown when using Mockito.spy(...)
See original GitHub issueHi I’m getting the following error message when spying on a org.apache.spark.streaming.scheduler.StreamingListener
:
java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
The issue could be solved by adding the following line to your /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre/lib/security/java.policy
file -> permission javax.management.MBeanTrustPermission "register";
under the grant section.
I was wondering if there was a programatic solution.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Cannot throw an exception using Mockito - java - Stack Overflow
Usually I create a spy object to call spied method. Using stubbing I can throw an exception. This exception is always monitored in...
Read more >org.apache.hadoop.security.AccessControlException
Example 1 with AccessControlException. use of org.apache.hadoop.security.AccessControlException in project hadoop by apache.
Read more >org.apache.hadoop.hdfs.server.namenode ...
The following examples show how to use org.apache.hadoop.hdfs.server.namenode. ... simulating // files that were moved FileSystem spiedFs = Mockito.spy(fs); ...
Read more >[hadoop] branch branch-3.3.1 updated - The Mail Archive
For user with large group membership (i.e., > 1000 groups), we recommend ... groupsMapping = Mockito.spy( new RuleBasedLdapGroupsMapping()); ...
Read more >Diff - hadoop-common - Git repositories on apache
+ * @throws AccessControlException + * if access is denied. ... Mockito.spy; + +public class TestShellCommandFencer { + private ShellCommandFencer fencer ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My bad, turns out it was not Mockito causing the issue. A custom
SecurityManager
was the root cause, I should have caught it sooner. This issue can be closed.👍