vert-x / mod-mysql-postgresql

Vert.x 2.x is deprecated - use instead
http://vertx.io/docs/vertx-mysql-postgresql-client/java/
Apache License 2.0
49 stars 17 forks source link

java.lang.VerifyError: Bad type on operand stack #24

Closed coffeeaddict closed 10 years ago

coffeeaddict commented 10 years ago

When trying to use this in a ruby-verticle like so:

require 'vertx'

psql_config = {
  address: "db-psql",
  connection: "PostgreSQL",
  maxPoolSize: 5,
  username: "recipebook",
  password: "$uper$ecret",
  database: "recipebooks",
}

Vertx.deploy_module("io.vertx~mod-mysql-postgresql~0.2.0", psql_config)
Vertx.deploy_verticle("server.rb", {}, 4)

where server.rb looks like:

require 'vertx'
require 'pp'

include Vertx

rm = RouteMatcher.new

rm.get('/recipes') do |req|
  EventBus.send("db-psql", { action: :select, table: :recipes }.to_json) do |reply|
    Vertx.logger.info reply.pretty_inspect
    req.response.end(reply.body.to_json)
  end
end

rm.get('/recipes/:id') do |req|
  req.response.status_code(404).end({ error: 'no such book'}.to_json);
end

HttpServer.new.request_handler(rm).listen(8080)

it throws this error:

Unexpected exception in Ruby verticle 
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    io/vertx/asyncsql/Starter.reportFailure(Ljava/lang/Throwable;)V @2: invokestatic
  Reason:
    Type 'io/vertx/asyncsql/Starter' (current frame, stack[0]) is not assignable to 'org/vertx/scala/core/VertxExecutionContext'
  Current Frame:
    bci: @2
    flags: { }
    locals: { 'io/vertx/asyncsql/Starter', 'java/lang/Throwable' }
    stack: { 'io/vertx/asyncsql/Starter', 'java/lang/Throwable' }
  Bytecode:
    0000000: 2a2b b800 72b1                         

    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
    at java.lang.Class.getConstructor0(Class.java:2803)
    at java.lang.Class.newInstance(Class.java:345)
    at org.vertx.scala.lang.ClassLoaders$$anonfun$newInstance$1.apply(ClassLoaders.scala:38)
    at scala.util.Try$.apply(Try.scala:161)
    at org.vertx.scala.lang.ClassLoaders$.newInstance(ClassLoaders.scala:36)
    at org.vertx.scala.platform.impl.ScalaVerticleFactory.createVerticle(ScalaVerticleFactory.scala:69)
    at org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1269)
    at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:170)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:744)

What is wrong?

Narigo commented 10 years ago

Not sure about that yet. Are you using Scala 1.0.0-RC1 in your langs.properties? Can you try with 0.3.0? Maybe that's still an issue. I'm trying to update to Scala 1.0.0-RC1 but have trouble with the new VertxExecutionContext. Hopefully this will be resolved soon.

coffeeaddict commented 10 years ago
Unexpected exception in Ruby verticle 
java.lang.AbstractMethodError: io.vertx.asyncsql.Starter.setVertx(Lorg/vertx/scala/core/Vertx;)V
    at org.vertx.scala.platform.impl.ScalaVerticle.setVertx(ScalaVerticle.scala:51)
    at org.vertx.scala.platform.impl.ScalaVerticle$.newVerticle(ScalaVerticle.scala:37)
    at org.vertx.scala.platform.impl.ScalaVerticleFactory.createVerticle(ScalaVerticleFactory.scala:72)
    at org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1269)
    at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:170)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:744)

Same thing, different output...

Perhaps mixing and matching this with Ruby is not the best of ideas :smirk:...

Narigo commented 10 years ago

Just to be sure: You've tried Scala lang 0.3.0 and the master branch of this module (0.3.0-SNAPSHOT)?

coffeeaddict commented 10 years ago

:scream: it works now!

Thx for the help; perhaps these learned lessons need a place in the readme? :wink:

angeloh commented 10 years ago

What is the ETA for this to update to scala lang 1.0.x?

angeloh commented 10 years ago

@coffeeaddict do you have to change your module to scala lang 0.3.0 or just postgres mod's scala lang to 0.3.0?