0

I am working on Spark Scala using IntelliJ IDE, Recently I installed Scala and Spark in my local and there was system update for mac-os version, so not sure what broke it.

I am getting error when I try to build my project now, Which was working fine a day before. I checked for JRE vs JDK as suggested in other answers and I am sure that my project is pointing to JDK 1.8. Also I removed Scala and Spark from machine to make sure my machine is in same state as before. Still I am getting this error. Checked existing answers on same error, but no help.

[INFO] --- maven-surefire-plugin:2.7:test (default-test) @ dotcom-jobs ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- scalatest-maven-plugin:2.0.0:test (small-tests) @ dotcom-jobs ---
*** RUN ABORTED ***
  java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
  at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:74)
  at com.sun.proxy.$Proxy2.isTypeMockable(Unknown Source)
  at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
  at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
  at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:241)
  at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:229)
  at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
  at org.mockito.Mockito.spy(Mockito.java:1992)
  at com.homelabs.sc.rbac.utils.ConfigHelper$class.configUtil(ConfigHelper.scala:26)
  at com.homelabs.sc.rbac.base.BaseSmallTest.configUtil$lzycompute(BaseSmallTest.scala:7)
  ...
  Cause: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@517d4a0d
  at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:54)
  at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:57)
  at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:44)
  at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:22)
  at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:19)
  at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
  at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
  at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:241)
  at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:229)
  at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
  ...
  Cause: org.mockito.exceptions.base.MockitoInitializationException: Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)
Are you running a JRE instead of a JDK? The inline mock maker needs to be run on a JDK.

Java               : 1.8
JVM vendor name    : Oracle Corporation
JVM vendor version : 25.221-b11
JVM name           : Java HotSpot(TM) 64-Bit Server VM
JVM version        : 1.8.0_221-b11
JVM info           : mixed mode
OS name            : Mac OS X
OS version         : 10.16
  at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:170)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at java.lang.Class.newInstance(Class.java:442)
  at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:49)
  at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:57)
  at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:44)
  at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:22)
  ...
  Cause: java.lang.IllegalStateException: No compatible attachment provider is available
  at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:597)
  at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:581)
  at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:533)
  at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:510)
  at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:104)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at java.lang.Class.newInstance(Class.java:442)
  ...
palamuGuy
  • 156
  • 9
  • System.getProperty("java.home") = /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre – palamuGuy Sep 18 '21 at 14:43
  • Did you notice the line: Are you running a JRE instead of a JDK? The inline mock maker needs to be run on a JDK. – jgp Sep 20 '21 at 14:18
  • 1
    I am running on JDK so that line was false error, I found my solution here: https://stackoverflow.com/questions/64917779/wrong-java-home-after-upgrade-to-macos-big-sur-v11-0-1 – palamuGuy Sep 22 '21 at 11:33

1 Answers1

1

The problem was due to mac-os Big Sur update, contrary to what I thought the root cause is (installing scala). So I solved this following this answer here at apple forum: https://developer.apple.com/forums/thread/666681

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
palamuGuy
  • 156
  • 9