noclassdeffounderror:无法初始化类com.google.inject.internal.annotations

mcdcgff0  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(253)

我已经尝试修复这个错误很长一段时间了:

java.lang.NoClassDefFoundError: Could not initialize class com.google.inject.internal.Annotations
        at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
        at com.google.inject.Key.strategyFor(Key.java:339)
        at com.google.inject.Key.get(Key.java:274)
        at com.google.inject.internal.AbstractBindingBuilder.annotatedWithInternal(AbstractBindingBuilder.java:84)
        at com.google.inject.internal.BindingBuilder.annotatedWith(BindingBuilder.java:56)
        at com.google.inject.internal.BindingBuilder.annotatedWith(BindingBuilder.java:43)
        at com.mycompany.BackendApplication$1.configure(BackendApplication.java:179)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.AbstractModule.install(AbstractModule.java:121)
        at org.restlet.ext.guice.RestletGuice$Module.configure(RestletGuice.java:194)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:94)
        at com.google.inject.Guice.createInjector(Guice.java:71)
        at com.google.inject.Guice.createInjector(Guice.java:61)
        at org.restlet.ext.guice.RestletGuice$Module$KeyFinder.getInjector(RestletGuice.java:81)
        at org.restlet.ext.guice.RestletGuice$Module$KeyFinder.getContext(RestletGuice.java:71)
        at org.restlet.Restlet.handle(Restlet.java:300)
        at org.restlet.resource.Finder.handle(Finder.java:216)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:77)
        at org.restlet.Application.handle(Application.java:385)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
        at org.restlet.Component.handle(Component.java:408)
        at org.restlet.Server.handle(Server.java:507)
        at org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)
        at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1117)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
        at nginx.unit.Context$ServletReg.service(Context.java:2011)
        at nginx.unit.Context$CtxFilterChain.doFilter(Context.java:750)
        at nginx.unit.Context.service(Context.java:971)

寻找问题所在 mvn dependency:tree ```
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ backend-server ---
[INFO] com.mycompany:backend-server:war:0-SNAPSHOT
[INFO] +- org.projectlombok:lombok:jar:1.18.16:provided
[INFO] +- junit:junit:jar:4.12:test
[INFO] | - org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.restlet.jee:org.restlet:jar:2.4.0:compile
[INFO] +- org.restlet.jee:org.restlet.ext.fileupload:jar:2.4.0:compile
[INFO] | - commons-fileupload:commons-fileupload:jar:1.3:compile
[INFO] +- org.restlet.jee:org.restlet.ext.servlet:jar:2.4.0:compile
[INFO] +- com.google.inject:guice:jar:4.0:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | - aopalliance:aopalliance:jar:1.0:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- org.restlet.jee:org.restlet.ext.guice:jar:2.4.0:compile
[INFO] +- org.restlet.jee:org.restlet.ext.swagger:jar:2.4.0:compile
[INFO] | +- org.scala-lang:scala-library:jar:2.9.1:compile
[INFO] | +- org.scala-lang:scalap:jar:2.9.1:compile
[INFO] | | - org.scala-lang:scala-compiler:jar:2.9.1:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] | +- com.wordnik:swagger-models:jar:1.5.3-M1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.4:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.4.4:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.4.4:compile
[INFO] | | - org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.4.4:compile
[INFO] | | - org.yaml:snakeyaml:jar:1.12:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.4.4:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.4.4:compile
[INFO] | +- org.restlet.jee:org.restlet.ext.jackson:jar:2.4.0:compile
[INFO] | | - org.codehaus.woodstox:woodstox-core-asl:jar:4.3.0:compile
[INFO] | +- org.restlet.jee:org.restlet.ext.jaxrs:jar:2.4.0:compile
[INFO] | | +- javax.mail:mail:jar:1.4.2:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] | | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.6.Final:compile
[INFO] | | | +- org.jboss.resteasy:jaxrs-api:jar:3.0.6.Final:compile
[INFO] | | | +- org.scannotation:scannotation:jar:1.0.3:compile
[INFO] | | | | - javassist:javassist:jar:3.12.1.GA:compile
[INFO] | | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | | | - net.jcip:jcip-annotations:jar:1.0:compile
[INFO] | | - org.restlet.lib:org.simpleframework.simple-xml:jar:2.7.3:compile
[INFO] | - org.restlet.jee:org.restlet.ext.platform:jar:2.4.0:compile
[INFO] +- org.restlet.jee:org.restlet.ext.xstream:jar:2.3.12:compile
[INFO] +- org.restlet.jee:org.restlet.ext.json:jar:2.4.0:compile
[INFO] | - org.json:json:jar:20160212:compile
[INFO] +- org.restlet.jee:org.restlet.ext.apispark:jar:2.3.12:compile
[INFO] | +- com.wordnik:swagger-annotations:jar:1.5.3-M1:compile
[INFO] | - com.wordnik:swagger-core:jar:1.5.3-M1:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.2:compile
[INFO] | - javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.codehaus.jettison:jettison:jar:1.2:compile
[INFO] | - stax:stax-api:jar:1.0.1:compile
[INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.14:compile
[INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | - xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- com.alibaba:fastjson:jar:1.2.8:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] +- com.auth0:java-jwt:jar:2.0.1:compile
[INFO] +- org.mindrot:jbcrypt:jar:0.3m:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.9:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.9:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.10.0:compile
[INFO] +- org.jetbrains.xodus:xodus-openAPI:jar:1.3.232:compile
[INFO] | +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.3.10:compile
[INFO] | | +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.3.10:compile
[INFO] | | - org.jetbrains:annotations:jar:13.0:compile
[INFO] | +- io.github.microutils:kotlin-logging:jar:1.5.4:compile
[INFO] | - org.jetbrains.xodus:xodus-utils:jar:1.3.232:compile
[INFO] +- org.jetbrains.xodus:xodus-environment:jar:1.3.232:compile
[INFO] | - org.jetbrains.xodus:xodus-compress:jar:1.3.232:compile
[INFO] | - org.apache.commons:commons-compress:jar:1.12:compile
[INFO] +- org.jetbrains.xodus:xodus-entity-store:jar:1.3.232:compile
[INFO] | - org.jetbrains.xodus:xodus-vfs:jar:1.3.232:compile
[INFO] +- org.jetbrains.xodus:xodus-query:jar:1.3.232:compile
[INFO] | - com.github.penemue:keap:jar:0.3.0:compile
[INFO] +- org.jetbrains.xodus:xodus-multinode:jar:1.3.232:compile
[INFO] | - software.amazon.awssdk:s3:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:sdk-core:jar:2.0.0-preview-11:compile
[INFO] | | - org.reactivestreams:reactive-streams:jar:1.0.2:compile
[INFO] | +- software.amazon.awssdk:auth:jar:2.0.0-preview-11:compile
[INFO] | | - software.amazon.awssdk:profiles:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:http-client-spi:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:regions:jar:2.0.0-preview-11:compile
[INFO] | | - com.fasterxml.jackson.jr:jackson-jr-objects:jar:2.9.6:compile
[INFO] | +- software.amazon.awssdk:annotations:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:utils:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:aws-core:jar:2.0.0-preview-11:compile
[INFO] | +- software.amazon.awssdk:apache-client:jar:2.0.0-preview-11:runtime
[INFO] | - software.amazon.awssdk:netty-nio-client:jar:2.0.0-preview-11:runtime
[INFO] | +- io.netty:netty-codec-http:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-codec:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-transport:jar:4.1.26.Final:runtime
[INFO] | | - io.netty:netty-resolver:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-common:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-buffer:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-handler:jar:4.1.26.Final:runtime
[INFO] | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.26.Final:runtime
[INFO] | | - io.netty:netty-transport-native-unix-common:jar:4.1.26.Final:runtime
[INFO] | - com.typesafe.netty:netty-reactive-streams-http:jar:2.0.0:runtime
[INFO] | - com.typesafe.netty:netty-reactive-streams:jar:2.0.0:runtime
[INFO] +- org.zeroturnaround:zt-zip:jar:1.13:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:4.0.1:provided
[INFO] +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | - javax.activation:activation:jar:1.1:compile
[INFO] +- com.sun.jersey:jersey-json:jar:1.19.4:compile
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
[INFO] | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:compile
[INFO] | +- org.codehaus.jackson:jackson-xc:jar:1.9.2:compile
[INFO] | - com.sun.jersey:jersey-core:jar:1.19.4:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.6:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.10:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | - commons-codec:commons-codec:jar:1.10:compile
[INFO] +- com.netflix.rxjava:rxjava-apache-http:jar:0.20.7:compile
[INFO] | +- com.netflix.rxjava:rxjava-core:jar:0.20.7:compile
[INFO] | +- org.apache.httpcomponents:httpasyncclient:jar:4.0:compile
[INFO] | - org.apache.httpcomponents:httpcore-nio:jar:4.3:compile
[INFO] +- com.godaddy:logging:jar:1.2.5:compile
[INFO] | +- net.logstash.logback:logstash-logback-encoder:jar:4.11:compile
[INFO] | | - ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | - com.esotericsoftware:reflectasm:jar:1.11.3:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] | - c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- org.quartz-scheduler:quartz-jobs:jar:2.2.1:compile
[INFO] +- org.ehcache:ehcache:jar:3.8.1:compile
[INFO] | - org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.1:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] | - javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.sun.mail:javax.mail:jar:1.5.5:compile
[INFO] +- org.mozilla:rhino:jar:1.7.10:compile
[INFO] +- org.dynjs:dynjs:jar:0.3.1:compile
[INFO] | +- me.qmx.jitescript:jitescript:jar:0.4.0:compile
[INFO] | +- org.projectodd.rephract:rephract:jar:2.0.1:compile
[INFO] | +- org.jruby:dirgra:jar:0.1:compile
[INFO] | +- com.headius:invokebinder:jar:1.2:compile
[INFO] | +- args4j:args4j:jar:2.0.26:compile
[INFO] | +- org.jboss.aesh:aesh:jar:0.56:compile
[INFO] | | - org.fusesource.jansi:jansi:jar:1.11:compile
[INFO] | +- com.headius:options:jar:1.0:compile
[INFO] | +- org.jruby.joni:joni:jar:2.1.4:compile
[INFO] | | - org.jruby.jcodings:jcodings:jar:1.0.8:compile
[INFO] | - com.github.jnr:jnr-posix:jar:3.0.1:compile
[INFO] | +- com.github.jnr:jnr-ffi:jar:1.0.7:compile
[INFO] | | +- com.github.jnr:jffi:jar:1.2.7:compile
[INFO] | | +- com.github.jnr:jffi:jar:native:1.2.7:runtime
[INFO] | | +- org.ow2.asm:asm:jar:4.0:compile
[INFO] | | +- org.ow2.asm:asm-commons:jar:4.0:compile
[INFO] | | +- org.ow2.asm:asm-analysis:jar:4.0:compile
[INFO] | | +- org.ow2.asm:asm-tree:jar:4.0:compile
[INFO] | | +- org.ow2.asm:asm-util:jar:4.0:compile
[INFO] | | - com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] | - com.github.jnr:jnr-constants:jar:0.8.5:compile
[INFO] +- org.shredzone.acme4j:acme4j-client:jar:2.8:compile
[INFO] | - org.bitbucket.b_c:jose4j:jar:0.7.0:compile
[INFO] +- org.shredzone.acme4j:acme4j-utils:jar:2.8:compile
[INFO] | +- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
[INFO] | - org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
[INFO] +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] +- com.mashape.unirest:unirest-java:jar:1.4.9:compile
[INFO] | - org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] +- com.google.http-client:google-http-client:jar:1.21.0:compile
[INFO] | - com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.google.http-client:google-http-client-gson:jar:1.21.0:compile
[INFO] +- com.google.http-client:google-http-client-jackson2:jar:1.21.0:compile
[INFO] +- com.carlosbecker:guice-junit-test-runner:jar:1.1:test
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.0:compile
[INFO] +- com.wildbit.java:postmark:jar:1.2.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
[INFO] | | | - org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b32:compile
[INFO] | | | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b32:compile
[INFO] | | | - org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32:compile
[INFO] | | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
[INFO] | | - org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile
[INFO] | | - org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | +- eu.medsea.mimeutil:mime-util:jar:2.1.3:compile
[INFO] | - log4j:log4j:jar:1.2.17:compile
[INFO] +- com.amazonaws:aws-java-sdk-core:jar:1.11.744:compile
[INFO] | +- software.amazon.ion:ion-java:jar:1.0.2:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.6.7:compile
[INFO] | - joda-time:joda-time:jar:2.8.1:compile
[INFO] +- com.amazonaws:aws-java-sdk-s3:jar:1.11.744:compile
[INFO] | +- com.amazonaws:aws-java-sdk-kms:jar:1.11.453:compile
[INFO] | - com.amazonaws:jmespath-java:jar:1.11.453:compile
[INFO] +- org.immutables:value:jar:2.7.1:provided
[INFO] +- com.mycompany:customcode-sdk:jar:0-SNAPSHOT:compile
[INFO] +- javax:javaee-web-api:jar:8.0:provided
[INFO] +- org.jsoup:jsoup:jar:1.11.2:compile
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-api:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.141.59:compile
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:3.141.59:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.8.15:compile
[INFO] | +- com.squareup.okhttp3:okhttp:jar:3.11.0:compile
[INFO] | - com.squareup.okio:okio:jar:1.14.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.141.59:compile
[INFO] - com.mycompany:datafactory:jar:0-SNAPSHOT:compile

由于stackoverflow文本限制,我不能直接在这里发布。项目pom依赖关系可在以下位置找到:https://gist.github.com/questionaut/ce8cfc61aee29a3064ffaf683e66515a
我在本地服务器和云服务器上运行它,在本地开发中使用 `mvn jetty:run` 错误不会出现,但是在nginx unit这样的服务器上运行时会抛出错误。这里可能有什么问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题