将特殊的\字符设置为grails代理用户名会导致错误 [英] Setting grails proxy username with special \ character causes error

查看:99
本文介绍了将特殊的\字符设置为grails代理用户名会导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司使用具有以下形式的用户名的公司代理: domainName\username 。当我尝试使用 add-proxy 命令从命令行添加代理时。



我得到的异常是:

 错误警告:配置代理设置时出错:启动失败:
C:\Documents and Settings\username\\ \\.grails \ProxySettings.groovy:1:意外的cha
r:'\'@ line 1,column 94.
8080,http.proxyUser:company\username

这个解决方法是什么?我尝试手动编辑ProxySettings.groovy文件,但是抛出同样的错误启动。



[更新] 我尝试使用Grails 2.0.0 RC3,但仍无法连接。 div class =h2_lin>解决方案

在代理配置中使用域时,您似乎遇到了grails bug: http://jira.grails.org/browse/GRAILS-7387 。解决方法是在第e BuildConfig.groovy (手动类型)。将以下内容添加到现有的 company \username

  grails。 project.dependency.resolution = {
System.setProperty(http.proxyHost,host);
System.setProperty(http.proxyPort,port);
Authenticator.setDefault(new Authenticator(){
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(company \\username,password.toCharArray());
}
});

[其余代码]
}

不应该是反斜杠的问题。

Our firm uses a corporate proxy with a username in the following form domainName\username . When I try to add the proxy from command line using add-proxy command.

The exception I get is:

Error WARNING: Error configuring proxy settings: startup failed:
C:\Documents and Settings\username\.grails\ProxySettings.groovy: 1: unexpected cha
r: '\' @ line 1, column 94.
   8080", "http.proxyUser":"company\username"

What is the workaround for this? I tried manually editing the ProxySettings.groovy file, but same error is thrown on startup.

[UPDATE] I tried with Grails 2.0.0 RC3 but still unable to connect.

解决方案

It looks like you have ran into a grails bug, when domain is used in the proxy configuration: http://jira.grails.org/browse/GRAILS-7387. The work-around is to configure the proxy within the BuildConfig.groovy (kind of manually). Add the following to the existing company\username:

grails.project.dependency.resolution = {
    System.setProperty("http.proxyHost", "host");
    System.setProperty("http.proxyPort", "port");
    Authenticator.setDefault(new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication("company\\username","password".toCharArray());
        }
    }); 

    [rest of code]
}

This way there shouldn't be problems with the backslash.

这篇关于将特殊的\字符设置为grails代理用户名会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆