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

Exception when trying to instantiate Reflections #219

Open
Rafaelsk opened this issue Apr 24, 2018 · 5 comments
Open

Exception when trying to instantiate Reflections #219

Rafaelsk opened this issue Apr 24, 2018 · 5 comments

Comments

@Rafaelsk
Copy link

Rafaelsk commented Apr 24, 2018

Under JDK8:

Code:

Reflections reflections = new Reflections("my.package");

Exception

java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;
	at org.reflections.Reflections.expandSuperTypes(Reflections.java:380) ~[reflections-0.9.11.jar:na]
	at org.reflections.Reflections.<init>(Reflections.java:126) ~[reflections-0.9.11.jar:na]
	at org.reflections.Reflections.<init>(Reflections.java:168) ~[reflections-0.9.11.jar:na]
	at org.reflections.Reflections.<init>(Reflections.java:141) ~[reflections-0.9.11.jar:na]
@isaki
Copy link

isaki commented Apr 24, 2018

That means you have an old version of Guava in your class path. Check your Guava version.

@Rafaelsk
Copy link
Author

I see the project have 2 guava libraries version 18.0 and 20.0 respectively.

@isaki
Copy link

isaki commented Apr 25, 2018

20.0 is pulled in by Reflections most likely, but 18.0 is probably winning. You could try setting up managed dependencies to force only 20. I currently force 24.1-jre and it works well.

@haixuan8192
Copy link

@Rafaelsk I have also encountered this problem, how do you solve it?

@Rafaelsk
Copy link
Author

@haixuan8192 I didn't. I couldn't use the library so I used Java's plain Reflection code form the JDK library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants