mock-maker-inline failing when using JRE, could the error message be improved?

2,379 views
Skip to first unread message

ravivan...@live.nl

unread,
Dec 11, 2018, 5:58:26 PM12/11/18
to mockito
Yesterday my eclipse decided it would switch the JVM environment to a JRE instead of a JDK. Mockito didn't like this, throwing the following error:

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.$Proxy4.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:238)
    at org
.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:226)
    at org
.mockito.internal.MockitoCore.mock(MockitoCore.java:68)
    at org
.mockito.Mockito.mock(Mockito.java:1896)
    at org
.mockito.Mockito.mock(Mockito.java:1805)
    at me
.fril.regeneration.testing.TestActionForwarder.testClientPost(TestActionForwarder.java:72)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java
.lang.reflect.Method.invoke(Unknown Source)
    at org
.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org
.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org
.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org
.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org
.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org
.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org
.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org
.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org
.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org
.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org
.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org
.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org
.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org
.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org
.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
    at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
    at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
    at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@2aa5fe93
    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.idnternal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:44)
    at org
.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:21)
    at org
.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:18)
    at org
.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
   
... 30 more
Caused by: org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

Java               : 1.8
JVM vendor name    
: Oracle Corporation
JVM vendor version
: 25.161-b12
JVM name          
: Java HotSpot(TM) 64-Bit Server VM
JVM version        
: 1.8.0_161-b12
JVM info          
: mixed mode
OS name            
: Windows 10
OS version        
: 10.0

    at org
.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:171)
    at sun
.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun
.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun
.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java
.lang.reflect.Constructor.newInstance(Unknown Source)
    at java
.lang.Class.newInstance(Unknown Source)
    at org
.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:49)
   
... 35 more
Caused by: java.lang.IllegalStateException: No compatible attachment provider is available
    at net
.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:389)
    at net
.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:374)
asdfasdf
    at net
.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:342)
    at net
.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:328)
    at org
.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:101)
   
... 41 more


After a lot of searching around I found out about the eclipse shenigans, but the error message didn't help me at all.
I felt like I shoud report this to maybe help anyone else that encounters this. Maybe the error could mention that running on a JVM is not supported?

Tim van der Lippe

unread,
Dec 11, 2018, 5:59:35 PM12/11/18
to moc...@googlegroups.com
That would be fine by me. Feel free to send a PR!

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mockito+u...@googlegroups.com.
To post to this group, send email to moc...@googlegroups.com.
Visit this group at https://groups.google.com/group/mockito.
To view this discussion on the web visit https://groups.google.com/d/msgid/mockito/ef685879-277d-4124-820e-98dff3f495e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ravivan...@live.nl

unread,
Dec 13, 2018, 6:04:30 AM12/13/18
to mockito
I have created a PR

Op dinsdag 11 december 2018 23:58:26 UTC+1 schreef ravivan...@live.nl:
Reply all
Reply to author
Forward
0 new messages