Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2517

Fix se/numberguess example with SecurityManager enabled

XMLWordPrintable

    • Hide

      mvn clean package dependency:copy-dependencies -Dmdep.stripVersion
      java -Djava.security.manager -Djava.security.policy=target/numberguess.policy -cp target/weld-se-numberguess.jar:target/dependency/weld-se-shaded.jar org.jboss.weld.environment.se.example.numberguess.Main

      Show
      mvn clean package dependency:copy-dependencies -Dmdep.stripVersion java -Djava.security.manager -Djava.security.policy=target/numberguess.policy -cp target/weld-se-numberguess.jar:target/dependency/weld-se-shaded.jar org.jboss.weld.environment.se.example.numberguess.Main

      Running the se/numberguess example (JDK 8/10/11) with SecurityManager enabled fails with:

      Exception in thread "main" java.lang.SecurityException: java.lang.SecurityException: setContextClassLoader
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
      	at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
      	at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:73)
      	at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:59)
      	at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:67)
      	at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.addClasses(ConcurrentBeanDeployer.java:52)
      	at org.jboss.weld.bootstrap.BeanDeployment.createClasses(BeanDeployment.java:198)
      	at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:406)
      	at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:79)
      	at org.jboss.weld.environment.se.Weld.initialize(Weld.java:798)
      	at org.jboss.weld.environment.se.example.numberguess.Main.main(Main.java:10)
      Caused by: java.lang.SecurityException: setContextClassLoader
      	at java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader(ForkJoinWorkerThread.java:244)
      	at org.jboss.weld.executor.CommonForkJoinPoolExecutorServices.lambda$wrap$0(CommonForkJoinPoolExecutorServices.java:68)
      	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
      	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
      	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
      	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
      	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
      

              mkouba@redhat.com Martin Kouba
              nziakova@redhat.com Nikoleta Ziakova (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: