Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError: 'void com.google.common.base.Throwables.throwIfUnchecked(java.lang.Throwable)' #1772

Closed
AresEkb opened this issue May 13, 2020 · 9 comments
Labels

Comments

@AresEkb
Copy link

AresEkb commented May 13, 2020

Hi

I'm trying to build sprotty-server

I cloned it's repository and executed gradlew build on Windows 10 and JDK 1.8. One of the tests is failed, so I'm trying to change this test and rebuild the project.

The problem is that the test is written on Xtend and I get the following exception:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':org.eclipse.sprotty.layout:generateTestXtext'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
...
Caused by: java.lang.NoSuchMethodError: 'void com.google.common.base.Throwables.throwIfUnchecked(java.lang.Throwable)'
	at org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver.reentrantResolve(DefaultReentrantTypeResolver.java:145)
	at org.eclipse.xtext.xbase.typesystem.internal.CompoundReentrantTypeResolver.reentrantResolve(CompoundReentrantTypeResolver.java:79)

The project depends on guava 27.1-jre and everithing seems to be fine:

testCompile - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead).
+--- javax.inject:javax.inject:1
+--- org.eclipse.xtend:org.eclipse.xtend.lib:2.21.0
|    +--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0
|    |    \--- com.google.guava:guava:27.1-jre
|    |         +--- com.google.guava:failureaccess:1.0.1
|    |         +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    |         +--- com.google.code.findbugs:jsr305:3.0.2
|    |         +--- org.checkerframework:checker-qual:2.5.2
|    |         +--- com.google.errorprone:error_prone_annotations:2.2.0
|    |         +--- com.google.j2objc:j2objc-annotations:1.1
|    |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.17
|    \--- org.eclipse.xtend:org.eclipse.xtend.lib.macro:2.21.0
|         \--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0 (*)
+--- log4j:log4j:1.2.17
+--- junit:junit:4.12
|    \--- org.hamcrest:hamcrest-core:1.3
\--- com.google.inject:guice:4.2.2
     +--- javax.inject:javax.inject:1
     +--- aopalliance:aopalliance:1.0
     \--- com.google.guava:guava:25.1-android -> 27.1-jre (*)

Maybe the problem is related to #1391 ?

Could you please help to fix this bug?

@cdietrich
Copy link
Member

cdietrich commented May 13, 2020

xtext has no guice 4 support.
if you pull that purposly you should also fix the guava version to 27

@AresEkb
Copy link
Author

AresEkb commented May 13, 2020

I changed guice version to 3.0:

testRuntime - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead).
+--- javax.inject:javax.inject:1
+--- org.eclipse.xtend:org.eclipse.xtend.lib:2.21.0
|    +--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0
|    |    \--- com.google.guava:guava:27.1-jre
|    |         +--- com.google.guava:failureaccess:1.0.1
|    |         +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    |         +--- com.google.code.findbugs:jsr305:3.0.2
|    |         +--- org.checkerframework:checker-qual:2.5.2
|    |         +--- com.google.errorprone:error_prone_annotations:2.2.0
|    |         +--- com.google.j2objc:j2objc-annotations:1.1
|    |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.17
|    \--- org.eclipse.xtend:org.eclipse.xtend.lib.macro:2.21.0
|         \--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0 (*)
+--- log4j:log4j:1.2.17
+--- junit:junit:4.12
|    \--- org.hamcrest:hamcrest-core:1.3
\--- com.google.inject:guice:3.0
     +--- javax.inject:javax.inject:1
     +--- aopalliance:aopalliance:1.0
     \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111
          \--- asm:asm:3.1

It seems that the problem was with org.eclipse.sprotty.layout not org.eclipse.sprotty. So here is a dependency tree for org.eclipse.sprotty.layout:

testRuntime - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead).
+--- project :org.eclipse.sprotty
|    +--- javax.inject:javax.inject:1
|    +--- org.eclipse.xtend:org.eclipse.xtend.lib:2.21.0
|    |    +--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0
|    |    |    \--- com.google.guava:guava:27.1-jre
|    |    |         +--- com.google.guava:failureaccess:1.0.1
|    |    |         +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    |    |         +--- com.google.code.findbugs:jsr305:3.0.2
|    |    |         +--- org.checkerframework:checker-qual:2.5.2
|    |    |         +--- com.google.errorprone:error_prone_annotations:2.2.0
|    |    |         +--- com.google.j2objc:j2objc-annotations:1.1
|    |    |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.17
|    |    \--- org.eclipse.xtend:org.eclipse.xtend.lib.macro:2.21.0
|    |         \--- org.eclipse.xtext:org.eclipse.xtext.xbase.lib:2.21.0 (*)
|    \--- log4j:log4j:1.2.17
+--- org.eclipse.elk:org.eclipse.elk.core:0.6.1
|    +--- org.eclipse.elk:org.eclipse.elk.graph:0.6.1
|    |    +--- com.google.guava:guava:[15.0,19.0) -> 27.1-jre (*)
|    |    +--- org.eclipse.emf:org.eclipse.emf.common:2.12.0
|    |    \--- org.eclipse.emf:org.eclipse.emf.ecore:2.12.0
|    \--- org.eclipse.emf:org.eclipse.emf.ecore.xmi:2.12.0
+--- org.eclipse.elk:org.eclipse.elk.graph.text:0.6.1
|    +--- org.eclipse.elk:org.eclipse.elk.core:0.6.1 (*)
|    \--- org.eclipse.xtext:org.eclipse.xtext:2.16.0
|         +--- org.eclipse.xtext:org.eclipse.xtext.util:2.16.0
|         |    +--- org.eclipse.xtend:org.eclipse.xtend.lib:2.16.0 -> 2.21.0 (*)
|         |    +--- log4j:log4j:1.2.16 -> 1.2.17
|         |    +--- org.eclipse.emf:org.eclipse.emf.common:2.12.0
|         |    +--- org.eclipse.emf:org.eclipse.emf.ecore:2.12.0
|         |    \--- com.google.inject:guice:3.0
|         |         +--- javax.inject:javax.inject:1
|         |         \--- aopalliance:aopalliance:1.0
|         +--- org.eclipse.xtend:org.eclipse.xtend.lib:2.16.0 -> 2.21.0 (*)
|         +--- log4j:log4j:1.2.16 -> 1.2.17
|         +--- org.eclipse.platform:org.eclipse.equinox.common:3.9.0
|         +--- org.eclipse.platform:org.eclipse.osgi:3.12.100
|         +--- org.eclipse.emf:org.eclipse.emf.common:2.12.0
|         +--- org.eclipse.emf:org.eclipse.emf.ecore.xmi:2.12.0
|         +--- com.google.inject:guice:3.0 (*)
|         \--- org.antlr:antlr-runtime:3.2
\--- junit:junit:4.12
     \--- org.hamcrest:hamcrest-core:1.3

Seems that switching to guice 3.0 doesn't help, I get the same exception.

Also I've found the following errors in the build log (these errors was with guice 4 too):

> Task :org.eclipse.sprotty.layout:generateTestXtext FAILED
resource is empty: java:/Objects/java.lang.annotation.Target
resource is empty: java:/Objects/java.lang.annotation.Retention
resource is empty: java:/Objects/java.lang.annotation.Documented
resolution of uriFragment '|1' failed.
resource is empty: java:/Objects/java.util.Map
resolution of uriFragment '|1' failed.
resolution of uriFragment '|1' failed.
resource is empty: java:/Objects/java.util.EnumSet

@cdietrich
Copy link
Member

the asm version looks bad.
Xtext needs asm7

@cdietrich
Copy link
Member

hmm i cloned and the build seems to work fine

./gradlew clean build

also the gradle version (xtext tests with 5.6.3) and the xtext-gradle-plugin (current version is 2.0.8)
dont seem to be current.

@cdietrich
Copy link
Member

do you have something to clone?

@AresEkb
Copy link
Author

AresEkb commented May 13, 2020

You can change something in file https://github.com/eclipse/sprotty-server/blob/master/org.eclipse.sprotty/src/test/java/org/eclipse/sprotty/DefaultDiagramServerTest.xtend and try to build the project. This modification will force Java-code regeneration, causing the exception

@cdietrich
Copy link
Member

am still getting test fails only and not compile errors (both linux and windows)
silly question: do you have JAVA_HOME env set?

@AresEkb
Copy link
Author

AresEkb commented May 13, 2020

Thanks a lot!

PATH variable pointed to JDK 1.8. But JAVA_HOME was set to JDK 13. Changed it to 1.8, and the project is build fine. Only tests are failed.

I don't understand the exact cause of the error. But it seems that it is solved now. Thanks!

@cdietrich
Copy link
Member

you use a old gradle version and a plugin version
Xtext officially supports up to java 11 only

but with gradle 5.6.3 + plugin version 2.0.8 it should work with 13 too

@AresEkb AresEkb closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants