Exception in setup sorm

475 Views Asked by At

I cannot initialize project with sorm framework with mysql. I have scala 2.10.4. I have configured my mysql database in application.conf. I add DB object in my models package:

package models

import sorm._

object DB extends Instance(
    entities = Set(Entity[User]()),
    url = "jdbc:mysql://localhost:3306/play_test?useUnicode=true&characterEncoding=UTF-8",
    user = "root"
)

but I have received this exception

[RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class models.DB$]

Help me please who know what is it.

1

There are 1 best solutions below

3
On BEST ANSWER

It seems your object should be in package models. Either the code sample is not complete there, or you should have to add package models before you object declaration.

package models

import sorm._

object DB ...