Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-2547

java.lang.IllegalArgumentException: com.mongodb.client.MongoDatabase referenced from a method is not visible from class loader

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.7 (Moore SR7)
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Description

      Hello! When I work with spring-boot-starter-data-mongodb and I have this issue:

      java.lang.IllegalArgumentException: com.mongodb.client.MongoDatabase referenced from a method is not visible from class loader
       at java.base/java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:858)
       at java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:681)
       at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:627)
       at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:426)
       at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
       at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
       at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:424)
       at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1006)
       at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:123)
       at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:113)
       at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:97)
       at org.springframework.data.mongodb.core.MongoDbFactorySupport$ClientSessionBoundMongoDbFactory.createProxyInstance(MongoDbFactorySupport.java:268)
       at org.springframework.data.mongodb.core.MongoDbFactorySupport$ClientSessionBoundMongoDbFactory.proxyMongoDatabase(MongoDbFactorySupport.java:246)
       at org.springframework.data.mongodb.core.MongoDbFactorySupport$ClientSessionBoundMongoDbFactory.getDb(MongoDbFactorySupport.java:188)
       at org.springframework.data.mongodb.MongoDatabaseUtils.doGetMongoDatabase(MongoDatabaseUtils.java:118)
       at org.springframework.data.mongodb.MongoDatabaseUtils.getDatabase(MongoDatabaseUtils.java:68)
       at org.springframework.data.mongodb.core.MongoTemplate.doGetDatabase(MongoTemplate.java:2351)
       at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2757)
       at org.springframework.data.mongodb.core.MongoTemplate.doFindAndModify(MongoTemplate.java:2676)
       at org.springframework.data.mongodb.core.MongoTemplate.findAndModify(MongoTemplate.java:1086)
       at org.springframework.data.mongodb.core.MongoTemplate.findAndModify(MongoTemplate.java:1061)
       at .repositories.ManualRepository.findAndModifyAccountSub(ManualRepository.java:72)
       at .repositories.ManualRepository$$FastClassBySpringCGLIB$$2d1c6978.invoke(<generated>)
       at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
       at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
       at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
       at .repositories.ManualRepository$$EnhancerBySpringCGLIB$$7ba2b169.findAndModifyAccountSub(<generated>)
       at .services.QiwiServiceImpl.accountSub(QiwiServiceImpl.java:219)
       at .services.QiwiServiceImpl.lambda$withdraw$0(QiwiServiceImpl.java:62)
       at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
       at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164)
       at .services.QiwiServiceImpl.withdraw(QiwiServiceImpl.java:62)
       at jdk.internal.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
       at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.lang.Thread.run(Thread.java:834)
      

      This error arises when I calling mongoTemplate.findAndModify() method.
      But, it's error doesn't arises in first ~100-150 attempts, then they appear not with each, but with most requests. Restart application resolves(temporarily) this issue.

      On Ubuntu/Windows with Liberica 11.0.7. this error doesn't arises.

        Attachments

          Activity

            People

            Assignee:
            cstrobl Christoph Strobl
            Reporter:
            eltgm eltgm
            Last updater:
            Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: