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

雨燕双飞 提交于 2019-12-12 17:21:29

问题


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


回答1:


This is caused by a bug which was fixed in October 2014. Upgrading Guice (and Guava with it) will solve the problem.




回答2:


  • 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*).




回答3:


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>



回答4:


I had this error and when I changed the jdk version to be 7 instead of 8 the issue disappeared.



来源:https://stackoverflow.com/questions/32528042/maven-java-lang-illegalaccesserror-tried-to-access-method-com-google-common-col

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!