Home > Software design >  ClassNotFoundException: com.google.common.collect.Multimap JPAQuery
ClassNotFoundException: com.google.common.collect.Multimap JPAQuery

Time:05-21

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

CodePudding user response:

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.

CodePudding user response:

Adding Guava dependecy in Maven helped

  • Related