Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.0.0m1
-
Fix Version/s: 2.5.0Release
-
Component/s: Testing, Running, Debugging
-
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:
Issue Links
- depends upon
-
GRECLIPSE-1004
HttpBuilder "No signature of method" error when run as a Groovy script from within eclipse
-
-
GRECLIPSE-1055
Remove all hardwired paths from launch configurations
-
Activity
I just ran the script as a Java app and it succeeded with the following output:
Nov 2, 2009 10:50:44 AM 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
Nov 2, 2009 10:50:46 AM groovyx.net.ws.AbstractCXFWSClient getBindingOperationInfo
WARNING: Using SOAP version: 1.1
47.611435
http://forecast.weather.gov/images/wtf/bkn.jpg
OK. So, there must be something wrong with the command line args for the run as groovy script launcher. I hope to be able to look at this in the next week.
Working for me now under the latest snapshot. Guillaume, can you please confirm that it is working for you?
Closing this. Please re-open if you continue to see problems.
Hi,
This should be reopen. It happens to me on
OS: Win 7
JDK: java version "1.6.0_22"
Eclipse: Helios Service Release 2, Build id: 20110218-0911
Groovy-Eclipse Feature 2.1.2.xx-20110310-1500-e36
Regards
Reopenning.
Please describe your problem in more detail:
- What version are you using (of Groovy and Groovy-Eclipse)
- Please attach a sample script that is failing for you
- How exactly do you launch the script?
- When you launch as Java App, are you getting correct results?
The script above is working for me using the latest nightly build and the Groovy 1.8 plugin.
1. Groovy 1.7.8, Groovy Eclipse 2.1.2
2. Here is the script ( almost the same as the original)
import groovyx.net.ws.WSClient
def proxy = new WSClient('http://www.webservicex.net/WeatherForecast.asmx?WSDL', this.class.classLoader)
proxy.initialize()
def result = proxy.GetWeatherByPlaceName("Seattle")
println result.latitude
3. Runs As .. Groovy Script
4. Yes, if I use Run As .. Java Application I get the correct results
I am pasting here the content of the two launchers:
The java launcher:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/lab/scripts/weather.groovy"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="weather"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/>
</launchConfiguration>
and the groovy 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 "$
\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;$
{workspace_loc:/lab}\bin" --main groovy.ui.GroovyMain "C:\downloads\eclipse-workspace\lab\scripts\weather.groovy""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf="/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf" -Dgroovy.home="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36""/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="$
"/>
</launchConfiguration>
Also, here is the output from the eclipse console of the two runs:
The java launcher:
Apr 11, 2011 7:24:09 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
Apr 11, 2011 7:24:10 PM groovyx.net.ws.AbstractCXFWSClient getBindingOperationInfo
WARNING: Using SOAP version: 1.1
47.611435
and the groovy launcher:
Apr 11, 2011 7:25:00 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 weather.run(weather.groovy:6)
Forgot to mention that I also use groovyws-standalone-0.5.0.jar ( you can see it in the classpath ). I am not using grape.
Thanks for the follow up and answering the questions. I am still getting the expected output with no exceptions when I run. I'll compare the launchers.
Ah...I can see the problem now. In your launch configuration, there are some nested quotes, which should be escaped.
Can you try this:
change this line:
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--classpath "${workspace_loc:/lab}\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin" --main groovy.ui.GroovyMain "C:\downloads\eclipse-workspace\lab\scripts\weather.groovy""/>
to this line:
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--classpath "${workspace_loc:/lab}\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin" --main groovy.ui.GroovyMain "C:\downloads\eclipse-workspace\lab\scripts\weather.groovy""/>
Also, this line:
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf="/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf" -Dgroovy.home="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36""/>
to this line:
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf="/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf" -Dgroovy.home="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36""/>
I think that's all of them. Please let me know if this works for you.
I'm not sure how those unescaped quotes made it into your launch configuration. They should be escaped automatically when written to disk. How was this launch configuration created?
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 "${workspace_loc:/lab}\scripts;\lab\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin" --main groovy.ui.GroovyMain "C:\downloads\eclipse-workspace\lab\scripts\weather.groovy""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf="/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf" -Dgroovy.home="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36""/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lab}"/>
</launchConfiguration>
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.
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 "${workspace_loc:/lab}\scripts;${workspace_loc:/lab}\libs\groovyws-standalone-0.5.0.jar;${workspace_loc:/lab}\bin" --main groovy.ui.GroovyMain "C:\downloads\eclipse-workspace\lab\scripts\weather.groovy""/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lab"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgroovy.starter.conf="/C:/Users/horia/Downloads/helios/plugins/org.codehaus.groovy_1.7.8.xx-20110310-1500-e36/conf/groovy-starter.conf" -Dgroovy.home="C:\Users\horia\Downloads\helios\plugins\org.codehaus.groovy_1.7.8.xx-20110310-1500-e36""/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lab}"/> </launchConfiguration>
So it's a matter of launcher generation?
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.
Works for me when run as a Java application. This should work as a groovy script and this is something I will explore next week.
Please let me know if you are able to run this script as a Java app.