AttachNotSupportedException: no providers installed. When using mock-maker-inline extension and jmockit.jar is found in classpath on Windows.
See original GitHub issueHello. We have mixed environment where some test are written with help of mockito with mock-maker-inline extension and some test use jmockit.
When test are running under OS X everything works fine. But under Windows we have following exception:
Caused by: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
at com.sun.proxy.$Proxy48.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:168)
at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:162)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:64)
at org.mockito.Mockito.spy(Mockito.java:1788)
at org.kubek2k.springockito.core.internal.spy.SpySpringockitoPostProcessor.postProcessAfterInitialization(SpySpringockitoPostProcessor.java:19)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 94 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@4d68b571
at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
... 103 common frames omitted
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.31-b07
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 1.8.0_31-b13
JVM info : mixed mode
OS name : Windows Server 2008 R2
OS version : 6.1
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:172)
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:408)
at java.lang.Class.newInstance(Class.java:438)
at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:96)
... 107 common frames omitted
Caused by: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@7f68a719
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:366)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:102)
... 113 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:353)
... 117 common frames omitted
Caused by: com.sun.tools.attach.AttachNotSupportedException: no providers installed
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
... 122 common frames omitted
Removing jmockit from classpath solves the problem. But we are looking for solution which can help us continue using this tools together.
<mockito-core.version>2.7.13</mockito-core.version>
Issue Analytics
- State:
- Created 7 years ago
- Comments:27 (9 by maintainers)
Top Results From Across the Web
AttachNotSupportedException: no providers installed java agent
I'm having troubles to attach my java app to a remote java vm. I'm using java 8u45 ...
Read more >Could not initialize inline byte buddy mock maker eclipse
We have mixed environment where some test are written with help of mockito with mock-maker-inline extension and some test use jmockit.
Read more >Java ライブラリ - ひだまりソケットは壊れない
AttachNotSupportedException : no providers installed. When using mock-maker-inline extension and jmockit.jar is found in classpath on Windows ...
Read more >PATH and CLASSPATH (The Java™ Tutorials > Essential ...
Consult the installation instructions included with your installation of the Java Development ... Update the PATH Environment Variable (Microsoft Windows).
Read more >SLF4J Warning: Class Path Contains Multiple SLF4J Bindings
By design, SLF4J will only bind with one logging framework at a time. Consequently, if more than one binding is present on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found a workaround for the issue adding this in your gradle file as dependency:
testImplementation files(Jvm.current().toolsJar)
This is working for me and I can have mockito with inline extension and jmockit together.I seem to be having some similar issues, running on Linux with the latest Oracle JDK: