0

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

somo debe
  • 1
  • 2
  • 4

1 Answers1

3

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.

Dror Bereznitsky
  • 20,048
  • 3
  • 48
  • 57
  • thanks for you reply. i copied all the jar files in the dependencies folder as you suggested and i restarted soapuiPro but i am still getting the same error message as reported. Initially i was getting " java.lang.NoClassDefFoundError: org/apache/xml/resolver/CatalogManager error at line 106 (line where method was been called)" – somo debe Feb 01 '13 at 13:21
  • The CatalogManager is part of the xml-resolver-1.2.jar. Make sure you have it inside C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext. In addition make sure you do not have it in another jar file inside C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext. If you have multiple versions of this class in your classpath it can cause the NoClassDefFoundError – Dror Bereznitsky Feb 03 '13 at 10:54
  • I have checked the "C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext" and i only have one version of "xml-resolver-1.2.jar" in my classpath. Not sure of how to ensure that multiple versions of this jar file are not in my classpath. Do i need to copy the jar files from dependencies library into "C:\Program Files\SmartBear\soapUI-Pro-4.5.1\lib" – somo debe Feb 04 '13 at 12:02
  • You do not need to copy the dependencies to the lib directory. However you need to check if the lib folder contains any version of the xml-resolver jar. In addition, it is possible the another jar in the lib folder can contain classes from xml-resolver. Try looking for CatalogManager.class inside the jars (you can use wirar for this) – Dror Bereznitsky Feb 04 '13 at 13:16