【问题标题】:GWT-RPC: cannot use javax.security.auth.Subject on server-sideGWT-RPC:不能在服务器端使用 javax.security.auth.Subject
【发布时间】:2016-07-14 22:53:44
【问题描述】:

我正在尝试为我的 GWT/GWTP 应用程序实现 RPC 授权服务,但我遇到了一些问题。 Intellij IDEA 将在服务器端使用 Subject 类视为错误:

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

这里是sn-p的代码:

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);
    }
}

当我尝试在服务器端使用此类时,为什么它会提到“客户端模式”? 它并没有抱怨:

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

为什么 IDEA 将前者视为错误,但不抱怨后者?

【问题讨论】:

  • 据我了解,GWT 的 JRE EL 是来自 Java 的 JRE 的一组有限的类,因此您看到的错误是类 SUBJECT 在 CLIENT 端不可用 - 您是否正在检查客户方有任何机会吗?

标签: java gwt intellij-idea rpc gwt-platform


【解决方案1】:

解决了。 问题是因为 *.gwt.xml 文件中的冗余行:

<source path="server"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-09
    • 2017-03-24
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 2013-11-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多