0

So I want to use JPAQuery to make filtration in my spring app but this line:

@PersistenceContext
EntityManager em;

JPAQuery <Customer> jpaQuery = new JPAQuery<>(em);

is throwing:

java.lang.NoClassDefFoundError: com/google/common/collect/Multimap

Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Multimap at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 72 more

1
  • You need add the dependency of the target class first and check if there is still the same issue. The lib should be Guava dependency. Commented May 21, 2022 at 14:37

1 Answer 1

0

Probably this piece of code is not making this specific error and somehow you are importing this class somewhere else, if you really need it make sure to properly import it with your dependency management system (maven, gradle) otherwise try to find which component is using this class and remove it.

Sign up to request clarification or add additional context in comments.

2 Comments

that's te only one place where Im using it
It could be the only place where you are using the JPAQuery, yes, but if you look to the error message that you got there is related to another class (Multimap) from google commons, and that's the class that I'm referring to, so somewhere on your code you are importing that class Multimap and you need to find it, either to properly import it into your system or to remove it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.