java.lang.NoSuchMethodError:org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub.addAnonymousOperations

时间:2016-09-07 09:29:24

标签: java java-ee wso2 wso2is

我正在尝试创建一个Web应用程序,我想调用WSO2身份服务器API RemoteUserStoreManagerService

错误就是这个

java.lang.NoSuchMethodError: org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub.addAnonymousOperations()V
    org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub.populateAxisService(RemoteUserStoreManagerServiceStub.java:42)
    org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub.<init>(RemoteUserStoreManagerServiceStub.java:636)
    org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub.<init>(RemoteUserStoreManagerServiceStub.java:625)
    org.wso2.sample.LoginServlet.authenticate(LoginServlet.java:83)
    org.wso2.sample.LoginServlet.doPost(LoginServlet.java:56)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.wso2.sample.AuthenticationFilter.doFilter(AuthenticationFilter.java:56)

我不知道错误,但我在/ WEB-INF / lib中导入了org.wso2.carbon.um.ws.api.stub

这是.jar文件的版本吗? 有人可以帮助我..

这是我的代码

private boolean authenticate(String userName, Object credential) throws Exception {
    if (!(credential instanceof String)) {
        throw new Exception("Unsupported type of password");
    }
    try {
        if(stub == null) {
            stub = new RemoteUserStoreManagerServiceStub(null, serverUrl
                    + "RemoteUserStoreManagerService");
            HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
            basicAuth.setUsername(basicAuthUserID);
            basicAuth.setPassword(basicAuthPassword);
            basicAuth.setPreemptiveAuthentication(true);

            final Options clientOptions = stub._getServiceClient().getOptions();
            clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
            stub._getServiceClient().setOptions(clientOptions);

        }
        return stub.authenticate(userName, (String) credential);
    } catch (Exception e) {
        handleException(e.getMessage(), e);
    }
    return false;
}

0 个答案:

没有答案