ZeroTurnaround Support Forum » JRebel Support

Issue with groovy

(9 posts)
  • Started 10 months ago by adamacus
  • Latest reply from Adam Lister

Tags:


  1. adamacus

    Member
    Posts: 3

    Hi, I'm currently evaluating JRebel 2.1a for my company. We make extensive use of groovy here, and I've yet to get jrebel working correctly with it. It seems even adding a line of code and recompiling causes anything involving groovy closures to get messed up. I've created a simple groovy example that duplicates this problem:

    public class GroovyTest {
    
        public test(){
            System.out.println("time:"+System.currentTimeMillis())
    
            // Run, uncomment the line below, and recompile to generate the error
            //["a","b","c"].each { String s -> }
            [0,1,2].each { int i ->  }
            ["a","b","c"].each { String s -> }
        }
    
        public static void main(String... args){
            while(true){
                Thread.sleep(2000)
                new GroovyTest().test()
            }
        }
    
    }

    When I run this, then uncomment the commented line of code and recompile, I get the following output:

    =============================== [JRebel Spring Framework Plugin DISABLED] ==============================
    You can enable Spring Framework Plugin by setting -Drebel.spring_plugin=true.
    ------------------------------------------------------------------------------------------
    Description: Supports adding new beans and adding new bean dependencies using
    annotations or XML. Singletons will be reconfigured after the change. It also
    supports adding or changing Spring MVC controllers or handlers.
    =============================== [/JRebel Spring Framework Plugin DISABLED] =============================

    #############################################################

    JRebel 2.1a (200910071200)
    (c) Copyright ZeroTurnaround, Ltd, 2007-2009. All rights reserved.

    A rough estimate: Over the last 1 days JRebel
    prevented the need for at least 14 redeploys/restarts.
    Using industry standard build and redeploy times,
    JRebel saved you between 0.4 and 0.8 hours.

    You are running JRebel evaluation license.
    You have 29 days until the license expires.

    You will see this notification until you obtain a
    full license for your installation.

    Visit http://www.jrebel.com for instructions on obtaining
    a full license. If you wish to continue your evaluation
    please e-mail to support@zeroturnaround.com.

    If you think you should not see this message contact
    support@zeroturnaround.com or check that you have your
    license file in the same directory as the JAR file.

    #############################################################

    time:1256921946892
    time:1256921948939
    time:1256921950940
    time:1256921952941
    time:1256921954941
    JRebel: Reloading class 'GroovyTest'.
    JRebel: Class 'GroovyTest has a new static field '__timeStamp__239_neverHappen1256921956399' of type 'java.lang.Long' and it will not be initialized!
    time:1256921956976
    JRebel: Reloading class 'GroovyTest$_test_closure1'.
    Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: GroovyTest$_test_closure1.doCall() is applicable for argument types: (java.lang.String) values: [a]
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:265)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
    at groovy.lang.Closure.call(Closure.java:279)
    at GroovyTest$_test_closure1.call(GroovyTest.groovy:50001)
    at groovy.lang.Closure.call(Closure.java:292)
    at GroovyTest$_test_closure1.call(GroovyTest.groovy:50001)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1165)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1141)
    at org.codehaus.groovy.runtime.dgm$96.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:270)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at GroovyTest$$M$90a4ef9c.test(GroovyTest.groovy:19)
    at GroovyTest$$A$90a4ef9c.test(<generated>)
    at GroovyTest.test(GroovyTest.groovy:21)
    at GroovyTest$test.call(Unknown Source)
    at GroovyTest.main(GroovyTest.groovy:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

    Posted 10 months ago #
  2. ekabanov

    LeadRebel
    Posts: 546

    I have to check, but I think the problem here is that the two different closures are compiled to a class with the same name.

    Posted 10 months ago #
  3. adamacus

    Member
    Posts: 3

    Yeah, it seems after recompiling that the wrong closure gets applied. This is what has been happening in our app as well. I'm interested to hear what you find, and what stuff in groovy is or is not supported - would love to see this thing working with groovy!

    Posted 10 months ago #
  4. adamacus

    Member
    Posts: 3

    Any update on this? Is anyone using jrebel successfully with groovy? Should I be trying?

    Posted 9 months ago #
  5. Adam Jordens

    guest

    I'm seeing similar things... but not necessarily with closures.

    I've got a JAX-RS service implemented in Groovy, and just adding a simple println() to the class (which didn't have it previously) is enough to cause problems.

    JRebel: Class 'com.onesecondshy.itsy.rest.messages.MessageResource has a new static field '__timeStamp__239_neverHappen1261294036275' of type 'java.lang.Long' and it will not be initialized!

    java.lang.ArrayIndexOutOfBoundsException: 3

    Is what I get following that in this particular scenario, but I've seen a multitude of stacktraces. Should I be expecting this to work?

    Posted 8 months ago #
  6. Joseph Layne

    guest

    I would purchase licenses for every developer in my shop if it worked with groovy. We use groovy a lot to help speed up the development effort by reducing the amount of code that is written. It would be great if we could also reduce the amount of restarts we do each day. This would be like Gold if they worked together!

    Do you guys have plans on getting jrebel to work with groovy in the near future?

    Posted 8 months ago #
  7. Nick Stuart

    guest

    I am seeing the same type of issue here with general random issues with groovy and wrong lines getting called when an error spits out. Any update on this would be great! I've seen the arrayoutofbounds exception and other seemingly random errors that are coming out of my code, but at incorrect lines.

    Example:

    java.lang.NullPointerException: Cannot get property 'clientInfo' on null object

    But, line 88 in the source file (where that exception is coming from):
    >>> line 88: def getSendBackNoteType(){
    "CREDIT_NOTE"
    }

    Posted 8 months ago #
  8. lauri

    Member
    Posts: 482

    Try http://www.zeroturnaround.com/nightly-build/jrebel-nightly-dev.zip and run with -Drebel.log=true -Drebel.groovy_plugin=true As we don't know much about groovy we'll need your feedback to improve jrebel groovy support. If you build a small test case as the one in the first post of this thread, then place main as the first method in the class.

    Posted 7 months ago #
  9. Adam Lister

    guest

    Thanks, that seemed to have fixed my problem. I'm now trying out jrebel with my app with a lot more success! Having some issues with Groovy enums, but for now I'm just avoiding them. Hopefully I'll have a test for you to replicate that issue soon.

    Posted 7 months ago #

RSS feed for this topic

Reply

(required)

(required)

(optional)

(required)

Allowed markup: a blockquote code em strong ul ol li.
Put code in between `backticks`.

Olark Livehelp