2014-04-10 219 views
1

最近,我從STS 3.3導入了一個正在運行的Grails項目到Intelj IDE中。但是,當我運行該應用程序時,在調試模式下出現以下錯誤。IntelliJ IDEA無法運行Grails 2.3.0項目

我在的Grails 2.3.0的IntelliJ IDEA 13.1.1

論IntelliJIDE我看到下面的輸出Grails的控制檯:

/usr/share/java/jdk1.6.0_30/bin/java -Dgrails.home=/opt/grails-2.3.0 -Dbase.dir=/home/you/Projects/terra-connect -Dtools.jar=/usr/share/java/jdk1.6.0_30/lib/tools.jar -Dgroovy.starter.conf=/opt/grails-2.3.0/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -javaagent:/opt/grails-2.3.0/lib/org.springsource.springloaded/springloaded-core/jars/springloaded-core-1.1.3.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7532 -Didea.launcher.bin.path=/home/you/Dev/idea-IU-135.480/bin -Dfile.encoding=UTF-8 -classpath /opt/grails-2.3.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.6.jar:/opt/grails-2.3.0/dist/grails-bootstrap-2.3.0.jar:/home/you/Dev/idea-IU-135.480/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /opt/grails-2.3.0/conf/groovy-starter.conf run-app` 

後堆棧跟蹤運行grails應用程序,用以下信息:

2014-04-10 09:58:48,314 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace: 
java.lang.NullPointerException 
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodGetDeclaredAnnotations(ReflectiveInterceptor.java:935) 
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodGetAnnotations(ReflectiveInterceptor.java:1491) 
    at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:163) 
    at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106) 
    at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:88) 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253) 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) 
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) 
    at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:153) 
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:169) 
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127) 
    at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:122) 
    at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:108) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
2014-04-10 09:58:48,319 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace: 
java.lang.NullPointerException 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
2014-04-10 09:58:48,320 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace: 
java.lang.NullPointerException 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
2014-04-10 09:58:48,320 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace: 
java.lang.NullPointerException 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Disconnected from the target VM, address: '127.0.0.1:50341', transport: 'socket' 

Process finished with exit code 1 

有什麼想法?

+1

提供IDEA和Grails版本pls – emilan

+0

STS有一個類似的問題 - http:// stackoverflow。com/questions/22610626/grails-app-wont-start-from-sts-but-launches-from-terminal –

+0

@emilan updated :) –

回答

0

原來,這不是一個Intellij問題。問題在於在Grails 2.3.0中關閉了-reloading選項。我通過升級到2.3.8解決了我的問題。

1

嘿,我已經得到了你的問題,確定你使用Linux機器。好了,對於你需要做到以下幾點:

這個問題的根源casue是IDE需要根permisssion到RUN序連接到sokcets或succsfully debug.so,你應該做如下改變:

Intellij需要root權限才能使內置函數正常工作。記住

Either start using sudo: 

sudo /your/inteljdirectory/bin/idea.sh 
or give all users to run in debug mode Intellij, then start as yourself: 

sudo chmod -R o+rw /your/inteljdirectory/idea.sh 

cd /your/inteljdirectory/bin 
cd sudo ./idea.sh    

保持這個不直接與你的問題相關,但:

IDEA_JDK和JDK_HOME環境變量的位置。他們必須放置在/ etc/profile中。

在etc/profile中的環境瓦爾的定義後,有幾種方法來創建桌面鏈接:

如上羅馬舍甫琴科提到 推薦的方式進行整合的想法是調用配置|從歡迎屏幕創建桌面條目(或通過主菜單上的工具|創建桌面條目)

在ides.sh上調用「Make Link」並將「link to idea.sh」移動到Desktop。

DONE !!快樂編碼!

+0

感謝您的答案,但儘管與'gksudo'運行Intellij,我得到同樣的錯誤。是否有必要複製你的步驟? –

+0

@AlexanderSuraphel絕對先生! – danielad

+0

+1的幫助,但它仍然給出了同樣的錯誤。我已經通過Intellij嘗試執行的命令更新了我的問題。 –

1

嘗試到Ctrl + Alt + G,然後在出現運行目標對話框時在命令行中輸入--reloading run-app。爲我修好了!

如果工作正常,那麼您可以通過轉到Run-> Edit Configuration並在命令行框中的run-app之前添加--reloading來更改默認配置。 希望能幫助@AlexanderSuraphel!

+0

這與'2.3.11'工作,這不適合我!我正在嘗試調試模式... –