nested exception is java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects

先说明下我的项目框架:我是用jeecg的框架做的Oa项目,里面有定时器的配置,我新建了一个Grpc的maven项目,用主项目调用这个maven项目进行定时,报错如下:

org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'pushData' on target class [class com.gxzb.DCManagement.grpc.proto.transmit.TranSmitClient$$EnhancerBySpringCGLIB$$1df0095e] failed; nested exception is java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:331)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:112)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
    at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:257)
    at com.gxzb.DCManagement.grpc.proto.transmit.TranSmitClient.push_data(TranSmitClient.java:201)
    at com.gxzb.DCManagement.grpc.proto.transmit.TranSmitClient.pushData(TranSmitClient.java:189)
    at com.gxzb.DCManagement.grpc.proto.transmit.TranSmitClient$$FastClassBySpringCGLIB$$4a46fb87.invoke()
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at com.gxzb.DCManagement.grpc.proto.transmit.TranSmitClient$$EnhancerBySpringCGLIB$$1df0095e.pushData()
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:322)

    ... 3 more

报这个错com/google/common/base/MoreObjects原因是缺少包,但是我项目里是有的啊,然后找到了JAVA_HOME目录下的/jre/lib/ext目录下,里面没有这个包,于是把guava-19.0.jar,和guava-r09.jar CP到这个目录下,顺利搞定,做一个记录,以免再掉坑里。记得Grpc都是依赖于java编译环境,类加载时ExtClassLoader会加载jre/lib/ext里面的jar。


你可能感兴趣的:(nested exception is java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects)