groovy
  1. groovy
  2. GROOVY-2399

Groovy does not run on IBM JRE6

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5.1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      I tried to deploy a grails app on a tomcat running on the IBM JRE 6 which can be downloaded from here http://www-128.ibm.com/developerworks/java/jdk/linux/download.html

      I instantly receive the following error. Any way to work around this issue?

      java.lang.ClassCastException: java.lang.reflect.Method incompatible with java.lang.Comparable
      at java.util.Arrays.binarySearch(Unknown Source)
      at java.util.Arrays.binarySearch(Unknown Source)
      at org.codehaus.groovy.reflection.CachedMethod.find(CachedMethod.java:59)
      at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:1759)
      at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:1529)
      at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2418)
      at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2398)
      at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:99)
      at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:63)
      at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:27)
      at java.lang.J9VMInternals.initializeImpl(Native Method)
      at java.lang.J9VMInternals.initialize(J9VMInternals.java:198)
      ... 21 more

        Activity

        Hide
        Paul King added a comment -

        Do you get the same error with even a trivial Groovy hello world example or only with Grails?

        Show
        Paul King added a comment - Do you get the same error with even a trivial Groovy hello world example or only with Grails?
        Hide
        johan1 added a comment -

        The same happens when I try to run the groovy console for example:

        t343r:/opt/groovy-1.5.0/bin# ./groovyConsole
        java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:612)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:101)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
        Caused by: java.lang.ExceptionInInitializerError
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:220)
        at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:38)
        at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:44)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:198)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:472)
        at groovy.ui.Console.main(Console.groovy:117)
        ... 6 more
        Caused by: java.lang.ClassCastException: java.lang.reflect.Method incompatible with java.lang.Comparable
        at java.util.Arrays.binarySearch(Unknown Source)
        at java.util.Arrays.binarySearch(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.find(CachedMethod.java:59)
        at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:1759)
        at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:1529)
        at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2418)
        at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2398)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:99)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:63)
        at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:27)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:198)
        ... 12 more

        Show
        johan1 added a comment - The same happens when I try to run the groovy console for example: t343r:/opt/groovy-1.5.0/bin# ./groovyConsole java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:612) at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:101) at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130) Caused by: java.lang.ExceptionInInitializerError at java.lang.J9VMInternals.initialize(J9VMInternals.java:220) at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:38) at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:44) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:198) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:472) at groovy.ui.Console.main(Console.groovy:117) ... 6 more Caused by: java.lang.ClassCastException: java.lang.reflect.Method incompatible with java.lang.Comparable at java.util.Arrays.binarySearch(Unknown Source) at java.util.Arrays.binarySearch(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.find(CachedMethod.java:59) at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:1759) at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:1529) at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2418) at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2398) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:99) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:63) at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:27) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:198) ... 12 more
        Hide
        Danno Ferrin added a comment -

        This appears to hinge on the following throws clause in Arrays.binarySearch(Object[] array, Object key)...

        ClassCastException - if the search key in not comparable to the elements of the array.

        Does this require for all i :

        array[i].compareTo(key)

        or for all i :

        key.compareTo(array[i])

        ? It looks like Sun is calling the former, and IBM the latter. Since the key is a Method, it doesn't implement Comparable (whereas CachedMethod does). I think it may mean both, as the comparison must be commutative. Hence the IBM JDK is not in error in throwing the exception in my opinion.

        My patch may cause a performance hit, but that may be eliminated by some cut and paste.

        Show
        Danno Ferrin added a comment - This appears to hinge on the following throws clause in Arrays.binarySearch(Object[] array, Object key)... ClassCastException - if the search key in not comparable to the elements of the array. Does this require for all i : array[i].compareTo(key) or for all i : key.compareTo(array[i]) ? It looks like Sun is calling the former, and IBM the latter. Since the key is a Method, it doesn't implement Comparable (whereas CachedMethod does). I think it may mean both, as the comparison must be commutative. Hence the IBM JDK is not in error in throwing the exception in my opinion. My patch may cause a performance hit, but that may be eliminated by some cut and paste.
        Hide
        Danno Ferrin added a comment -

        I may apply this tonight if I get time. First I need to boot into linux and verify it fixes the IBM JDK problem. IBM's JRE is not broadly availble for Windows.

        Show
        Danno Ferrin added a comment - I may apply this tonight if I get time. First I need to boot into linux and verify it fixes the IBM JDK problem. IBM's JRE is not broadly availble for Windows.
        Hide
        Danno Ferrin added a comment -

        My patch did the trick. Alex, since it's your optimization feel free to re-do if you don't like my solution.

        Show
        Danno Ferrin added a comment - My patch did the trick. Alex, since it's your optimization feel free to re-do if you don't like my solution.

          People

          • Assignee:
            Alex Tkachman
            Reporter:
            johan1
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: