groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bahman Movaqar <Bah...@BahmanM.com>
Subject Re: GroovyShell
Date Sun, 15 Nov 2015 16:57:26 GMT
I never managed to get `@Grab` working in shell.  To go around it, I'd
change the first line to:

    groovy.grape.Grape.grab(
      groupId: 'org.apache.spark',
      artifactId: 'spark core_2.10',
      version: '1.5.2'
    )

--
Bahman Movaqar

http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)

On 11/15/2015 08:22 PM, tog wrote:
> Hi
> 
> I have a behavior I dont understand using GroovyShell.
> Here is a script <https://gist.github.com/galleon/231dbfcff36f8d4ce6c2> 
> that is working fine when I use it from the command line
> 
> When I use it from a second script
> <https://gist.github.com/galleon/e0807499a1b8b78924ca> using GroovyShell
> I got the following exception:
> 
> I got the following exception. Any idea why?
> 
> togGroovySpark $ groovy GroovySparkThroughGroovyShell.groovy 
> 
> java.lang.ClassNotFoundException:
> org.apache.spark.rpc.akka.AkkaRpcEnvFactory
> 
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> 
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:775)
> 
> at java.lang.Class.forName0(Native Method)
> 
> at java.lang.Class.forName(Class.java:348)
> 
> at org.apache.spark.util.Utils$.classForName(Utils.scala:173)
> 
> at org.apache.spark.rpc.RpcEnv$.getRpcEnvFactory(RpcEnv.scala:42)
> 
> at org.apache.spark.rpc.RpcEnv$.create(RpcEnv.scala:53)
> 
> at org.apache.spark.SparkEnv$.create(SparkEnv.scala:254)
> 
> at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:194)
> 
> at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:277)
> 
> at org.apache.spark.SparkContext.<init>(SparkContext.scala:450)
> 
> at
> org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:61)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 
> at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
> 
> at
> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
> 
> at
> org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
> 
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
> 
> at Script1.run(Script1.groovy:9)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:591)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:629)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:600)
> 
> at groovy.lang.GroovyShell$evaluate.call(Unknown Source)
> 
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 
> at
> GroovySparkThroughGroovyShell.run(GroovySparkThroughGroovyShell.groovy:47)
> 
> at
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
> 
> at groovy.lang.GroovyShell.run(GroovyShell.java:524)
> 
> at groovy.lang.GroovyShell.run(GroovyShell.java:513)
> 
> at groovy.ui.GroovyMain.processOnce(GroovyMain.java:652)
> 
> at groovy.ui.GroovyMain.run(GroovyMain.java:384)
> 
> at groovy.ui.GroovyMain.process(GroovyMain.java:370)
> 
> at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
> 
> at groovy.ui.GroovyMain.main(GroovyMain.java:109)
> 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 
> at java.lang.reflect.Method.invoke(Method.java:497)
> 
> at
> org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
> 
> at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
> 
> 
> org.apache.spark.SparkConf@7428de63
> 
> 
> java.lang.ClassNotFoundException:
> org.apache.spark.rpc.akka.AkkaRpcEnvFactory
> 
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> 
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787)
> 
> at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:775)
> 
> at java.lang.Class.forName0(Native Method)
> 
> at java.lang.Class.forName(Class.java:348)
> 
> at org.apache.spark.util.Utils$.classForName(Utils.scala:173)
> 
> at org.apache.spark.rpc.RpcEnv$.getRpcEnvFactory(RpcEnv.scala:42)
> 
> at org.apache.spark.rpc.RpcEnv$.create(RpcEnv.scala:53)
> 
> at org.apache.spark.SparkEnv$.create(SparkEnv.scala:254)
> 
> at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:194)
> 
> at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:277)
> 
> at org.apache.spark.SparkContext.<init>(SparkContext.scala:450)
> 
> at
> org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:61)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 
> at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
> 
> at
> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
> 
> at
> org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
> 
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
> 
> at Script1.run(Script1.groovy:9)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:591)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:629)
> 
> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:600)
> 
> at groovy.lang.GroovyShell$evaluate.call(Unknown Source)
> 
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
> 
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 
> at
> GroovySparkThroughGroovyShell.run(GroovySparkThroughGroovyShell.groovy:47)
> 
> at
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
> 
> at groovy.lang.GroovyShell.run(GroovyShell.java:524)
> 
> at groovy.lang.GroovyShell.run(GroovyShell.java:513)
> 
> at groovy.ui.GroovyMain.processOnce(GroovyMain.java:652)
> 
> at groovy.ui.GroovyMain.run(GroovyMain.java:384)
> 
> at groovy.ui.GroovyMain.process(GroovyMain.java:370)
> 
> at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
> 
> at groovy.ui.GroovyMain.main(GroovyMain.java:109)
> 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 
> at java.lang.reflect.Method.invoke(Method.java:497)
> 
> at
> org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
> 
> at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
> 
> 
> -- 
> PGP KeyID: 2048R/EA31CFC9  subkeys.pgp.net <http://subkeys.pgp.net>


Mime
View raw message