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

谁说我不能喝 提交于 2019-12-25 08:08:39

问题


Hi im having while im trying to create a web application and i want to call the WSO2 identity server API RemoteUserStoreManagerService

The error is this

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)

I dont know the error but i imported the org.wso2.carbon.um.ws.api.stub in /WEB-INF/lib

is this the version of the .jar file or not? Can someone help me..

Here is my code

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

来源:https://stackoverflow.com/questions/39366166/java-lang-nosuchmethoderror-org-wso2-carbon-um-ws-api-stub-remoteuserstoremanag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!