Problem with IDEA 11.1.2 and Grails 2.1 ?

I've just taken Grails 2.1, I've had IDEA 11.1.2 for a couple of weeks.

I started a new Grails project from scratch and I noticed the following error as it did the initial Grails creation:

IDEA hook: Grails not found!
| Error java.lang.reflect.InvocationTargetException
| Error      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error      at java.lang.reflect.Method.invoke(Method.java:597)
| Error      at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:73)
| Error      at java.lang.Thread.run(Thread.java:619)
| Error Caused by: java.lang.NullPointerException
| Error      at org.jetbrains.groovy.grails.rt.GrailsSettingsGetter.printSettings(GrailsSettingsGetter.java:62)
| Error      ... 6 more



There is also the messge "Settings synchonization failed" showing as a tooltip - lke feature above the Console tab

As I ran through the new project wizard I created the new version of the SDK then - when it offered me the current Grails SDK, I clicked 'create', pointed to the latest 2.1 that I'd just set up and then clicked on 'configure' (it looked correct), then 'apply', then 'OK' and eveything seemed fine but as it began the build the error above came up, the console starts with the following lines: note that at the end of the copy below it is showing output from grails ("Usage ..." etc.) and this runs up to the error given above

| Loading Grails 2.1.0
| Configuring classpath
| Configuring classpath.
| Environment set to development
| Environment set to development.
| Environment set to development..
| Environment set to development...
| Environment set to development....
| Environment set to development.....

Usage (optionals marked with *):
grails [environment]* [options]* [target] [arguments]*

Examples:

....etc.

As a check that I had set up grails correctly I tried updating a small application that I had created with Grails v2.0.4 and this updated to 2.1 without any issues and I was able to created the Grails war successfully.

I have also tried unloading and re-loading the application; and closing and re-opening IDEA but the failure occurs as it attempts to re-load the application

Any thoughts ?

Obviously I would appear to be able to create an applicaiton in 2.0.4 and then upgrade it - but it is worrying that there is some problem with 2.1

graham
9 comments
Comment actions Permalink

While I did search the forum before posting I had a more general search today and found that was reported for grails 2.1 RC versions:

http://youtrack.jetbrains.com/issue/IDEA-86261

Using the grails_rt.jar from that reply seems to have solved the immediate problem and I'll wait to see if there are any further replies.

graham

0
Comment actions Permalink

And I can confirm that the latest EAP build 721 also does not exhibit the problem (I didn't check any previous ones)

graham

0
Comment actions Permalink

me too,while using Grails2.1 release against IDEA 11.1.2

IDEA hook: Grails not found!
| Error java.lang.reflect.InvocationTargetException
| Error  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error  at java.lang.reflect.Method.invoke(Method.java:597)
| Error  at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:73)
| Error  at java.lang.Thread.run(Thread.java:662)
| Error Caused by: java.lang.NullPointerException
| Error  at org.jetbrains.groovy.grails.rt.GrailsSettingsGetter.printSettings(GrailsSettingsGetter.java:62)
| Error  ... 6 more

0
Comment actions Permalink

We still have the same problem after importing a Grails 2.1 / Maven 3 project with EAP 117.747

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -Dclassworlds.conf=/usr/share/java/maven-3.0.3/bin/m2.conf -Dmaven.home=/usr/share/java/maven-3.0.3 -javaagent:/Applications/Nika.1-IU-117.747.app/plugins/Grails/lib/grails_rt.jar -Dprint.grails.settings=true -Dfile.encoding=UTF-8 -classpath /usr/share/java/maven-3.0.3/boot/plexus-classworlds-2.4.jar org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --strict-checksums --update-snapshots -DskipTests=true -Dcommand=help -f /Users/ct/Projects/ixor/doccle/pom.xml grails:exec
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (503 B at 5.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (614 B at 10.7 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Doccle End User UI 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- grails-maven-plugin:2.1.0:exec (default-cli) @ doccle-euui ---

|Loading Grails 2.1.0
|Configuring classpath
|Running pre-compiled script
.
|Environment set to development
.....
Usage (optionals marked with *):
grails [environment]* [options]* [target] [arguments]*

Examples:
grails dev run-app
grails create-app books

Available options:
-verbose                     Enable verbose output
-plain-output                Disables ANSI output
-refresh-dependencies        Whether to force a resolve of dependencies (skipping any caching)
-reloading                   Enable the reloading agent
-stacktrace                  Enable stack traces in output
-offline                     Indicates that Grails should not connect to any remote servers during processing of the build
-version                     Current Grails version
-non-interactive             Whether to allow the command line to request input

Available Targets (type grails help 'target-name' for more info):
grails codenarc
grails copy-twitterbootstrap
grails create-web-xml-config
grails install-jq-uery
grails tomcat
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.968s
[INFO] Finished at: Fri Jul 20 15:10:32 CEST 2012
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------

IDEA hook: Grails not found!
java.lang.NullPointerException
    at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:88)
    at java.lang.Thread.run(Thread.java:680)

0
Comment actions Permalink

I see that's a later build than the one I used (721 - which is no longer listed) - perhaps it's best to return to the released 11.1.2 with the fixed grails_rt.jar ? I must admit that's what I'm using.

graham

0
Comment actions Permalink

That didn't work either :(

Could it be so that the problem still persists when using the maven plugin?

0
Comment actions Permalink

As workaround you can specify fork=false in pom.xml

            <plugin>
                <groupId>org.grails</groupId>
                <artifactId>grails-maven-plugin</artifactId>
                <version>${grails.version}</version>
                <configuration>
                    <!-- Whether for Fork a JVM to run Grails commands -->
                    <fork>false</fork>
                </configuration>
                <extensions>true</extensions>
            </plugin>

0
Comment actions Permalink

Thanks, I tried that but now the build fails early: (and the NPE is still there at the end)

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -Dclassworlds.conf=/usr/share/java/maven-3.0.3/bin/m2.conf -Dmaven.home=/usr/share/java/maven-3.0.3 -javaagent:/Applications/Nika.1-IU-117.747.app/plugins/Grails/lib/grails_rt.jar -Dprint.grails.settings=true -Dfile.encoding=UTF-8 -classpath /usr/share/java/maven-3.0.3/boot/plexus-classworlds-2.4.jar org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --strict-checksums --update-snapshots -DskipTests=true -Dcommand=help -f /Users/ct/Projects/ixor/doccle/pom.xml grails:exec
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (503 B at 1.0 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (614 B at 10.5 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Doccle End User UI 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- grails-maven-plugin:2.1.0:exec (default-cli) @ doccle-euui ---

|Loading Grails 2.1.0
|Configuring classpath
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.791s
[INFO] Finished at: Tue Jul 24 15:26:49 CEST 2012
[INFO] Final Memory: 23M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.1.0:exec (default-cli) on project doccle-euui: Unable to start Grails: java.lang.reflect.InvocationTargetException: The following error occurred while executing this line:
[ERROR] jar:file:/Users/ct/.m2/repository/org/apache/ant/ant/1.8.2/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml:37: Problem: failed to create task or type componentdef
[ERROR] Cause: The name is undefined.
[ERROR] Action: Check the spelling.
[ERROR] Action: Check that any custom tasks/types have been declared.
[ERROR] Action: Check that any <presetdef>/<macrodef> declarations have taken place.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

IDEA hook: Grails not found!
Error |
java.lang.NullPointerException
Error |
    at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:88)
Error |
    at java.lang.Thread.run(Thread.java:680)

0
Comment actions Permalink

On my machine this workaround works well. Please, run "mvn grails:exec -Dcommand=help" in console. Do you see same error?

0

Please sign in to leave a comment.