tomcatnetbeanstomcat6netbeans6.8accesscontrolexception

AccessControlException when trying to redeploy webapp to Tomcat using Netbeans


I'm getting the following error trying redeploy an webapp on Tomcat from within Netbeans 6.8. It has probably something to do with the new deploy on save and hot swap functionality. Any ideas how to resolve this issue?

INFO: Error registering wrapper with jmx StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CubeAdSaSim2] Catalina:j2eeType=WebModule,name=//localhost/CubeAdSaSim2,J2EEApplication=none,J2EEServer=none java.security.AccessControlException: access denied (javax.management.MBeanTrustPermission register)
java.security.AccessControlException: access denied (javax.management.MBeanTrustPermission register)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:568)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1824)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:310)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
        at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:805)
        at org.apache.catalina.core.StandardContext.registerJMX(StandardContext.java:5281)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4482)
        at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249)
        at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:377)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)

Solution

  • Try to edit conf/catalina.policy to include this line:

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

    Then add to your CATALINA_OPTS the following VM argument:

    -Djava.security.policy=/path/to/your/catalina.policy