2

I have in installed MongoDB on my server and wrote a very small Java program to connect to it:

Mongo mongo = new Mongo("localhost");
db = mongo.getDB("testdb"); // testdb doesn't exist, will be created

When I run the program, I get this error:

WARNING: jmx registration error: java.security.AccessControlException:
    access denied (javax.management.MBeanTrustPermission register) continuing...

What could be causing this error? I am using the MongoDB database driver 2.7.3 supplied by MongoDB. I have changed the configuration file(s) for MongoDB since installing.

Gray
  • 115,027
  • 24
  • 293
  • 354
Tanaki
  • 2,575
  • 6
  • 30
  • 41

1 Answers1

2

Looks to me that your security policy is not permitting MongoDB from registering its JMX method. See this question: AccessControlException when trying to redeploy webapp to Tomcat using Netbeans

It recommends to edit your security.policy file to add the line:

grant { permission javax.management.MBeanTrustPermission "register"; };

Then add the following to your VM command line arguments:

-Djava.security.policy= <path to security.policy>
Community
  • 1
  • 1
Gray
  • 115,027
  • 24
  • 293
  • 354