最近,我将STS 3.3的Grails项目导入了Intelj IDE。但是,当我运行应用程序时,我在调试模式下出现以下错误。
我正在 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 app后的堆栈跟踪,并显示以下消息:
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
有什么想法吗?
答案 0 :(得分:1)
嘿,我有你的问题,我相信你使用Linux机器。好的,您需要执行以下操作:
这个问题的根源是IDE需要在root权限中运行以便连接到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中定义环境变量后,有几种方法可以创建桌面链接:
如上所述罗马舍甫琴科 集成IDEA的推荐方法是调用Configure |从欢迎屏幕创建桌面条目(或通过工具|从主菜单创建桌面条目)
在ides.sh上调用“Make Link”并将“link to idea.sh”移动到Desktop。
DONE !!快乐的编码!!
答案 1 :(得分:1)
尝试Ctrl + Alt + G
,然后在出现运行目标对话框时在命令行中输入--reloading run-app
。那为我修好了!
如果完美无缺,那么您可以通过转到Run->编辑配置并在命令行框中的run-app之前添加--reloading来更改默认配置。 希望有助于@AlexanderSuraphel!
答案 2 :(得分:0)
原来它不是Intellij问题。问题是在Grails 2.3.0中关闭了-reloading
选项。我通过升级到2.3.8
解决了我的问题。