maven java.lang.IllegalAccessError:尝试访问方法com.google.common.collect.MapMaker.makeComputingMap

时间:2015-09-11 16:26:20

标签: java eclipse maven slf4j m2eclipse

您好我在使用m2eclipse运行maven时遇到此错误, 任何maven功能(安装,清理等)都会发生同样的错误

Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class com.google.inject.internal.Annotations$AnnotationChecker
at com.google.inject.internal.Annotations$AnnotationChecker.<init>(Annotations.java:104)
at com.google.inject.internal.Annotations.<clinit>(Annotations.java:122)
at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
at com.google.inject.Key.strategyFor(Key.java:354)
at com.google.inject.Key.get(Key.java:222)
at org.eclipse.sisu.wire.ParameterKeys.<clinit>(ParameterKeys.java:28)
at org.eclipse.sisu.wire.DependencyAnalyzer.<init>(DependencyAnalyzer.java:92)
at org.eclipse.sisu.wire.ElementAnalyzer.<init>(ElementAnalyzer.java:87)
at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:74)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230)
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:96)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:477)
at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:203)
at org.apache.maven.cli.MavenCli.container(MavenCli.java:400)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:207)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

控制台指向slf4j作为最后一个组成部分

constituent[39]: file:/C:/eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.5.1.20150109-1819/jars/slf4j-simple-1.7.5.jar

我的项目maven取决于guava-17.0和junit-4.10

4 个答案:

答案 0 :(得分:1)

这是由2014年10月修复的bug引起的。升级Guice(以及带有它的番石榴)将解决问题。

答案 1 :(得分:1)

  • 似乎对您正在使用的番石榴版本存在类加载器问题。对于快速信息,请转到:Here

  • 一些问题主要是因为番石榴版本之间的冲突(驱动程序中的15.0与13.0.1 *)。

答案 2 :(得分:0)

使用maven升级到最新的guava或者在你的构建路径中下载jar并在你的weblogic.xml中添加这些行来使用你更新的guava java进行部署。这对我有用。

检查已解决的问题here

  <wls:prefer-application-packages>

        <wls:package-name>com.ctc.wstx.*</wls:package-name>
        <wls:package-name>org.codehaus.stax2.*</wls:package-name>
        <wls:package-name>com.sun.xml.messaging.saaj.*</wls:package-name>

        <wls:package-name>com.google.common.*</wls:package-name>

        <wls:package-name>org.bouncycastle.*</wls:package-name>
    </wls:prefer-application-packages>

答案 3 :(得分:0)

我遇到了这个错误,当我将jdk版本更改为7而不是8时,问题就消失了。