question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`AccessControlException` thrown when using Mockito.spy(...)

See original GitHub issue

Hi 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:closed
  • Created 4 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Aghmat-Abrahams-IRcommented, Jun 26, 2019

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.

0reactions
Aghmat-Abrahams-IRcommented, Jun 19, 2019

👍

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found