javagwtintellij-idearpcgwt-platform

GWT-RPC: cannot use javax.security.auth.Subject on server-side


I'm trying to implement an RPC-authorization service for my GWT/GWTP app, but I've got some problems. Intellij IDEA treats this using of Subject class on the server-side like an error:

Class 'javax.security.auth.Subject' is not present in JRE Emulation Library so it cannot be used in client mode

Here is the code snippet:

import javax.security.auth.Subject;

public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
    public void loginUser(String login, String password) {
        Subject subject = UserContext.createSubject(connection, login, password, null);
    }
}

Why it mentions the 'client mode' when I'm trying to use this class on the server-side? And it doesn't complain about that:

public class LoginServiceImpl extends RemoteServiceServlet implements LoginService {
    public void loginUser(String login, String password) {
         UserContext.get().pushSubject(
            UserContext.createSubject(connection, login, password, null)
         );
    }
}

Why IDEA treats the former like an error but doesn't complain about the latter?


Solution

  • Solved. The problem was because of the redundant line in the *.gwt.xml file:

    <source path="server"/>