Ask a Question

NoClassDefFoundError

SOLVED
ch5082
Occasional Contributor

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","*******")

 

8 REPLIES 8
nmrao
Community Hero

Where is your class & how are you running it? Full stacktrace please?


Regards,
Rao.
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
Community Hero

Is QCRest compatible with java 8? And which java version are you using with SoapUI?


Regards,
Rao.
ch5082
Occasional Contributor

I have Soap 5.2.1 and it looks like 

java.version=1.7.0_55

My eclipse Java version is: java.version=1.8.0_60 

 

Maybe I can try to point Eclipse to the Soapui jre version to validate.

ch5082
Occasional Contributor

Well it appears that the Soapui JRE 1.7.0 does not include Base64.  Is there a way to change the JRE that soapui uses?

nmrao
Community Hero

Take a look at soapui.bat, and you should able to point to required java version.


Regards,
Rao.
ch5082
Occasional Contributor

Well I couldn't figure out what to modify in the soapui.bat, so I just renamed the jre folder and copied in my java 8 version.  Once I did that, I was able to use my Java class.  Thanks for the help.

nmrao
Community Hero

Glad to know.


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: