Grails - 调用Web服务时没有class def发现错误 [英] Grails - No class def found error when calling web service

查看:137
本文介绍了Grails - 调用Web服务时没有class def发现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您好,我正在尝试从Grails调用Web服务,但仍继续运行

以下是我的课程的样子:

  import groovyx.net.ws.WSClient 

...

  def serviceUrl =http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
def proxy = new WSClient(serviceUrl.toString() ,this.class.classLoader)
serviceResult = proxy.FahrenheitToCelsius(80)
println serviceResult

...



我遇到了一个grails运行时异常:

错误500:执行控制器[myPackage.myController]的action [index]导致异常:java.lang.NoClassDefFoundError:org / apache / cxf / endpoint / Client



一直在尝试排除故障,但一直未能找到有用的资源。任何帮助或建议如何补救将不胜感激。



谢谢。

解决方案



     > def proxy = new WSClient(serviceUrl.toString(),this.class.classLoader)


Updated to reflect new error message after changes

Howdy, I am trying to call a web service from Grails, but keep running in to errors.

Here's what my class looks like:

import groovyx.net.ws.WSClient

...

    def serviceUrl = "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL"
    def proxy = new WSClient(serviceUrl.toString(), this.class.classLoader)
    serviceResult = proxy.FahrenheitToCelsius("80")
    println serviceResult

...

I am encountering a grails runtime exception:

Error 500: Executing action [index] of controller [myPackage.myController] caused exception: java.lang.NoClassDefFoundError: org/apache/cxf/endpoint/Client

Have been trying to troubleshoot, but have been unable to find any helpful resources. Any help or suggestions on how to remedy would be much appreciated.

Thanks.

解决方案

You missed the new operator it looks like:

def proxy = new WSClient(serviceUrl.toString(), this.class.classLoader)

这篇关于Grails - 调用Web服务时没有class def发现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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