Java.lang.NoClassDefFounderError:无法初始化类groovy.net.http.ParserRegistry [英] Java.lang.NoClassDefFounderError: Could not initialize class groovy.net.http.ParserRegistry

查看:179
本文介绍了Java.lang.NoClassDefFounderError:无法初始化类groovy.net.http.ParserRegistry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在使用Groovy时在SoapUi中收到此错误消息。



最初,代码没有编译,即'无法解析类HTTPBuilder'。为了解决这个问题,我从 http下载了jar文件://repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/0.6/ 并将其粘贴到C:\ Program Files \SmartBear\soapUI-Pro- 4.5.1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ .net.http.ParserRegistry

类SomeClassName {



def RequestBody = SomeClassName.Method()// this方法返回一个XML



static def Methodname()

def http = new HTTPBuilder(' http://www.SomeWebServiceLocation.com ')

  http.request(Method.POST,ContentType.URLENC)

{
uri.path =/
body = RequestB ody
}

}



当我注释了我在哪里调用了这个方法,即SomeClassName.Methodname()
,其他所有来自类的东西看起来都很好。



help ..:'(:'(


解决方案

http-builder依赖于其他库。仅下载http-builder-0.6.jar是不够的。你应该下载 http-builder-0.6-all.zip ,将其解压并将所有在依赖关系库中找到的jar文件复制到C:\ Program Files \ SmartBear\soapUI-Pro-4.5.1\\ \\ bin\ext

你得到这个错误的原因可能是因为ParserRegistry类依赖于可以在这些附加库中找到的其他类。


I am currently getting this error message in SoapUi while using Groovy.

Initially the code didnt compile i.e. errored with 'unable to resolve class HTTPBuilder'. To resolve this i downloaded the jar file from http://repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/0.6/ and paste it in C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext and it resolved the issue.

Re-running the same script now errored with Java.lang.NoClassDefFounderError: Could not initialize class groovy.net.http.ParserRegistry

class SomeClassName {

def RequestBody = SomeClassName.Method() // this method returns an XML

static def Methodname()

def http = new HTTPBuilder('http://www.SomeWebServiceLocation.com')

http.request(Method.POST, ContentType.URLENC) 

{
      uri.path = "/"
      body = RequestBody   
}

}

When i commented out where i was calling this method i.e. SomeClassName.Methodname() , everything else from the class seems to work fine.

Can someone please help.. :'( :'(

解决方案

http-builder depends on additional libraries. downloading only the http-builder-0.6.jar is not enough. You should download the http-builder-0.6-all.zip, extract it and copy all jar files you find inside the dependencies library to C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext

The reason that you are getting this error is probably because the ParserRegistry class depends on other classes which can be found in those additional libraries.

这篇关于Java.lang.NoClassDefFounderError:无法初始化类groovy.net.http.ParserRegistry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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