error(s) when running Groovy Shell from Eclipse

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

error(s) when running Groovy Shell from Eclipse

Justin Edelson
Hi,
I have an Eclipse project enabled with the Groovy Nature. groovy-all
2.0.5 is in the project's classpath, via Maven.

When I right click on the project and select Run As:Groovy Shell, I
get this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/fusesource/jansi/AnsiConsole
        at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 1 more

IF I add jansi (from Groovy's lib directory) to the Run
Configuration's classpath, I get this:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/cli/ParseException
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getDeclaredConstructors(Class.java:1836)
        at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
        at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
        at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
        at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
        at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
        at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
        at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
        at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
        at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
        at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
        at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
        at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
        at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
        at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.cli.ParseException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 24 more

And then if I add commons-cli (again, from Groovy's lib directory), I get this:
Exception in thread "main"
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
class 'org.apache.commons.cli.HelpFormatter'
        at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
        at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
        at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)

Any idea what I'm doing wrong?

Thanks,
Justin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Andrew Eisenberg
GroovyCastException issues like this can be tricky.  I think it is
related to this problem:

https://jira.codehaus.org/browse/GRECLIPSE-1446

I haven't been able to fix it yet, but it looks like the problem is
related to referencing a Groovy library class early on, before the
rest of the library has been loaded.

On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
<[hidden email]> wrote:

> Hi,
> I have an Eclipse project enabled with the Groovy Nature. groovy-all
> 2.0.5 is in the project's classpath, via Maven.
>
> When I right click on the project and select Run As:Groovy Shell, I
> get this exception:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/fusesource/jansi/AnsiConsole
>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>         ... 1 more
>
> IF I add jansi (from Groovy's lib directory) to the Run
> Configuration's classpath, I get this:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/cli/ParseException
>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.cli.ParseException
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>         ... 24 more
>
> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
> Exception in thread "main"
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
> class 'org.apache.commons.cli.HelpFormatter'
>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>
> Any idea what I'm doing wrong?
>
> Thanks,
> Justin
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Justin Edelson
Thanks for the feedback Andrew. I'm wondering, however, if I should
even have to add jansi to the Run Configuration's classpath. Is that
expected?

On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:

> GroovyCastException issues like this can be tricky.  I think it is
> related to this problem:
>
> https://jira.codehaus.org/browse/GRECLIPSE-1446
>
> I haven't been able to fix it yet, but it looks like the problem is
> related to referencing a Groovy library class early on, before the
> rest of the library has been loaded.
>
> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
> <[hidden email]> wrote:
>> Hi,
>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>> 2.0.5 is in the project's classpath, via Maven.
>>
>> When I right click on the project and select Run As:Groovy Shell, I
>> get this exception:
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/fusesource/jansi/AnsiConsole
>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>         ... 1 more
>>
>> IF I add jansi (from Groovy's lib directory) to the Run
>> Configuration's classpath, I get this:
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/commons/cli/ParseException
>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.commons.cli.ParseException
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>         ... 24 more
>>
>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>> Exception in thread "main"
>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>> class 'org.apache.commons.cli.HelpFormatter'
>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>
>> Any idea what I'm doing wrong?
>>
>> Thanks,
>> Justin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Andrew Eisenberg
It's not usually required on the classpath, but you may be using it
transitively somewhere.  Is it a maven (transitive) dependency?

On Fri, Oct 12, 2012 at 11:22 AM, Justin Edelson
<[hidden email]> wrote:

> Thanks for the feedback Andrew. I'm wondering, however, if I should
> even have to add jansi to the Run Configuration's classpath. Is that
> expected?
>
> On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:
>> GroovyCastException issues like this can be tricky.  I think it is
>> related to this problem:
>>
>> https://jira.codehaus.org/browse/GRECLIPSE-1446
>>
>> I haven't been able to fix it yet, but it looks like the problem is
>> related to referencing a Groovy library class early on, before the
>> rest of the library has been loaded.
>>
>> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
>> <[hidden email]> wrote:
>>> Hi,
>>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>>> 2.0.5 is in the project's classpath, via Maven.
>>>
>>> When I right click on the project and select Run As:Groovy Shell, I
>>> get this exception:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/fusesource/jansi/AnsiConsole
>>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>         ... 1 more
>>>
>>> IF I add jansi (from Groovy's lib directory) to the Run
>>> Configuration's classpath, I get this:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/commons/cli/ParseException
>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.commons.cli.ParseException
>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>         ... 24 more
>>>
>>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>>> Exception in thread "main"
>>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>>> class 'org.apache.commons.cli.HelpFormatter'
>>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>
>>> Any idea what I'm doing wrong?
>>>
>>> Thanks,
>>> Justin
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Justin Edelson
It isn't a dependency of my project, it's a Groovy dependency. The
exception is being thrown on this line:

https://github.com/groovy/groovy-core/blob/GROOVY_2_0_5/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Main.groovy#L38



On Fri, Oct 12, 2012 at 2:38 PM, Andrew Eisenberg <[hidden email]> wrote:

> It's not usually required on the classpath, but you may be using it
> transitively somewhere.  Is it a maven (transitive) dependency?
>
> On Fri, Oct 12, 2012 at 11:22 AM, Justin Edelson
> <[hidden email]> wrote:
>> Thanks for the feedback Andrew. I'm wondering, however, if I should
>> even have to add jansi to the Run Configuration's classpath. Is that
>> expected?
>>
>> On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:
>>> GroovyCastException issues like this can be tricky.  I think it is
>>> related to this problem:
>>>
>>> https://jira.codehaus.org/browse/GRECLIPSE-1446
>>>
>>> I haven't been able to fix it yet, but it looks like the problem is
>>> related to referencing a Groovy library class early on, before the
>>> rest of the library has been loaded.
>>>
>>> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
>>> <[hidden email]> wrote:
>>>> Hi,
>>>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>>>> 2.0.5 is in the project's classpath, via Maven.
>>>>
>>>> When I right click on the project and select Run As:Groovy Shell, I
>>>> get this exception:
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/fusesource/jansi/AnsiConsole
>>>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>>>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>         ... 1 more
>>>>
>>>> IF I add jansi (from Groovy's lib directory) to the Run
>>>> Configuration's classpath, I get this:
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/apache/commons/cli/ParseException
>>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>> Caused by: java.lang.ClassNotFoundException:
>>>> org.apache.commons.cli.ParseException
>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>         ... 24 more
>>>>
>>>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>>>> Exception in thread "main"
>>>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>>>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>>>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>>>> class 'org.apache.commons.cli.HelpFormatter'
>>>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>>
>>>> Any idea what I'm doing wrong?
>>>>
>>>> Thanks,
>>>> Justin
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Tim Berkeley
In reply to this post by Justin Edelson


Sent from my HTC

----- Reply message -----
From: "Andrew Eisenberg" <[hidden email]>
To: "[hidden email]" <[hidden email]>
Subject: [groovy-eclipse-plugin-user] error(s) when running Groovy Shell from Eclipse
Date: Fri, Oct 12, 2012 19:39



It's not usually required on the classpath, but you may be using it
transitively somewhere.  Is it a maven (transitive) dependency?

On Fri, Oct 12, 2012 at 11:22 AM, Justin Edelson
<[hidden email]> wrote:
> Thanks for the feedback Andrew. I'm wondering, however, if I should
> even have to add jansi to the Run Configuration's classpath. Is that
> expected?
>
> On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:
>> GroovyCastException issues like this can be tricky.  I think it is
>> related to this problem:
>>
>> https://jira.codehaus.org/browse/GRECLIPSE-1446
>>
>> I haven't been able to fix it yet, but it looks like the problem is
>> related to referencing a Groovy library class early on, before the
>> rest of the library has been loaded.
>>
>> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
>> <[hidden email]> wrote:
>>> Hi,
>>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>>> 2.0.5 is in the project's classpath, via Maven.
>>>
>>> When I right click on the project and select Run As:Groovy Shell, I
>>> get this exception:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/fusesource/jansi/AnsiConsole
>>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>         ... 1 more
>>>
>>> IF I add jansi (from Groovy's lib directory) to the Run
>>> Configuration's classpath, I get this:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/commons/cli/ParseException
>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.commons.cli.ParseException
>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>         ... 24 more
>>>
>>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>>> Exception in thread "main"
>>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>>> class 'org.apache.commons.cli.HelpFormatter'
>>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>
>>> Any idea what I'm doing wrong?
>>>
>>> Thanks,
>>> Justin
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Andrew Eisenberg
In reply to this post by Justin Edelson
Thanks.  I see the problem now.  Looks like this is a bug in our
launcher.  The groovy shell launcher is not really a complete feature
and you would be better off running from the command line.  Inside of
Eclipse, you don't get any of the colors or shell completions.
Moreover, the launcher has never worked on windows machines due to its
dependency on jline.  Unless I can spend significant effort
reimplementing a shell inside of Eclipse, there's not much more I can
do.

I have toyed with just removing this feature, but there are some who
use the feature so I have not for now.

The classpath problem that you see is fixable (the classloader problem
is a different story), but you will still not get the same kind of
features that you do on the command line.

On Fri, Oct 12, 2012 at 11:49 AM, Justin Edelson
<[hidden email]> wrote:

> It isn't a dependency of my project, it's a Groovy dependency. The
> exception is being thrown on this line:
>
> https://github.com/groovy/groovy-core/blob/GROOVY_2_0_5/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Main.groovy#L38
>
>
>
> On Fri, Oct 12, 2012 at 2:38 PM, Andrew Eisenberg <[hidden email]> wrote:
>> It's not usually required on the classpath, but you may be using it
>> transitively somewhere.  Is it a maven (transitive) dependency?
>>
>> On Fri, Oct 12, 2012 at 11:22 AM, Justin Edelson
>> <[hidden email]> wrote:
>>> Thanks for the feedback Andrew. I'm wondering, however, if I should
>>> even have to add jansi to the Run Configuration's classpath. Is that
>>> expected?
>>>
>>> On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:
>>>> GroovyCastException issues like this can be tricky.  I think it is
>>>> related to this problem:
>>>>
>>>> https://jira.codehaus.org/browse/GRECLIPSE-1446
>>>>
>>>> I haven't been able to fix it yet, but it looks like the problem is
>>>> related to referencing a Groovy library class early on, before the
>>>> rest of the library has been loaded.
>>>>
>>>> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
>>>> <[hidden email]> wrote:
>>>>> Hi,
>>>>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>>>>> 2.0.5 is in the project's classpath, via Maven.
>>>>>
>>>>> When I right click on the project and select Run As:Groovy Shell, I
>>>>> get this exception:
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> org/fusesource/jansi/AnsiConsole
>>>>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>>>>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>>         ... 1 more
>>>>>
>>>>> IF I add jansi (from Groovy's lib directory) to the Run
>>>>> Configuration's classpath, I get this:
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> org/apache/commons/cli/ParseException
>>>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>>>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>>>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>>>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>>>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>>>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>>>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>> org.apache.commons.cli.ParseException
>>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>>         ... 24 more
>>>>>
>>>>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>>>>> Exception in thread "main"
>>>>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>>>>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>>>>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>>>>> class 'org.apache.commons.cli.HelpFormatter'
>>>>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>>>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>>>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>>>
>>>>> Any idea what I'm doing wrong?
>>>>>
>>>>> Thanks,
>>>>> Justin
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>     http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: error(s) when running Groovy Shell from Eclipse

Justin Edelson
Thanks Andrew. Does the Console feature work better than the Shell?
I'm a bit confused by the prompt to select a script when I try to
launch a Console.

What I'm trying to do is run a REPL session using classes in my
Maven/Eclipse project (and the project's dependencies). Any other
suggestions on the best way to do this?

Thanks,
Justin

On Fri, Oct 12, 2012 at 4:03 PM, Andrew Eisenberg <[hidden email]> wrote:

> Thanks.  I see the problem now.  Looks like this is a bug in our
> launcher.  The groovy shell launcher is not really a complete feature
> and you would be better off running from the command line.  Inside of
> Eclipse, you don't get any of the colors or shell completions.
> Moreover, the launcher has never worked on windows machines due to its
> dependency on jline.  Unless I can spend significant effort
> reimplementing a shell inside of Eclipse, there's not much more I can
> do.
>
> I have toyed with just removing this feature, but there are some who
> use the feature so I have not for now.
>
> The classpath problem that you see is fixable (the classloader problem
> is a different story), but you will still not get the same kind of
> features that you do on the command line.
>
> On Fri, Oct 12, 2012 at 11:49 AM, Justin Edelson
> <[hidden email]> wrote:
>> It isn't a dependency of my project, it's a Groovy dependency. The
>> exception is being thrown on this line:
>>
>> https://github.com/groovy/groovy-core/blob/GROOVY_2_0_5/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Main.groovy#L38
>>
>>
>>
>> On Fri, Oct 12, 2012 at 2:38 PM, Andrew Eisenberg <[hidden email]> wrote:
>>> It's not usually required on the classpath, but you may be using it
>>> transitively somewhere.  Is it a maven (transitive) dependency?
>>>
>>> On Fri, Oct 12, 2012 at 11:22 AM, Justin Edelson
>>> <[hidden email]> wrote:
>>>> Thanks for the feedback Andrew. I'm wondering, however, if I should
>>>> even have to add jansi to the Run Configuration's classpath. Is that
>>>> expected?
>>>>
>>>> On Fri, Oct 12, 2012 at 11:50 AM, Andrew Eisenberg <[hidden email]> wrote:
>>>>> GroovyCastException issues like this can be tricky.  I think it is
>>>>> related to this problem:
>>>>>
>>>>> https://jira.codehaus.org/browse/GRECLIPSE-1446
>>>>>
>>>>> I haven't been able to fix it yet, but it looks like the problem is
>>>>> related to referencing a Groovy library class early on, before the
>>>>> rest of the library has been loaded.
>>>>>
>>>>> On Fri, Oct 12, 2012 at 7:33 AM, Justin Edelson
>>>>> <[hidden email]> wrote:
>>>>>> Hi,
>>>>>> I have an Eclipse project enabled with the Groovy Nature. groovy-all
>>>>>> 2.0.5 is in the project's classpath, via Maven.
>>>>>>
>>>>>> When I right click on the project and select Run As:Groovy Shell, I
>>>>>> get this exception:
>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> org/fusesource/jansi/AnsiConsole
>>>>>>         at org.codehaus.groovy.tools.shell.Main.<clinit>(Main.groovy:38)
>>>>>> Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiConsole
>>>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>>>         ... 1 more
>>>>>>
>>>>>> IF I add jansi (from Groovy's lib directory) to the Run
>>>>>> Configuration's classpath, I get this:
>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> org/apache/commons/cli/ParseException
>>>>>>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>>>>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>>>>         at java.lang.Class.getDeclaredConstructors(Class.java:1836)
>>>>>>         at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
>>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
>>>>>>         at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
>>>>>>         at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
>>>>>>         at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
>>>>>>         at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
>>>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187)
>>>>>>         at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:191)
>>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
>>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
>>>>>>         at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
>>>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
>>>>>>         at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
>>>>>>         at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
>>>>>>         at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
>>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
>>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>> org.apache.commons.cli.ParseException
>>>>>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>>>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>>>         ... 24 more
>>>>>>
>>>>>> And then if I add commons-cli (again, from Groovy's lib directory), I get this:
>>>>>> Exception in thread "main"
>>>>>> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
>>>>>> cast object 'org.codehaus.groovy.tools.shell.util.HelpFormatter@4ab122a1'
>>>>>> with class 'org.codehaus.groovy.tools.shell.util.HelpFormatter' to
>>>>>> class 'org.apache.commons.cli.HelpFormatter'
>>>>>>         at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
>>>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2394)
>>>>>>         at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3335)
>>>>>>         at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl.java:1497)
>>>>>>         at org.codehaus.groovy.runtime.callsite.ConstructorSite$NoParamSite.callConstructor(ConstructorSite.java:122)
>>>>>>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
>>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
>>>>>>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
>>>>>>         at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:50)
>>>>>>
>>>>>> Any idea what I'm doing wrong?
>>>>>>
>>>>>> Thanks,
>>>>>> Justin
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe from this list, please visit:
>>>>>>
>>>>>>     http://xircles.codehaus.org/manage_email
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>     http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email