Forum Discussion

ch5082's avatar
ch5082
Occasional Contributor
9 years ago

NoClassDefFoundError

Hello,

I'm trying to import and invoke a Java class which will connect to the Quality Center rest api.  The import to my class seems fine as I'm able to print a message to a popup window.  But I'm getting the NoClassDefFoundError for java/util/Base64 as it trys to encode a string.

Java code:

byte[] credBytes = (username + ":" + password).getBytes();
JOptionPane.showMessageDialog(null, "CredBytes", "InfoBox: Login", JOptionPane.INFORMATION_MESSAGE);
String credEncodedString = "Basic " + Base64.getEncoder().encodeToString(credBytes);

 

The java.util.Base64 is imported as a part of my Class.

 

my soapui groovy script:

import qcrestapi.QCRest
QCRest qcRest = new QCRest()
qcRest.QCLogin("USER","*******")

 

  • Take a look at soapui.bat, and you should able to point to required java version.
  • nmrao's avatar
    nmrao
    Champion Level 3
    Where is your class & how are you running it? Full stacktrace please?
    • ch5082's avatar
      ch5082
      Occasional Contributor

      This is the SoapUI error log.  I use the QCRest class for Selenium so I know it works fine.  It seems to be a Soap Groovy script issue.

       

      Tue Dec 01 12:00:12 CST 2015:ERROR:java.lang.NoClassDefFoundError: java/util/Base64
      java.lang.NoClassDefFoundError: java/util/Base64
      at qcrestapi.QCRest.QCLogin(QCRest.java:139)
      at qcrestapi.QCRest.QCLogin(QCRest.java:115)
      at qcrestapi.QCRest$QCLogin.call(Unknown Source)
      at Script13.run(Script13.groovy:4)
      at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
      at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
      at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      • nmrao's avatar
        nmrao
        Champion Level 3
        Is QCRest compatible with java 8? And which java version are you using with SoapUI?