7 Replies Latest reply on Apr 21, 2015 7:29 AM by arjant

    How/where a truly global jar can be added in WildFly 8.x?

    atijms

      The JACC specification defines that a JACC provider can be integrated with a server by means of the following JVM parameters:

       

      -Djavax.security.jacc.policy.provider=test.TestPolicy
      -Djavax.security.jacc.PolicyConfigurationFactory.provider=test.TestPolicyConfigurationFactory
      
      

       

      In that case a jar containing these two classes should be put on the server's classpath. Unfortunately it's not entirely clear how to put something on that classpath in WildFly 8.x.

       

      I tried the -cp option but this didn't work. Then I tried creating a global module, by putting a module.xml file in module/system/layers/base/test/main with the following content:

       

      <module xmlns="urn:jboss:module:1.3" name="test">
        
      
      
          <resources>
              <resource-root path="jacctest-0.0.1-SNAPSHOT.jar"/>
          </resources>
      
      
          <dependencies>
          </dependencies>
      </module>
      
      

       

      And then defining a global module in standalone.xml:

       

      
       <subsystem xmlns="urn:jboss:domain:ee:2.0">
        <global-modules>
        <module name="test" slot="main" />           
        </global-modules>
      
      

       

      But this too did not work. I additionally added the "test" dependency to picketbox's module.xml, but even this did not work.

       

      Every time the result is that the classes are not available on the classpath resulting in the following exception:

       

      
      java.lang.ClassNotFoundException: test.TestPolicy
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.jboss.as.security.service.SecurityActions.loadClass(SecurityActions.java:95)
        at org.jboss.as.security.service.SecurityBootstrapService.start(SecurityBootstrapService.java:87)
      
      

       

      Now I may get it to work by injecting the classes from the JACC provider in the picketbox jar, but it's a little extreme perhaps.

       

      Is there any more straightforward place where a system wide jar can be put? All existing documentations only ever talks about making jars available to application deployments.

        • 1. Re: How/where a truly global jar can be added in WildFly 8.x?
          jaikiran

          Can you post the entire exception stacktrace and tell us a bit more about how you are launching the server? The stacktrace you posted looks a bit odd because it has no references to the JBoss Modules (classloader) which seems to hint that this is being triggered outside of JBoss Modules which then is surprising because the SecurityBootstrapService is being booted somehow.

          • 2. Re: How/where a truly global jar can be added in WildFly 8.x?
            atijms

            All relevant lines in the log are:

             

            
            21:54:19,206 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
            21:54:19,219 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC000001: Failed to start service jboss.security.bootstrap: org.jboss.msc.service.StartException in service jboss.security.bootstrap: JBAS013308: Unable to start the SecurityBootstrapService service
              at org.jboss.as.security.service.SecurityBootstrapService.start(SecurityBootstrapService.java:122) [wildfly-security-8.2.0.Final.jar:8.2.0.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
              at java.lang.Thread.run(Thread.java:722) 
            Caused by: java.lang.ClassNotFoundException: test.TestPolicy
              at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
              at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
              at java.security.AccessController.doPrivileged(Native Method) 
              at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
              at java.lang.ClassLoader.loadClass(ClassLoader.java:423) 
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
              at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 
              at org.jboss.as.security.service.SecurityActions.loadClass(SecurityActions.java:95) [wildfly-security-8.2.0.Final.jar:8.2.0.Final]
              at org.jboss.as.security.service.SecurityBootstrapService.start(SecurityBootstrapService.java:87) [wildfly-security-8.2.0.Final.jar:8.2.0.Final]
              ... 5 more
            
            21:54:19,231 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
            

             

            In this case I used Eclipse/JBoss tools to start WildFly.

             

            In the launch configuration of the Eclipse Server runtime, I added the 2 -D options as mentioned above to the Arguments -> VM arguments section.

             

            Although it's probably not needed, the full code of test.TestPolicy can be found here: Arjan Tijms' Weblog: Java EE authorization - JACC revisited part III

            • 3. Re: How/where a truly global jar can be added in WildFly 8.x?
              arjant

              jaikiran, any idea?

              • 4. Re: How/where a truly global jar can be added in WildFly 8.x?
                jaikiran

                arjan tijms wrote:

                 

                All relevant lines in the log are:

                 

                1. 21:54:19,206 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main] 
                2. 21:54:19,219 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC000001: Failed to start service jboss.security.bootstrap: org.jboss.msc.service.StartException in service jboss.security.bootstrap: JBAS013308: Unable to start the SecurityBootstrapService service 
                3.   at org.jboss.as.security.service.SecurityBootstrapService.start(SecurityBootstrapService.java:122) [wildfly-security-8.2.0.Final.jar:8.2.0.Final] 
                4.   at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] 
                5.   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] 
                6.   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
                7.   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
                8.   at java.lang.Thread.run(Thread.java:722)  
                9. Caused by: java.lang.ClassNotFoundException: test.TestPolicy 
                10.   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)  
                11.   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)  
                12.   at java.security.AccessController.doPrivileged(Native Method)  
                13.   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)  
                14.   at java.lang.ClassLoader.loadClass(ClassLoader.java:423)  
                15.   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)  
                16.   at java.lang.ClassLoader.loadClass(ClassLoader.java:356)  
                17.   at org.jboss.as.security.service.SecurityActions.loadClass(SecurityActions.java:95) [wildfly-security-8.2.0.Final.jar:8.2.0.Final] 
                18.   at org.jboss.as.security.service.SecurityBootstrapService.start(SecurityBootstrapService.java:87) [wildfly-security-8.2.0.Final.jar:8.2.0.Final] 
                19.   ... 5 more 
                20.  
                21. 21:54:19,231 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors 

                 

                In this case I used Eclipse/JBoss tools to start WildFly.

                 

                In the launch configuration of the Eclipse Server runtime, I added the 2 -D options as mentioned above to the Arguments -> VM arguments section.

                 

                 

                Sorry, couldn't reply earlier.

                 

                I am still not sure you are starting the server correctly. I say that because I see no reference to JBoss Modules in that stacktrace and it seems as if the server is being launched outside of JBoss Modules, which is weird. Can you look into the Eclipse part to be sure that it indeed launches it correctly?

                 

                I am not saying that that's what is causing this problem, but before trying to get any deeper into this, it will be good to clear that launching part.

                • 5. Re: How/where a truly global jar can be added in WildFly 8.x?
                  atijms

                  jaikiran pai wrote:

                   

                  I am still not sure you are starting the server correctly. I say that because I see no reference to JBoss Modules in that stacktrace and it seems as if the server is being launched outside of JBoss Modules, which is weird. Can you look into the Eclipse part to be sure that it indeed launches it correctly?

                   

                  I think it's launched correctly. I mean, I've launched JBoss for maybe 8 years a couple of times per day via this exact method, and everything works.

                   

                  The reproduction steps are:

                   

                  First:

                   

                  • Download and unzip Eclipse Luna for Java EE
                  • From Eclipse marketplace, install JBoss tools
                  • Download and unzip JBoss WildFly 8.2
                  • From within Eclipse, create new server -> JBoss Community -> WildFly 8.x, point to directory where JBoss was unzipped in previous step
                  • Right click WildFly in Servers view, click Debug or Start

                   

                  JBoss starts up correctly. Deployment of whatever I can think of works. Debugging works, redeployments works, everything works.

                   

                  Then:

                   

                  • Double click WildFly in Servers view
                  • In Server editor, click "Open launch configuration"
                  • In the box labeled "VM arguments:" add:
                    • -Djavax.security.jacc.policy.provider=test.TestPolicy -Djavax.security.jacc.PolicyConfigurationFactory.provider=test.TestPolicyConfigurationFactory
                  • Click okay, save editor (ctrl/cmd s)
                  • Right click WildFly in Servers view, click Debug or Start

                   

                  The exception as given above is thrown.

                   

                  Hope this helps!

                   

                  P.s. regardless of the exception, in what location should a JACC provider (the jar file containing the implementation classes) be placed? This is not mentioned anywhere in the scarce documentation there is about JBoss and JACC.

                  • 6. Re: How/where a truly global jar can be added in WildFly 8.x?
                    arjant

                    jaikiran, sorry to ask again, but any idea yet?

                    • 7. Re: How/where a truly global jar can be added in WildFly 8.x?
                      arjant

                      jaikiran, sorry to ask again, but any idea yet?