IntelliJ无法使用ClassNotFoundException进行编译:org.apache.log4j.Priority

时间:2015-02-05 18:49:00

标签: java intellij-idea

我刚刚在新的Mac OS上安装了IntelliJ,并尝试编译一个非常简单的基本Java应用程序。这是我得到的:

Information:2/5/15, 10:40 AM - Compilation completed with 1 error and 0 warnings in 11 sec
Error:Abnormal build process termination: 
Build process started. Classpath: /Applications/IntelliJ IDEA 14 CE.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA 14 CE.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 14 CE.app/Contents/lib/ecj-4.4.jar
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:483)
  at org.jetbrains.jps.cmdline.Launcher.main(Launcher.java:58)
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
  at io.netty.util.internal.logging.Log4JLoggerFactory.newInstance(Log4JLoggerFactory.java:29)
  at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:84)
  at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:77)
  at io.netty.channel.MultithreadEventLoopGroup.<clinit>(MultithreadEventLoopGroup.java:32)
  at org.jetbrains.jps.cmdline.BuildMain.main(BuildMain.java:96)
  ... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
  at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 10 more

之前从未见过这个。我该怎么办才能修复它?我已经从头开始安装了IntelliJ。

1 个答案:

答案 0 :(得分:3)

/Library/Java/Extensions中有一个名为netty.jar的文件。我删除了它,问题就消失了。