java.lang.noclassdeffounderror:无法初始化类

9lowa7mx  于 2021-07-13  发布在  Java
关注(0)|答案(1)|浏览(763)

我想从bingads下载一份报告。我的代码在idea内部工作下载报告,没什么大问题。当我试图让它在sbt内部运行时,就像:
h24\u bing\u config=/home/oleber/del/develop\u bing.json sbt clean“项目导入”“运行”
执行失败如下:

[oleber] [WARN] [home24-aws] [org.apache.cxf.transport.https.HttpsURLConnectionFactory] [Default key managers cannot be initialized: /home/oleber/.keystore (No such file or directory)]
[oleber] [WARN] [home24-aws] [org.apache.cxf.transport.https.HttpsURLConnectionFactory] [Default key managers cannot be initialized: /home/oleber/.keystore (No such file or directory)]
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.xml.soap.FactoryFinder.newInstance(FactoryFinder.java:47)
    at javax.xml.soap.FactoryFinder.find(FactoryFinder.java:194)
    at javax.xml.soap.FactoryFinder.find(FactoryFinder.java:98)
    at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:74)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:146)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:111)
    at org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver.createMessageFactory(SAAJFactoryResolver.java:56)
    at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.getFactory(SAAJOutInterceptor.java:87)
    at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleMessage(SAAJOutInterceptor.java:123)
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:120)
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:71)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:416)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:394)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invokeAsync(JaxWsClientProxy.java:297)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
    at com.sun.proxy.$Proxy68.submitGenerateReportAsync(Unknown Source)
    at com.microsoft.bingads.reporting.ReportingServiceManager.submitDownloadAsync(ReportingServiceManager.java:196)
    at importer.bing.BingAdsImporterDownloader.submit(BingAdsImporterDownloader.scala:104)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1$$anonfun$apply$2.apply(BingAdsImporterDownloader.scala:171)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1$$anonfun$apply$2.apply(BingAdsImporterDownloader.scala:170)
    at common.ManagedResource$.withTmpDir(ManagedResource.scala:47)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1.apply(BingAdsImporterDownloader.scala:170)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1.apply(BingAdsImporterDownloader.scala:159)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.xml.soap.FactoryFinder.newInstance(FactoryFinder.java:47)
    at javax.xml.soap.FactoryFinder.find(FactoryFinder.java:194)
    at javax.xml.soap.FactoryFinder.find(FactoryFinder.java:98)
    at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:74)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:146)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:111)
    at org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver.createMessageFactory(SAAJFactoryResolver.java:56)
    at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.getFactory(SAAJOutInterceptor.java:87)
    at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleMessage(SAAJOutInterceptor.java:123)
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:120)
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:71)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:416)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:394)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invokeAsync(JaxWsClientProxy.java:297)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
    at com.sun.proxy.$Proxy68.submitGenerateReportAsync(Unknown Source)
    at com.microsoft.bingads.reporting.ReportingServiceManager.submitDownloadAsync(ReportingServiceManager.java:196)
    at importer.bing.BingAdsImporterDownloader.submit(BingAdsImporterDownloader.scala:104)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1$$anonfun$apply$2.apply(BingAdsImporterDownloader.scala:171)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1$$anonfun$apply$2.apply(BingAdsImporterDownloader.scala:170)
    at common.ManagedResource$.withTmpDir(ManagedResource.scala:47)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1.apply(BingAdsImporterDownloader.scala:170)
    at importer.bing.BingAdsImporterDownloader$$anonfun$process$1.apply(BingAdsImporterDownloader.scala:159)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

两个地方都有警告。
我完全迷路了。你有什么可能的解决办法吗?

ndasle7k

ndasle7k1#

有关密钥库的警告与异常无关。
问题很可能是失败的构建缺少对环境的依赖 com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl . 想法很可能传递了这种依赖性。这是可能的,因为内部构建可能位于另一个构建环境(类路径/目标平台)中。
最常见的原因 NoClassDefFoundErrors 是否在引用类的静态初始值设定项中引发异常(exceptionininitializer作为根本原因)和 ClassNotFoundExceptions 对于引用的类。后者是如果 SAAJMetaFactoryImpl 缺少,但没有包含factoryimpl本身的库。
我怀疑异常包含另一个 Caused-By 链式链接,它依次包含异常的根本原因,并提到实际缺少的类。也许您可以重新配置构建以显示引发异常的完整原因链。
一般来说,尝试将两个构建环境与它们用于解决依赖关系的目标平台进行比较。这使得缺少的库变得显而易见。

相关问题