Version 3

    Hello,

     

    I've created login module and it is working perfectly fine. Sample below:

     

     

    public class UserLoginModule extends UsernamePasswordLoginModule {
         private static UserService userService;
    
        @Override
        public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
            super.initialize(subject, callbackHandler, sharedState, options);
            String wsdlUrl = (String) options.get("wsdlURL");
            UserService.initialize(wsdlUrl);
            userService = new UserService();
        }
    
        @Override
        protected boolean validatePassword(String inputPassword, String expectedPassword) {
            boolean result = false;
    
            try {
                    String response = userService.getUserPort().checkOperator(getUsername(), inputPassword);
    
                if (RESULT_OK.equals(response)) {
                    result = true;
                } else {
                    result = false;
                }
    
            } catch (Exception e) {
                log.error("Error when invoking UserService!", e);
            }
             return result;
        }
      }
    

     

    This module is deployed in common/lib directory in JBoss. Everything is fine when system tries to authenticate the user and invokes the validatePassword method.

     

    Now, when I'm trying to invoke UserService from the servlet, which is in web application (the same which uses custom login module) the exception is thrown:

     

    com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext

     

    The servlet looks as follows:

     

    public class UserServlet extends HttpServlet {

     

    private static Logger logger = Logger.getLogger(UserServlet.class.getName());

     

    private static UserService userService;

     

    @Override

    public void init() throws ServletException {

         super.init();

         userService = new UserService();

    }

     

     

    @Override

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        doPost(req, resp);

    }

     

    @Override

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String result = null;

        String login = req.getParameter("login");

        result = userService.getUserPort().unblockOperator(login);

       }

    }

     

    I'm using JBoss 5.1 EAP.

    Any ideas how to fix that?