kobo / groovyserv

Groovy's startup acceralator.
http://kobo.github.io/groovyserv/
Other
98 stars 10 forks source link

Spock from Grape doesn't work on GroovyServ since second execution #11

Closed nobeans closed 13 years ago

nobeans commented 14 years ago

At first time just after invoking groovyserver, sample code which uses Spock works well. But since second time, error occurs about AST.

@Grapes([
  @Grab(group='org.spockframework', module='spock-core', version='0.3'),
])
import spock.lang.*

class HelloSpock extends Specification {

    def "Can you figure out what I'm up to?"() {
        expect:
        name.size() == size

        where:
        name << ["Kirk", "Spock", "Scotty", "nobeans"]
        size << [4, 5, 6, 7]
    }

}
$ groovyclient HelloSpock.groovy 
JUnit 4 Runner, Tests: 1, Failures: 0, Time: 231

$ groovyclient HelloSpock.groovy 
JUnit 4 Runner, Tests: 1, Failures: 1, Time: 0
Test Failure: initializationError(HelloSpock)
org.spockframework.runtime.InvalidSpeckError: Class 'HelloSpock' is not a Speck, or has not been compiled properly
        at org.spockframework.runtime.SpeckInfoBuilder.getSpeckMetadata(SpeckInfoBuilder.java:66)
        at org.spockframework.runtime.SpeckInfoBuilder.build(SpeckInfoBuilder.java:46)
        at spock.lang.Sputnik.(Sputnik.java:38)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
        at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
        at org.junit.runner.Computer.getRunner(Computer.java:38)
        at org.junit.runner.Computer$1.runnerForClass(Computer.java:29)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
        at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:93)
        at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:84)
        at org.junit.runners.Suite.(Suite.java:79)
        at org.junit.runner.Computer.getSuite(Computer.java:26)
        at org.junit.runner.Request.classes(Request.java:69)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:127)
        at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:76)
        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 org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1302)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeStaticMethod(InvokerHelper.java:811)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeStaticMethod(InvokerHelper.java:65)
        at groovy.lang.GroovyShell.runJUnit4Test(GroovyShell.java:372)
        at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:287)
        at groovy.lang.GroovyShell.run(GroovyShell.java:227)
        at groovy.lang.GroovyShell.run(GroovyShell.java:157)
        at org.jggug.kobo.groovyserv.GroovyMain2.processOnce(GroovyMain2.java:501)
        at org.jggug.kobo.groovyserv.GroovyMain2.run(GroovyMain2.java:314)
        at org.jggug.kobo.groovyserv.GroovyMain2.process(GroovyMain2.java:300)
        at org.jggug.kobo.groovyserv.GroovyMain2.processArgs(GroovyMain2.java:115)
        at org.jggug.kobo.groovyserv.GroovyMain2.main(GroovyMain2.java:96)
        at sun.reflect.GeneratedMethodAccessor251.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43)
        at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.jggug.kobo.groovyserv.GroovyInvokeHandler.invokeGroovy(GroovyInvokeHandler.groovy:80)
        at org.jggug.kobo.groovyserv.GroovyInvokeHandler.this$2$invokeGroovy(GroovyInvokeHandler.groovy)
        at org.jggug.kobo.groovyserv.GroovyInvokeHandler$this$2$invokeGroovy.callCurrent(Unknown Source)
        at org.jggug.kobo.groovyserv.GroovyInvokeHandler.run(GroovyInvokeHandler.groovy:47)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:637)
nobeans commented 14 years ago

If specifying systemClassLoader of GrabConfig, it works well any times.

@Grapes([
  @Grab(group='org.spockframework', module='spock-core', version='0.3'),
  @GrabConfig(systemClassLoader=true),
])
nobeans commented 13 years ago

won't fix. please use the above workaround.