Spring Tool Suite
  1. Spring Tool Suite
  2. STS-1539

Interactions between STS Groovy compiler and grails war command

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.6.0.M1
    • Fix Version/s: 2.6.0.M2
    • Component/s: GRAILS
    • Labels:
      None

      Description

      An issue has been reported on the forum, probably caused by Groovy Eclipse compiler using the same output folder as the grails war command.

      http://forum.springsource.org/showthread.php?t=102711

      This should not create problems... usually, except if we are compiling code that grails war would not compile, or compile to a different location.

      I am not sure yet exactly what the problem is.

      1. STS Installation Details.txt
        738 kB
        Jay Chandran
      1. JDK location.jpg
        142 kB

        Activity

        Hide
        Jay Chandran added a comment -

        Hi Kris,

        I will try updating STS and Greclipse. I am using jdk1.6.0_23, its just that I have not changed the name from 'jre6' in STS in Installed JREs. Even my JAVA_HOME points to JDK. Screenshots attached. Do I have to do something else also?

        I will let you know how after update things goes.

        Jay

        Show
        Jay Chandran added a comment - Hi Kris, I will try updating STS and Greclipse. I am using jdk1.6.0_23, its just that I have not changed the name from 'jre6' in STS in Installed JREs. Even my JAVA_HOME points to JDK. Screenshots attached. Do I have to do something else also? I will let you know how after update things goes. Jay
        Hide
        Jay Chandran added a comment -

        JDK locations config

        Show
        Jay Chandran added a comment - JDK locations config
        Hide
        Kris De Volder (c) added a comment - - edited

        Hi Jay,

        One of my coleagues has tried to reproduce on Windows. Thinking maybe the problem could be somehow windows specific. But he had no luck and couldn't reproduce.

        Starting to get a little desperate here. The problem seems serious enough that it needs fixing, but if we can't reproduce or figure out why it happens that is hard.

        Let's try to confirm first whether we are still dealing with the same ASTTranform related problem. The key to this is the contents of the "AuditLogEventController.class" file. There will be several versions of this .class file floating around on your system. I would like to get those files from you to inspect their contents.

        So after you have had a chance to upgrade. Can you try to deploy your app to tc server.

        For good measure first do a clean:

        • clean your project before doing this (Menu Project >> Clean).

        then with the server not yet started do
        menu "run as >> run on server" to deploy your app to the server.

        Confirm that the bug is happening still.

        Then zip up the web-inf/classes folder from your app from the following places. (and make sure to label them so I can tell which is which).

        1) the one you find actually deployed in the spring-insight instance of tc server.
        E.g. on my machine that is:
        /home/kdvolder/Applications/springsource/tc-server-developer-2.1.1.RELEASE/spring-insight-instance/wtpwebapps/SampleSTS/WEB-INF/classes

        2) The one in the war file that was built by STS (this should be actually the same file, but it could be different, want to make sure!
        This file is inside the .metadata of the runonserver plugin in a kind of staging area used to take the contents of the war file built by grails and mix-and-match it with incremental changes from the workspace.

        Found here:

        <workspace>/.metadata/.plugins/com.springsource.sts.grails.runonserver/stage/SampleSTS/exploded/WEB-INF/classes
        

        3) the one in your project, in the workspace under

        <workspace>/SampleSTS/web-app/WEB-INF/classes
        

        If you are interested in what I'm looking for, it's a runtime Java annotation on this class that is inserted by an AST transform. All the trouble we had before was caused by this one missing annotation.

        You can use command

        javap -verbose -private -classpath <path-to-the-classes-dir> org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController
        

        To print out the full details of that class file.

        We are looking for something like this:

          RuntimeVisibleAnnotations: length = 0x10
           00 01 00 08 00 02 00 09 73 00 0A 00 0B 73 00 0C
        

        Finally, another debugging tool is the Groovy event trace console. You can open this in the Eclipse console view, right click on the leftmost litte console icon and choose "Groovy event trace console". This will open a view displaying info on what groovy compiler is doing.

        Interesting thing to check would be to go to the AuditLogEventController.groovy file. Add some meaningless white space and save it. After you save you should see something like

        Ast Transforms : 10:39:34 Global transform org.codehaus.groovy.grails.compiler.injection.GlobalPluginAwareEntityASTTransformation on /SampleSTS/.link_to_grails_plugins/audit-logging-0.5.4/grails-app/controllers/org/codehaus/groovy/grails/plugins/orm/auditable/AuditLogEventController.groovy = 113ms
        

        Something else that may (or may not) be important is that it looks like you have STS and your workspace under "Documents and Settings". That's a path with spaces in it, and this is often a cause for trouble (i.e. the spaces often trigger bugs which wouldn't happen if there where no spaces on the path). It is possible that you are experiencing a bug that is triggered specifically by spaces on the path. So something that may be worth a try is to put them somewhere else instead, making sure there are no spaces in the name. Maybe the spaces aren't really the cause of the problem, but it would be good to rule it out.

        Show
        Kris De Volder (c) added a comment - - edited Hi Jay, One of my coleagues has tried to reproduce on Windows. Thinking maybe the problem could be somehow windows specific. But he had no luck and couldn't reproduce. Starting to get a little desperate here. The problem seems serious enough that it needs fixing, but if we can't reproduce or figure out why it happens that is hard. Let's try to confirm first whether we are still dealing with the same ASTTranform related problem. The key to this is the contents of the "AuditLogEventController.class" file. There will be several versions of this .class file floating around on your system. I would like to get those files from you to inspect their contents. So after you have had a chance to upgrade. Can you try to deploy your app to tc server. For good measure first do a clean: clean your project before doing this (Menu Project >> Clean). then with the server not yet started do menu "run as >> run on server" to deploy your app to the server. Confirm that the bug is happening still. Then zip up the web-inf/classes folder from your app from the following places. (and make sure to label them so I can tell which is which). 1) the one you find actually deployed in the spring-insight instance of tc server. E.g. on my machine that is: /home/kdvolder/Applications/springsource/tc-server-developer-2.1.1.RELEASE/spring-insight-instance/wtpwebapps/SampleSTS/WEB-INF/classes 2) The one in the war file that was built by STS (this should be actually the same file, but it could be different, want to make sure! This file is inside the .metadata of the runonserver plugin in a kind of staging area used to take the contents of the war file built by grails and mix-and-match it with incremental changes from the workspace. Found here: <workspace>/.metadata/.plugins/com.springsource.sts.grails.runonserver/stage/SampleSTS/exploded/WEB-INF/classes 3) the one in your project, in the workspace under <workspace>/SampleSTS/web-app/WEB-INF/classes If you are interested in what I'm looking for, it's a runtime Java annotation on this class that is inserted by an AST transform. All the trouble we had before was caused by this one missing annotation. You can use command javap -verbose -private -classpath <path-to-the-classes-dir> org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController To print out the full details of that class file. We are looking for something like this: RuntimeVisibleAnnotations: length = 0x10 00 01 00 08 00 02 00 09 73 00 0A 00 0B 73 00 0C Finally, another debugging tool is the Groovy event trace console. You can open this in the Eclipse console view, right click on the leftmost litte console icon and choose "Groovy event trace console". This will open a view displaying info on what groovy compiler is doing. Interesting thing to check would be to go to the AuditLogEventController.groovy file. Add some meaningless white space and save it. After you save you should see something like Ast Transforms : 10:39:34 Global transform org.codehaus.groovy.grails.compiler.injection.GlobalPluginAwareEntityASTTransformation on /SampleSTS/.link_to_grails_plugins/audit-logging-0.5.4/grails-app/controllers/org/codehaus/groovy/grails/plugins/orm/auditable/AuditLogEventController.groovy = 113ms Something else that may (or may not) be important is that it looks like you have STS and your workspace under "Documents and Settings". That's a path with spaces in it, and this is often a cause for trouble (i.e. the spaces often trigger bugs which wouldn't happen if there where no spaces on the path). It is possible that you are experiencing a bug that is triggered specifically by spaces on the path. So something that may be worth a try is to put them somewhere else instead, making sure there are no spaces in the name. Maybe the spaces aren't really the cause of the problem, but it would be good to rule it out.
        Hide
        Jay Chandran added a comment -

        Hi Kris,

        Sorry about the delay. In the mean time I tried with a fresh copy of STS with latest milestone version available i.e. 2.6.0M2 and tried again. Build war and deployed again, and this time it works fine!

        I guess I had for some reason files which were not updated to latest release version.

        Thanks a lot for your help and I truly appreciate yours and Spring Source's effort to make STS better for developers like us.

        thanks a million... (You can close this call... )

        Show
        Jay Chandran added a comment - Hi Kris, Sorry about the delay. In the mean time I tried with a fresh copy of STS with latest milestone version available i.e. 2.6.0M2 and tried again. Build war and deployed again, and this time it works fine! I guess I had for some reason files which were not updated to latest release version. Thanks a lot for your help and I truly appreciate yours and Spring Source's effort to make STS better for developers like us. thanks a million... (You can close this call... )
        Hide
        Kris De Volder (c) added a comment -

        Thanks for letting me know... I do appreciate also all the effort you have put into providing info on this ticket. Without helpful user's like you, it is very hard to fix anything

        But I'm definitely glad that the problem now appears to be solved

        Closing this issue.

        Cheers,

        Kris

        Show
        Kris De Volder (c) added a comment - Thanks for letting me know... I do appreciate also all the effort you have put into providing info on this ticket. Without helpful user's like you, it is very hard to fix anything But I'm definitely glad that the problem now appears to be solved Closing this issue. Cheers, Kris

          People

          • Assignee:
            Kris De Volder (c)
            Reporter:
            Kris De Volder (c)
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: