vert-x / mod-lang-groovy

Vert.x 2.x is deprecated - use instead
https://github.com/vert-x3/vertx-lang-groovy
Other
16 stars 15 forks source link

statically compiled verticles that subclass org.vertx.groovy.platform.Verticle fail #15

Open RichardWarburton opened 11 years ago

RichardWarburton commented 11 years ago

If my groovy verticle (ReportAggregator) is loaded as a class, eg using "groovy:org.jclarity.jpdm.reporting.verticles.ReportAggregator" and it subclasses the Java Verticle class then it gets correctly loaded, if it subclasses the Groovy Verticle class then the error at the end of this issue occurs.

I suspect its because in this commit: https://github.com/vert-x/mod-lang-groovy/commit/63e3ed72f952ac8023159d3bb37931c15b77c257 you're loading the 'Verticle' class from a different class loader to the user's custom Verticle class, so the if statement on line 112 can never pass.

1170 [vert.x-eventloop-thread-3] ERROR c.j.j.r.ReportingAgentTestBase - Cannot cast object 'org.jclarity.jpdm.reporting.verticles.ReportAggregator@1f109723' with class 'org.jclarity.jpdm.reporting.verticles.ReportAggregator' to class 'org.vertx.java.platform.Verticle'
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.jclarity.jpdm.reporting.verticles.ReportAggregator@1f109723' with class 'org.jclarity.jpdm.reporting.verticles.ReportAggregator' to class 'org.vertx.java.platform.Verticle'
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360) ~[groovy-all-2.1.5.jar:2.1.5]
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599) ~[groovy-all-2.1.5.jar:2.1.5]
    at org.vertx.groovy.platform.impl.GroovyVerticleFactory.createVerticle(GroovyVerticleFactory.groovy:119) ~[lang-groovy-2.0.0-final.jar:na]
    at org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1269) ~[vertx-platform-2.0.0-final.jar:na]
    at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:171) [vertx-core-2.0.0-final.jar:na]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353) [netty-all-4.0.2.Final.jar:na]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:366) [netty-all-4.0.2.Final.jar:na]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [netty-all-4.0.2.Final.jar:na]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_03]
LostInBrittany commented 10 years ago

Is this still an issue? It it hasn't be corrected, I'll look at it this week.

senagbe commented 8 years ago

Is this still an issue? I seem to be getting the same problem with 3.2.1

pmlopes commented 8 years ago

@senagbe please report 3.x issues to https://github.com/vert-x3/vertx-lang-python since its where development happens!