Testrunner throws java.lang.NoClassDefFoundError: sun/misc/BASE64Decoder exception
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Testrunner throws java.lang.NoClassDefFoundError: sun/misc/BASE64Decoder exception
Hi community, I have a set of tests. When I run them in SoapUI, it's fine no error. However, when I run them using testrunner, I get errors like:
C:\Tools\SoapUI-5.4.0\bin>testrunner.bat ..\test-soapui-project.xml
2019-01-10 09:48:30,041 [main] WARN com.eviware.soapui.SoapUI - Could not find jfxrt.jar. Internal browser will be disabled.
SoapUI 5.4.0 TestCase Runner
Configuring log4j from [C:\Tools\SoapUI-5.4.0 Copy\bin\soapui-log4j.xml]
09:48:30,520 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\pc\soapui-settings.xml]
09:48:31,459 INFO [PluginManager] 0 plugins loaded in 0 ms
09:48:31,459 INFO [DefaultSoapUICore] All plugins loaded Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Decoder at com.smartbear.analytics.impl.SoapUIOSMixpanelProviderFactory.allocateProvider(SoapUIOSMixpanelProviderFactory.java:39) at com.smartbear.analytics.AnalyticsManager.registerAnalyticsProviderFactory(AnalyticsManager.java:92) at com.eviware.soapui.analytics.AnalyticsHelper.initializeAnalytics(AnalyticsHelper.java:64) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:335) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:202) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:137) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:112) at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:122) Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Decoder at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 8 more
I've been googling around and it seems that sun/misc/BASE64Decoder has been deprecated since JAVA 9. I'm using JDK 11 and Soapui open source version 5.4.0. Does anyone know if there is a way to fix this? Again, It only happens with testrunner.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi wenesmad,
indeed :
sun.misc.BASE64Encoder
is available forJava <= 8
java.util.Base64
is available inJava >= 8
have you tried using java.util.Base64?
Regards
-Konstantinos
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Konstantinos,
Thanks for the reply. How can we change Testrunner to use java.util.Base64 instead of sun.misc.BASE64Encoder?
Regards.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you use base64 in groovy, somethink like this can do the trick:
import java.io.* import java.util.Base64 //Set string def s = 'Test String' //Encode with Base64 String encoded = s.bytes.encodeBase64().toString() log.info encoded //Assert the expected encoded string is the right one assert 'VGVzdCBTdHJpbmc=' == encoded //Decode with Base64 byte[] decoded = encoded.decodeBase64() //Assert is equals assert s == new String(decoded) log.info s
Do you get the error somewhere else?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Konstantinos,
Sorry, I should be more detailed in my original post. The problem is that I have a set of tests. If I run them in SoapUI, it's fine, no errors. However if I run them using testrunner, I get errors like this:
16:02:36,342 INFO [PluginManager] 0 plugins loaded in 3 ms 16:02:36,343 INFO [DefaultSoapUICore] All plugins loaded Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Decoder at com.smartbear.analytics.impl.SoapUIOSMixpanelProviderFactory.allocateProvider(SoapUIOSMixpanelProviderFactory.java:39) at com.smartbear.analytics.AnalyticsManager.registerAnalyticsProviderFactory(AnalyticsManager.java:92) at com.eviware.soapui.analytics.AnalyticsHelper.initializeAnalytics(AnalyticsHelper.java:64) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:335) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:202) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:137) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:112) at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:122) Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Decoder at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 8 more
Any clue on how to fix it?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do i reproduce the error? Can you share a simple project with test suite and test case?
Thank you
-Konstantinos
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Download this zip: https://s3.amazonaws.com/downloads.eviware/soapuios/5.4.0/SoapUI-5.4.0-windows-bin.zip, and there is a "test-soapui-project.xml". If you run the testrunner in the bin folder of the zip on the "test-soapui-project.xml", you'll be able to see the error.
Thank you for your help!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The same java needs to be referred by the soapUI.bat / testrunner.bat files in order to make it work.
Have a backup of those files before making any changes.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Rao,
Thank you for answering the post. I dont quite understand what you meant. I have my JAVA_HOME set (see below screenshot). In both batch files, it uses this JAVA_HOME value if it exists. Can you explain a bit more about what you meant?
Thank you!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
