Error running Maven - maven

I am trying to build a maven (latest version 3.1.1) project and for some reason when I run any maven command, such as maven clean, or maven compile, I get the following error:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.slf4j.LoggerFactory.reset()V from class org.slf4j.MavenSlf4jFriend
at org.slf4j.MavenSlf4jFriend.reset(MavenSlf4jFriend.java:33)
at org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration.activate(Slf4jSimpleConfiguration.java:60)
at org.apache.maven.cli.MavenCli.logging(MavenCli.java:348)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:205)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Had the same problem with Maven on OS X 10.9 installed using Brew. It turns out Maven brought its own libs including slf4j into /usr/local/Cellar/maven/3.2.2/libexec/lib. However I already had another version of slf4j in my classpath in /Library/Java/Extensions
Solution: remove slf4j from the OS X default classpath so that Maven can use its version without conflicts.

Try to Change the Java JDK version and reinstall the maven. It worked for me. Even I faced the same error but could not found working solution. I have changed my JDK version 1.8 to JDK 9.0.1 and reinstalled Maven and it worked fine.

You need to remove slf4j libraries from java/path/jre/lib/ext/
Then it will work

Related

Activiti BPMN doesn't have fonts when I use openjdk

I'm using activity https://www.activiti.org/userguide/
I update my project to open jdk 8 but it doesn't work. Im getting this error
com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:n)
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:n)
at sun.awt.FontConfiguration.init(FontConfiguration.java:n)
at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:n)
at sun.font.SunFontManager$2.run(SunFontManager.java:n)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<init>(SunFontManager.java:n)
at sun.awt.FcFontManager.<init>(FcFontManager.java:n)
at sun.awt.X11FontManager.<init>(X11FontManager.java:n)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:n)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:n)
at java.lang.reflect.Constructor.newInstance(Constructor.java:n)
at java.lang.Class.newInstance(Class.java:n)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:n)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:n)
at sun.font.SunFontManager.getInstance(SunFontManager.java:n)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:n)
at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:n)
at org.activiti.image.impl.DefaultProcessDiagramCanvas.initialize(DefaultProcessDiagramCanvas.java:n)
at org.activiti.image.impl.DefaultProcessDiagramCanvas.<init>(DefaultProcessDiagramCanvas.java:n)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.initProcessDiagramCanvas(DefaultProcessDiagramGenerator.java:n)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateProcessDiagram(DefaultProcessDiagramGenerator.java:n)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateImage(DefaultProcessDiagramGenerator.java:n)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateImage(DefaultProcessDiagramGenerator.java:n)
at com.MyClass.getBpmnDiagram(MyClass.java:n)
So, Does anyone know which maven library brings these dependencies of sun and java 2D?
or How I can fix this problem?
Thanks!
It was fixed installing fontconfig in linux machine.

How to resolve conflict in maven dependencies apache: commons-fileupload 1.3.2 and commons-io 2.5

I have developed an app using jhipster generator. I have only slightly changed the pom.xml file. I needed the commons file-upload to be able to receive multipart requests. I am not sure but i believe that was the only change i have made.
I have only noticed the maven build problems when started trying to build the production image.
My IntelliJ uses bundled maven 2 and it works fine there, but when I switch back to maven 3 bundled or installed in my operating system (windows 7 x64) I receive this error.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/exception/ExceptionHandler
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
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)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.exception.ExceptionHandler
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 17 more
I believe one of the reasons my be conflict in my dependencies.
Here is snapshot of intelij analysis of my pom.xml.
[edit 1]
I have gave up trying to resolve this error. So what i tried to do now is to generate a new project with jhipster and copy all custom elements that was created by me into it.
And here i stumbled on a problem, which is i cant really do that, uperantly i have upgraded the jhipster-generator package incorrectly somewhere in the past.
So now on freshly generated projects i receive the same error + in my webapp bunch of files has an error like "ng-jhipster has no exported class AlertService" or the same but instead of AlertService its EventManager or some other class but it`s always the same package. Yes tried upgrading it.
I have found similar classes with Jhi prefixes on them in #ngx-jhipster package so it seams to me as as generator uses classes for one version of jhipster and package.json, pom.xml for another.
I tried upgrading the jhipster-generator, yarn and yo, removing the jhipster-generator dependency altogether and adding them back again, and generating projects again. Nothing worked =(

UnsupportedClassVersionError jdk 1.8

When I run my project I get the following errors. My jdk is currently 1.8. To fix it, I have tried resetting the jdk, downgrading to 1.7, I've checked my buildpaths, I've gone into preferences and restored to defaults and it's the same error. I've deleted and reinstalled the jdk as well.
In regards to the error about JavaLaunchHelper I found a question on here that said it's a bug that isn't fixed in 1.8 and that it can be ignored as they are actually in the right place.
My IDE is Spring Tool Suite and I'm writing in Spring Data.
Any help is appreciated, thanks!
objc[8419]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
java.lang.UnsupportedClassVersionError: io/pivotal/ticket/RuleControllerTest : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The class io/pivotal/ticket/RuleControllerTest has been compiled using Java 1.8, but you are trying to run it using Java 1.7 (or earlier). You should check your run config. Since this is being run from Eclipse's test runner, you need to either change the run config for that or run Eclipse using JDK 1.8.

Plugin 'org.sonarlint.idea' failed to initialize and will be disabled. Please restart IntelliJ IDEA

I am getting the error above when I try to install the SonarLint plugin on my IntelliJ.
Mac OS X Yosemite 10.10.5
IntelliJ 15.06
SonarLint Plugin 2.2 (tried 2.1 also)
My JDK is set to 1.8 but not sure what is causing the issue. Any help will be appreciated.
Plugin 'org.sonarlint.idea' failed to initialize and will be disabled. Please restart IntelliJ IDEA.
com.intellij.diagnostic.PluginException: org/sonarlint/intellij/config/global/SonarLintGlobalSettings : Unsupported major.minor version 51.0 [Plugin: org.sonarlint.idea]
at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:130)
at com.intellij.ide.plugins.cl.PluginClassLoader.a(PluginClassLoader.java:77)
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:66)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:408)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:96)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:455)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:447)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:60)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:361)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.UnsupportedClassVersionError: org/sonarlint/intellij/config/global/SonarLintGlobalSettings : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.lang.ClassLoader.defineClass(ClassLoader.java:471)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:260)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:256)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:225)
at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:124)
... 30 more
The following indicates that the JDK you are running with is not able to load classes compiled with JDK 7: Unsupported major.minor version 51.0
Check the JDK used by Intellij in the menu 'IntelliJ => About IntelliJ Idea'.
SonarLint for IntelliJ 2.2 requires JDK >= 7. Also note that upcoming new versions will probably require JDK >= 8.
To change the JVM that intellij Uses by default refer https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under.
You can Update /Applications/IntelliJ\ IDEA\ 14\ CE.app/Contents/Info.plist
and replace JVMVersion 1.6* with 1.8*
JVMVersion
1.8*

Error creating .war file

I am testing Tomcat7 showing data from the example table "malaga_plagues". I have done changes but, when I try test it again, I obtain the following error creating .war file.
[root#host-192-168-192-78 AMS_Widhoc]# ../../../apache-maven-3.3.3/bin/mvn package
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
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)
[root#host-192-168-192-78 AMS_Widhoc]#
One month ago this was working fine, but now I have resumed the example and it does not work. I reinstalled Orion CB in mi VM but I didn't change anything in Tomcat.
Could you help me? Thank you.
Maven 3.3.3 is only compatible with Java 7+, and it seems that you are trying to run it with Java 6. Please check your JAVA_HOME environment variable, it should point to a Java 7 JDK.

Resources