Discussion:
Problem with using gwtmockito and
a***@pixel.de
2018-08-21 14:17:56 UTC
Permalink
Hello All,

sorry if this is not a pure GWT question. I was wondering if any of you is
successfully using gwtmockito with Java 9 or later (I tried with Java 10).
Apparently by updating mockito and gwtmockito to recent versions it should
work. I am using
gwtmockito 1.1.8
and mockito2.21.0

and I still am getting a
java.lang.IllegalStateException: Could not initialize plugin: interface
org.mockito.plugins.MockMaker
Caused by: java.lang.IllegalAccessError: failed to access class
net.bytebuddy.implementation.Implementation$Target$AbstractBase$DefaultMethodInvocation
from class
net.bytebuddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory

we are using Java 10. I documented the error on
https://github.com/google/gwtmockito/issues/75 and would try to tackle it
myself but have no idea where to start

Any help will be greatly appreciated. Thank you,

Alex
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Lars
2018-08-21 18:31:52 UTC
Permalink
What version of bytebuddy do you use?
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
a***@pixel.de
2018-08-22 10:41:17 UTC
Permalink
bytebuddy 1.8.15

[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.8.15:test
[INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.8.15:test
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Lars
2018-08-22 16:19:55 UTC
Permalink
Even if it's not latest (bytebuddy), it looks good...

Your trace in the issue (https://github.com/google/gwtmockito/issues/75)
points to line 197 of GwtMockitoTestRunner (btw. the only gwtmockito line
in the trace)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at com.google.gwtmockito.GwtMockitoTestRunner.run(GwtMockitoTestRunner.java:197)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


but this line (classes.add(Widget.class);) did not match with the stack
https://github.com/google/gwtmockito/blob/master/gwtmockito/src/main/java/com/google/gwtmockito/GwtMockitoTestRunner.java#L197


Are you sure you have the right gwtmockito (and only one version) in the
path? Or did you somehow patch it?

In addition I assume the pure mockito (without gwtmockito) works for you
with Java9/10?!
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
a***@pixel.de
2018-08-23 10:48:13 UTC
Permalink
Hi Lars,

I really appreciate your support, thanks.

Yes we had a small patch In GwtMockitotestRunner, but I tested with the
unpatched version also (different test now):

[ERROR]
testGetMissingActivity(de.***.***.client.app.init.***ActivityMapperTest)
Time elapsed: 0 s <<< 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.$Proxy28.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:1895)
at org.mockito.Mockito.mock(Mockito.java:1867)
at
de.***.***.test.TestingMessagesFactory.setupMessagesForReturnMethodNameAsStringForAnyCalledMethod(TestingMessagesFactory.java:30)
at
de.***.***.test.TestingMessagesFactory.createMessages(TestingMessagesFactory.java:23)
at
de.***.***.test.TestingMessagesFactory.<init>(TestingMessagesFactory.java:15)
at
de.***.***.test.abstracttest.ClientContext.<init>(ClientContext.java:114)
at
de.***.***.test.abstracttest.ClientContext.$ClientContext(ClientContext.java:110)
at
de.***.***.client.app.init.***ActivityMapperTest.<init>(***ActivityMapperTest.java:33)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at
org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
at
org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
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
com.google.gwtmockito.GwtMockitoTestRunner.run(GwtMockitoTestRunner.java:373)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340)
at
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413)
Caused by: java.lang.IllegalAccessError: failed to access class
net.bytebuddy.implementation.Implementation$Target$AbstractBase$DefaultMethodInvocation
from class net.byteb
uddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory
at
net.bytebuddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory.make(SubclassImplementationTarget.java:149)
at
net.bytebuddy.dynamic.scaffold.MethodRegistry$Default$Prepared.compile(MethodRegistry.java:668)
at
net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:171)
at
net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:163)
at
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:2669)
at
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:2771)
at
net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$UsingUnsafeInjection.make(ClassInjector.java:761)
at
net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:375)
at
net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:362)
at java.base/java.security.AccessController.doPrivileged(Native
Method)
at
net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.<clinit>(ClassInjector.java:68)
at
org.mockito.internal.creation.bytebuddy.SubclassInjectionLoader.<init>(SubclassInjectionLoader.java:28)
at
org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.<init>(SubclassByteBuddyMockMaker.java:33)
at
org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.<init>(ByteBuddyMockMaker.java:21)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.lang.Class.newInstance(Class.java:560)
at
org.mockito.internal.configuration.plugins.DefaultMockitoPlugins.create(DefaultMockitoPlugins.java:66)
at
org.mockito.internal.configuration.plugins.DefaultMockitoPlugins.getDefaultPlugin(DefaultMockitoPlugins.java:43)
at
org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:67)
at
org.mockito.internal.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)
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:1895)
at org.mockito.Mockito.mock(Mockito.java:1867)
at
de.***.***.test.abstracttest.ClientBundleFactory.setup***CssForReturnMethodNameAsStringForAnyCalledMethod(ClientBundleFactory.java:68)
at
de.***.***.test.abstracttest.ClientBundleFactory.<init>(ClientBundleFactory.java:40)
at
de.***.***.test.abstracttest.ClientContext.<init>(ClientContext.java:82)
... 27 more

We have no unwanted dependency that I can find

$ mvn dependency:tree | grep mockito
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test

$ mvn dependency:tree | grep bytebuddy
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile

As you see I updated bytebuddy to 1.8.17
Post by a***@pixel.de
Hello All,
sorry if this is not a pure GWT question. I was wondering if any of you is
successfully using gwtmockito with Java 9 or later (I tried with Java 10).
Apparently by updating mockito and gwtmockito to recent versions it should
work. I am using
gwtmockito 1.1.8
and mockito2.21.0
and I still am getting a
java.lang.IllegalStateException: Could not initialize plugin: interface
org.mockito.plugins.MockMaker
Caused by: java.lang.IllegalAccessError: failed to access class
net.bytebuddy.implementation.Implementation$Target$AbstractBase$DefaultMethodInvocation
from class
net.bytebuddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory
we are using Java 10. I documented the error on
https://github.com/google/gwtmockito/issues/75 and would try to tackle it
myself but have no idea where to start
Any help will be greatly appreciated. Thank you,
Alex
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Lars
2018-08-23 14:33:12 UTC
Permalink
May, but this only guessing, because we did not use java9/10 at the moment
(still with java8) and in addition stepped away from the classloader
handling of gwtmockito (after having some issues), you have to include net.bytebuddy
to the list of classes loaded by the standard classloader.
You could do this be sub classing GwtMockitoTestRunnerand overwrite/extend
getPackagesToLoadViaStandardClassloader or using the WithPackagesToLoadViaStandardClassLoader
annotation.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Lars
2018-08-23 17:57:15 UTC
Permalink
In addition I found this issue https://github.com/google/gwtmockito/issues/72 to get Java9 running...
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
a***@pixel.de
2018-08-27 11:17:17 UTC
Permalink
I added "net.bytebuddy" as an extra package in the
getPackagesToLoadViaStandardClassloader () method, This did the trick!

Thank you so much Lars!
Post by Lars
May, but this only guessing, because we did not use java9/10 at the moment
(still with java8) and in addition stepped away from the classloader
handling of gwtmockito (after having some issues), you have to include net.bytebuddy
to the list of classes loaded by the standard classloader.
You could do this be sub classing GwtMockitoTestRunnerand overwrite/extend
getPackagesToLoadViaStandardClassloader or using the WithPackagesToLoadViaStandardClassLoader
annotation.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Lars
2018-08-27 18:17:02 UTC
Permalink
Cool :-)
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Loading...