简体   繁体   中英

maven java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap

Hi I'm getting this error in eclipse running maven using m2eclipse, same error happens with any maven functionality (install, clean, ect.)

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)

the console points towards slf4j as the last constituent

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

My projects maven depends on guava-17.0 and junit-4.10

这是由 2014 年 10 月修复的错误引起的。升级 Guice(以及使用它的 Guava)将解决该问题。

  • Seems like having a classloader issue with the version of guava that you are Using . for Quick Info go: Here

  • some issues mainly because of clashes between guava versions (15.0 in the driver vs 13.0.1*).

Upgrade to latest guava using maven or download the jar and it in your build path and add these lines in your weblogic.xml to deploy using your updated guava java .this worked for me.

Check Resolved issue 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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM