문제

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.

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top