2 Replies Latest reply on Feb 3, 2015 8:19 AM by valsaraj viswanathan

    Why java.lang.IllegalAccessError when instantiating LoginContext in WildFly?

    valsaraj viswanathan Master

       

      LoginContext loginContext = null;

              try {

                  loginContext = new LoginContext(customLoginModule, new CallbackHandler() {

                      public void handle(Callback[] callbacks) {

                          int len = callbacks.length;

                          Callback cb;

                          for (int i = 0; i < len; i++) {

                              cb = callbacks[i];

                              if (cb instanceof PasswordCallback) {

                                  PasswordCallback pcb = (PasswordCallback) cb;

                                  pcb.setPassword(PasswordHolder.getInstance().getKeyStorePassword());

                              }

                          }

                      }

                  });

                  loginContext.login();

                  return loginContext.getSubject();

              } finally {

                  if (loginContext != null)

                      loginContext.logout();

              }

       

      This is the code that throws IllegalAccessError in WildFly 8.2.0. Is there any change needed in later versions of JBoss. This was working fine in JBoss 4.2.2.GA.

       

      I added break points in login module but control not reached there. It thrown exception as soon as new LoginContext is called.