LANGUAGE/!$%!% ERROR NOTE 2016. 2. 7. 15:06




///// 에러


> java -jar myapp.jar


java.lang.NoClassDefFoundError: groovy/lang/GroovyObject

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(Unknown Source)

        at java.security.SecureClassLoader.defineClass(Unknown Source)

        at java.net.URLClassLoader.defineClass(Unknown Source)

        at java.net.URLClassLoader.access$100(Unknown Source)

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        ... 13 more

Exception in thread "main"




///// 문제


- groovy의 의존성 설정이 잘못 되었을 경우

- jar로 패키징이 잘못 되었을 경우! (manifest설정이 잘못된 경우)




///// 해결


내 경우에는


gradle clean jar 가 아니라

gradle clean build로 jar를 생성했더니 되었다.


jar task에 대한 설정을 잘 못 해놓았던 것 같다...




///// 참조

Re: Problems using the CodeNarc plugin:

http://comments.gmane.org/gmane.comp.java.sonar.general/5862