vert-x/mod-mysql-postgresql

Failed in deploying module java.lang.NoClassDefFoundError: org/vertx/scala/core/VertxAccess$class

mradko opened this issue · 2 comments

Hello,
I tried downloading the module and run it to test how it works. Unfortunately, even with the hint in the installation guide, I cannot run it.

F:\(whole path)>vertx runmod io.vertx~mod-mysql-postgresql_2.10~0.3.1
Failed in deploying module
java.lang.NoClassDefFoundError: org/vertx/scala/core/VertxAccess$class
        at io.vertx.asyncsql.Starter.<init>(Starter.scala:13)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at java.lang.Class.newInstance(Class.java:374)
        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$21.run(DefaultPlatformManager.java:1748)
        at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.vertx.scala.core.VertxAccess$class
        at org.vertx.java.platform.impl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:127)
        at org.vertx.java.platform.impl.ModuleClassLoader.loadClass(ModuleClassLoader.java:108)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 16 more

F:\(whole path)>vertx install io.vertx~lang-scala_2.10~1.1.0-M1
Attempting to install module io.vertx~lang-scala_2.10~1.1.0-M1
Module is already installed
F:\(whole path)>scala -version
Scala code runner version 2.10.4 -- Copyright 2002-2013, LAMP/EPFL

My langs.properties:

scala=io.vertx~lang-scala_2.10~1.1.0-M1:org.vertx.scala.platform.impl.ScalaVerticleFactory
.scala=scala

Vert.x version 2.1.5

Any idea what am I missing? Thanks!

Are you sure that Vert.x is using the langs.properties you pointed at? I get the error you're having when langs.properties is set to scala module 1.0.0

Edit: Otherwise I get

$ vertx runmod io.vertx~mod-mysql-postgresql_2.10~0.3.1
Starting async database module for MySQL and PostgreSQL. 
Async database module for MySQL and PostgreSQL started with config Configuration(vertx,localhost,5432,Some(test),Some(testdb),UTF-8,16777216,PooledByteBufAllocator(directByDefault: true),5 seconds,5 seconds) 
Succeeded in deploying module

@Narigo your suggestion is right. Vert.x was not using that langs.properties and in its own properties ([VERTX_HOME]/conf/langs.properties) it had an entry:

scala=io.vertx~lang-scala~1.0.0:org.vertx.scala.platform.impl.ScalaVerticleFactory

After changing that, deployment works fine. I'm fairly new to Vert.x and I assumed that configuration in mod directory would be taken by default. That's not true. Also mod.json has to be directly pointed at; otherwise Vert.x will take default settings.

In case somebody else has similar problems:

  1. I changed Scala entry in [VERTX_HOME]/conf/langs.properties to

    scala=io.vertx~lang-scala_2.10~1.1.0-M1:org.vertx.scala.platform.impl.ScalaVerticleFactory
    
  2. I pointed at mod.json when running the module.

    F:\<path> >vertx runmod io.vertx~mod-mysql-postgresql_2.10~0.3.1 -conf "F:\<path>\mods\io.vertx~mod-mysql-postgresql_2.10~0.3.1\mod.json"

Thanks!