Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.3.6, 1.3.7, 2.0-M1, 2.0-M2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows XP, proxy required, proxy authentication required

      Description

      Firstly, when proxy settings are specified using add-proxy, the details do not appear to be appropriate escaped in the generated Groovy script (~/.grails/ProxyConfig.groovy or something like that). This particularly affects users who specify a domain as part of the proxy user name, such as DOMAIN\User10. In this example, the backslash is not escaped, so in the generated configuration file has a syntax error. I believe all of the settings being set should be correctly escaped.

      Secondly, in my work environment, even when the configuration file was modified to be syntactically correct again, all Internet connections initiated by Grails through the proxy appeared to time out and fail. These same connections worked flawlessly when made through another correctly configured program. The solution to this problem was found here: http://grails.1312388.n4.nabble.com/Solution-to-Grails-Proxy-Issue-for-installing-plugins-on-windows-td2994191.html

      The solution was found in the last step, which advises users to use the following code:
      grails.project.dependency.resolution = {
      System.setProperty("http.proxyHost", "host");
      System.setProperty("http.proxyPort", "port");
      Authenticator.setDefault(new Authenticator() {
      protected PasswordAuthentication getPasswordAuthentication() {
      return new PasswordAuthentication("username","password".toCharArray());
      }});

      When the code in the proxy settings Groovy script was replaced with this code instead, Grails' Internet connectivity through the proxy worked flawlessly.

      I don't know what caused the problem, but I know for certain that this solution worked. I have marked this as critical, because it appears that many others still have problems with Grails proxy settings, and in environments where a proxy is required, it is critical that this works, particularly when plugins are needed, since Grails is currently highly dependent on functional Internet access for plugin download and dependency resolution.

        Activity

        Hide
        poobah added a comment -

        Also, it would be nice if Grails would use the computer's system-wide proxy settings by default rather than users having to re-enter them in the application.

        Show
        poobah added a comment - Also, it would be nice if Grails would use the computer's system-wide proxy settings by default rather than users having to re-enter them in the application.
        Hide
        John Gibson added a comment -

        Note that it's not just the values that need to be escaped, the keys themselves are written in an unescaped format. When I've tried to use proxy names that contain a dash I've run into trouble.
        For example, I have two different proxy configurations that I need to use.

        Adding the first proxy works correctly:

        grails add-proxy proxy-a --host=ps-1.foo.bar.com --port=80
        | Added proxy proxy-a to /Users/jgibson/.grails/ProxySettings.groovy
        

        But then adding the second proxy triggers an error about the first one:

        grails --stacktrace --verbose add-proxy proxy-b --host=ps-2.foo.bar.com --port=80
        
        Base Directory: /Users/jgibson/some/where/without/a/project/
        | Loading Grails 2.1.2
        | Error WARNING: Error configuring proxy settings: startup failed:
        /Users/jgibson/.grails/ProxySettings.groovy: 1: 
        (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8.
           proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':'']
                  ^
        
        1 error
        
        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
        /Users/jgibson/.grails/ProxySettings.groovy: 1: 
        (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8.
           proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':'']
                  ^
        
        1 error
        
                at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
                at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:861)
                at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:550)
                at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:526)
                at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:503)
                at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:283)
                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)
                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:197)
                at groovy.lang.GroovyClassLoader$parseClass.call(Unknown Source)
                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
                at grails.util.BuildSettings.loadSettingsFile(BuildSettings.groovy:1142)
                at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:988)
                at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source)
                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
                at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:978)
                at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:350)
                at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:232)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
                at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
        | Error WARNING: Error configuring proxy settings: startup failed:
        /Users/jgibson/.grails/ProxySettings.groovy: 1: 
        (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8.
           proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':'']
                  ^
        
        1 error
        | Added proxy proxy-b to /Users/jgibson/.grails/ProxySettings.groovy
        

        After this proxy-a is removed from ProxySettings.groovy and only proxy-b remains. If I use underscores instead of dashes then I don't encounter any problems at all.

        Show
        John Gibson added a comment - Note that it's not just the values that need to be escaped, the keys themselves are written in an unescaped format. When I've tried to use proxy names that contain a dash I've run into trouble. For example, I have two different proxy configurations that I need to use. Adding the first proxy works correctly: grails add-proxy proxy-a --host=ps-1.foo.bar.com --port=80 | Added proxy proxy-a to /Users/jgibson/.grails/ProxySettings.groovy But then adding the second proxy triggers an error about the first one: grails --stacktrace --verbose add-proxy proxy-b --host=ps-2.foo.bar.com --port=80 Base Directory: /Users/jgibson/some/where/without/a/project/ | Loading Grails 2.1.2 | Error WARNING: Error configuring proxy settings: startup failed: /Users/jgibson/.grails/ProxySettings.groovy: 1: (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8. proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':''] ^ 1 error org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /Users/jgibson/.grails/ProxySettings.groovy: 1: (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8. proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':''] ^ 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:861) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:550) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:526) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:503) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:283) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:197) at groovy.lang.GroovyClassLoader$parseClass.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at grails.util.BuildSettings.loadSettingsFile(BuildSettings.groovy:1142) at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:988) at grails.util.BuildSettings$loadConfig.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at grails.util.BuildSettings.loadConfig(BuildSettings.groovy:978) at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:350) at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:232) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234) at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262) | Error WARNING: Error configuring proxy settings: startup failed: /Users/jgibson/.grails/ProxySettings.groovy: 1: (proxy - a) is a binary expression, but it should be a variable expression at line: 1 column: 8. File: /Users/jgibson/.grails/ProxySettings.groovy @ line 1, column 8. proxy-a=['http.proxyHost':'ps-1.foo.bar.com', 'http.proxyPort':'80', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':''] ^ 1 error | Added proxy proxy-b to /Users/jgibson/.grails/ProxySettings.groovy After this proxy-a is removed from ProxySettings.groovy and only proxy-b remains. If I use underscores instead of dashes then I don't encounter any problems at all.

          People

          • Assignee:
            Unassigned
            Reporter:
            poobah
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development