GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-482

GroovyWS script doesnt work when run from the eclipse plugin

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0m1
    • Fix Version/s: 2.5.0Release
    • Labels:
      None
    • Environment:
      eclipse 3.5, windows xp, groovy project using groovy compiler 1.6.5
    • Number of attachments :
      0

      Description

      The following groovy script raises an exception when run from a groovy project in eclipse IDE:

      import groovyx.net.ws.WSClient

      def getProxy(wsdl, classLoader)

      { new WSClient(wsdl, classLoader) }

      proxy = getProxy("http://www.webservicex.net/WeatherForecast.asmx?WSDL", this.class.classLoader)
      proxy.initialize()

      def result = proxy.GetWeatherByPlaceName("Seattle")
      println result.latitude
      println result.details.weatherData[0].weatherImage

      exception:

      Oct 30, 2009 3:10:30 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug
      INFO: Created classes: net.webservicex.ArrayOfWeatherData, net.webservicex.GetWeatherByPlaceName, net.webservicex.GetWeatherByPlaceNameResponse, net.webservicex.GetWeatherByZipCode, net.webservicex.GetWeatherByZipCodeResponse, net.webservicex.ObjectFactory, net.webservicex.WeatherData, net.webservicex.WeatherForecasts
      Caught: groovy.lang.MissingMethodException: No signature of method: groovyx.net.ws.WSClient.GetWeatherByPlaceName() is applicable for argument types: (java.lang.String) values: [Seattle]
      at listing1221.run(listing1221.groovy:9)

      The same script run in groovyconsole with groovy 1.6.5 distribution works fine with the below output:

      47.611435
      http://forecast.weather.gov/images/wtf/nra90.jpg

        Issue Links

          Activity

          Hide
          Horia Muntean added a comment -

          It seems that after pasting the file content jira transformed the nested quotes. Here it is again the groovy launcher content, this time I hope as I have it:

          <?xml version="1.0" encoding="UTF-8" standalone="no"?>
          <launchConfiguration type="org.codehaus.groovy.eclipse.groovyScriptLaunchConfiguration">
          <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
          <listEntry value="/lab"/>
          </listAttribute>
          <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
          <listEntry value="4"/>
          </listAttribute>
          <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
          <listEntry value="C:\downloads\eclipse-workspace\lab\bin"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\groovy-all-1.7.8.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\commons-cli-1.2.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\ivy-2.2.0.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\jline-0.9.94.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\servlet-api-2.4.jar"/>
          <listEntry value="C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar"/>
          </listAttribute>
          <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.codehaus.groovy.tools.GroovyStarter"/>
          <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--classpath &quot;${workspace_loc:/lab}\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin&quot; --main groovy.ui.GroovyMain &quot;C:\downloads\eclipse-workspace\lab\scripts\weather.groovy&quot;"/>
          <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/>
          <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf=&quot;/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf&quot; -Dgroovy.home=&quot;C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36&quot;"/>
          <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lab}"/>
          </launchConfiguration>
          
          
          Show
          Horia Muntean added a comment - It seems that after pasting the file content jira transformed the nested quotes. Here it is again the groovy launcher content, this time I hope as I have it: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.codehaus.groovy.eclipse.groovyScriptLaunchConfiguration"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/lab"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="4"/> </listAttribute> <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> <listEntry value="C:\downloads\eclipse-workspace\lab\bin"/> <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\groovy-all-1.7.8.jar"/> <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\commons-cli-1.2.jar"/> <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\ivy-2.2.0.jar"/> <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\jline-0.9.94.jar"/> <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\servlet-api-2.4.jar"/> <listEntry value="C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar"/> </listAttribute> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.codehaus.groovy.tools.GroovyStarter"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--classpath &quot;${workspace_loc:/lab}\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin&quot; --main groovy.ui.GroovyMain &quot;C:\downloads\eclipse-workspace\lab\scripts\weather.groovy&quot;"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf=&quot;/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf&quot; -Dgroovy.home=&quot;C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36&quot;"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lab}"/> </launchConfiguration>
          Hide
          Andrew Eisenberg added a comment -

          The problem could be something related to a missing fully qualified path. Can you try replacing the second reference to groovyws-0.5.0.jar to a fully qualified path?

          This:

          \lab\libs\groovyws-standalone-0.5.0.jar
          

          becomes this:

          C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar
          

          Unfortunately, since there are many system dependent paths in the launch configuration, I can't try this out directly on my machine.

          Show
          Andrew Eisenberg added a comment - The problem could be something related to a missing fully qualified path. Can you try replacing the second reference to groovyws-0.5.0.jar to a fully qualified path? This: \lab\libs\groovyws-standalone-0.5.0.jar becomes this: C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar Unfortunately, since there are many system dependent paths in the launch configuration, I can't try this out directly on my machine.
          Hide
          Horia Muntean added a comment -

          Good call. It works now. I replaced

          \lab\libs\groovyws-standalone-0.5.0.jar
          

          with

          ${workspace_loc:/lab}\libs\groovyws-standalone-0.5.0.jar
          

          Below is the entire working launcher:

          <?xml version="1.0" encoding="UTF-8" standalone="no"?>
          <launchConfiguration type="org.codehaus.groovy.eclipse.groovyScriptLaunchConfiguration">
          <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
          <listEntry value="/lab"/>
          </listAttribute>
          <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
          <listEntry value="4"/>
          </listAttribute>
          <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
          <listEntry value="C:\downloads\eclipse-workspace\lab\bin"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\groovy-all-1.7.8.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\commons-cli-1.2.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\ivy-2.2.0.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\jline-0.9.94.jar"/>
          <listEntry value="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\servlet-api-2.4.jar"/>
          <listEntry value="C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar"/>
          </listAttribute>
          <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.codehaus.groovy.tools.GroovyStarter"/>
          <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--classpath &quot;${workspace_loc:/lab}\scripts;${workspace_loc:/lab}\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin&quot; --main groovy.ui.GroovyMain &quot;C:\downloads\eclipse-workspace\lab\scripts\weather.groovy&quot;"/>
          <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/>
          <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf=&quot;/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf&quot; -Dgroovy.home=&quot;C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36&quot;"/>
          <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lab}"/>
          </launchConfiguration>
          

          So it's a matter of launcher generation?

          Show
          Horia Muntean added a comment - Good call. It works now. I replaced \lab\libs\groovyws-standalone-0.5.0.jar with ${workspace_loc:/lab}\libs\groovyws-standalone-0.5.0.jar Below is the entire working launcher: <?xml version= "1.0" encoding= "UTF-8" standalone= "no" ?> <launchConfiguration type= "org.codehaus.groovy.eclipse.groovyScriptLaunchConfiguration" > <listAttribute key= "org.eclipse.debug.core.MAPPED_RESOURCE_PATHS" > <listEntry value= "/lab" /> </listAttribute> <listAttribute key= "org.eclipse.debug.core.MAPPED_RESOURCE_TYPES" > <listEntry value= "4" /> </listAttribute> <listAttribute key= "org.eclipse.jdt.launching.CLASSPATH" > <listEntry value= "C:\downloads\eclipse-workspace\lab\bin" /> <listEntry value= "C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\groovy-all-1.7.8.jar" /> <listEntry value= "C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\commons-cli-1.2.jar" /> <listEntry value= "C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\ivy-2.2.0.jar" /> <listEntry value= "C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\jline-0.9.94.jar" /> <listEntry value= "C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36\lib\servlet-api-2.4.jar" /> <listEntry value= "C:\downloads\eclipse-workspace\lab\libs\groovyws-standalone-0.5.0.jar" /> </listAttribute> <stringAttribute key= "org.eclipse.jdt.launching.MAIN_TYPE" value= "org.codehaus.groovy.tools.GroovyStarter" /> <stringAttribute key= "org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value= "--classpath &quot;${workspace_loc:/lab}\scripts;${workspace_loc:/lab}\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin&quot; --main groovy.ui.GroovyMain &quot;C:\downloads\eclipse-workspace\lab\scripts\weather.groovy&quot;" /> <stringAttribute key= "org.eclipse.jdt.launching.PROJECT_ATTR" value= "lab" /> <stringAttribute key= "org.eclipse.jdt.launching.VM_ARGUMENTS" value= "-Dgroovy.starter.conf=&quot;/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf&quot; -Dgroovy.home=&quot;C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36&quot;" /> <stringAttribute key= "org.eclipse.jdt.launching.WORKING_DIRECTORY" value= "${workspace_loc:/lab}" /> </launchConfiguration> So it's a matter of launcher generation?
          Hide
          Andrew Eisenberg added a comment -

          I think so. There is still a problem with Groovy-Eclipse here. External jars are referenced by a fully qualified path, but jars internal to the project are paths from the project root. This is incorrect. Rather, they should all be prefixed with {{$

          {workspace_loc:/lab}

          }} (or whatever the project name is).

          Another problem that this is highlighting is that the launch configurations should avoid hardwiring full paths as much as possible, or else they will not be sharable. There are a few places where we can't do this, but there are some where we can.

          Thanks for taking the time to work through this issue. I'll try to get a fix out in the next few days.

          Show
          Andrew Eisenberg added a comment - I think so. There is still a problem with Groovy-Eclipse here. External jars are referenced by a fully qualified path, but jars internal to the project are paths from the project root. This is incorrect. Rather, they should all be prefixed with {{$ {workspace_loc:/lab} }} (or whatever the project name is). Another problem that this is highlighting is that the launch configurations should avoid hardwiring full paths as much as possible, or else they will not be sharable. There are a few places where we can't do this, but there are some where we can. Thanks for taking the time to work through this issue. I'll try to get a fix out in the next few days.
          Hide
          Andrew Eisenberg added a comment -

          Now fixed.

          Show
          Andrew Eisenberg added a comment - Now fixed.

            People

            • Assignee:
              Andrew Eisenberg
              Reporter:
              Guillaume Jeudy
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: