在 URL 上的 Conduit 上检测到 Winrm4j 授权循环,领域 "null"

Winrm4j Authorization loop detected on Conduit on URL with realm "null"

我正在使用以下代码连接到 Windows 2008 服务器。

WinRmTool.Builder builder = WinRmTool.Builder.builder("hostname", "domain\username", "password");
builder.setAuthenticationScheme(AuthSchemes.NTLM);
builder.useHttps(false);
WinRmTool tool =  builder.build();      
tool.executePs("COMMAND");

我低于异常

Caused by: java.io.IOException: Authorization loop detected on Conduit "{http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}WinRmPort.http-conduit" on URL "http://hostname:5985/wsman" with realm "null"

我在浏览器中无需任何身份验证即可访问 WS“http://hostname:5985/wsman”,Windows 服务器上的 winrm 服务设置如下。

   AllowUnencrypted = false
    Auth
        Basic = false
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986

我客户端的设置也是一样的。对 winrm WS 的 HTTPS 访问不起作用,所以我正在使用 useHttps(false)。

客户端和服务器在不同的域中。我能够使用提供的主机名、domain\username 和密码成功地通过 rdp 连接到服务器。

我尝试将身份验证方案更改为 kerberos/basic/digest。 None 其中似乎有效。我在两边都试了​​'allowUnencrypted=true',但还是不行。

我是否遗漏了任何 conf/prop 个文件?

在远程服务器上配置以下设置后,相同的代码有效

winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'