1 Reply Latest reply on May 24, 2016 6:31 AM by Pedro Pereira

    org.jboss.logmanager.LogManager not compatible with Java Security Manager

    Pedro Pereira Newbie

      Hi everyone.

       

      I will try to summarize my issue here.

       

      I have WildFly 9.0.2 where I want to do some auditing using AspectJ.

      After some research I've added these parameters to the standalone.bat startup file:

       

      set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,org.aspectj,com.mycompany.aop"
      set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/p:%JBOSS_HOME%\modules\system\layers\base\org\jboss\logmanager\main\jboss-logmanager-2.0.0.Final.jar;%JBOSS_HOME%\modules\com\mycompany\aop\main\aop.jar;%JBOSS_HOME%\modules\org\aspectj\main\aspectjrt-1.8.7.jar;%JBOSS_HOME%\modules\system\layers\base\org\jboss\log4j\logmanager\main\log4j-jboss-logmanager-1.1.2.Final.jar"
      set "JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
      set "JAVA_OPTS=%JAVA_OPTS% -javaagent:%JBOSS_HOME%\modules\org\aspectj\main\aspectjweaver-1.8.7.jar"
      

       

      This works fine, WildFly starts up and I can weave my classes and get AOP working.

       

      However, I also want to use a Java Security Manager. So i've added:

      set "JAVA_OPTS=%JAVA_OPTS% -Djava.security.policy=%JBOSS_HOME%\java.policy -Djava.security.debug=failure,access,policy"
      

       

      And uncommented the SECMGR=true variable:

      set "SECMGR=true"
      

       

      This is the content of my java.policy file:

      grant {
              // Allow everything for now
              permission java.security.AllPermission;
      };
      

       

      From this moment on I can't start WildFly anymore, I get the error:

      java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager"
       system property to "org.jboss.logmanager.LogManager")
              at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
              at org.jboss.as.server.Main.main(Main.java:85)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:497)
              at org.jboss.modules.Module.run(Module.java:308)
              at org.jboss.modules.Main.main(Main.java:487)
      

       

      For some reason the LogManager is not installed when using the java.policy and activating the java security manager.

       

      Any thoughts on this ?

       

      Thank you very much.

      Best regards,

      Pedro Pereira