Java.lang.NoClassDefFounderError: Could not initia

2019-09-02 15:32发布

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.. :'( :'(

1条回答
放荡不羁爱自由
2楼-- · 2019-09-02 15:56

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.

查看更多
登录 后发表回答