Unable to Get Slick-Play Integration working - java.lang.ClassNotFoundException: play.core.server.NettyServer

195 views
Skip to first unread message

Prathamesh Bandivadekar

unread,
Nov 16, 2016, 9:46:25 AM11/16/16
to Play Framework
Hi,

I am trying to follow the Play-Slick integration example as given in https://www.playframework.com/documentation/2.4.x/PlaySlick

Below is my build.sbt
--------------------------------------------------------------
name := "play-slick-tutorial"

version := "1.0-SNAPSHOT"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
  "com.typesafe.play" %% "play-slick" % "1.1.1",
  "com.typesafe.play" %% "play-slick-evolutions" % "1.1.1",
  "com.h2database" % "h2" % "1.4.191"
)

lazy val root = (project in file(".")).enablePlugins(PlayScala)

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

--------------------------------------------------------------
I am using Java Version 2.8.11 and Scala Version 2.11.8.
--------------------------------------------------------------
My application.conf file content is as below:

application.secret="changeme"

application.langs="en"

db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.user=sa
db.default.password=""

play.evolutions {
  db.default.enabled = true
}

slick.default="models.*"

logger.root=ERROR

logger.play=INFO

logger.application=DEBUG

--------------------------------------------------------------

i have following folder structure

TestApp
          app
              controllers - Empty
              models - Empty
              dao - Empty
              view - Empty
         conf
              routs
              appliation.conf
         project
             plugins.sbt - content >> 
                                           resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
                                           addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.7")
             build.properties - content >>
                                            sbt.version=0.13.5
         public - Empty
         logs - Empty

When i am running sbt run command i am getting below output:
[info] Set current project to activator-play-slick (in build file:/home/dc-user/scala/activator-play-slick-master-modified/)

java.lang.ClassNotFoundException: play.core.server.NettyServer
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at play.PlayRun$class.play$PlayRun$$startDevMode(PlayRun.scala:316)
        at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:103)
        at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$PlayRun$class$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:103)
        at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:125)
        at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:96)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.lang.ClassNotFoundException: play.core.server.NettyServer

I am really unable to understand the issue here. If i remove the entry for 
  "com.typesafe.play" %% "play-slick" % "1.1.1",
  "com.typesafe.play" %% "play-slick-evolutions" % "1.1.1",

Compilation succeeds, but that is no use. I wanted to learn play-slick integration and following the steps given in the documentation site.

Thanks in advance.


Igmar Palsenberg

unread,
Nov 16, 2016, 10:04:56 AM11/16/16
to Play Framework
 
I am trying to follow the Play-Slick integration example as given in https://www.playframework.com/documentation/2.4.x/PlaySlick
 
             plugins.sbt - content >> 
                                           resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
                                           addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.7")

You reference 2.4.x docs, but this makes it a play 2.3.7 application.  AFAIK, slick doesn't work on 2.3, and 2.3 and 2.4 are binary incompatible. Try setting it to 2.4.8, and try again.



Igmar

Prathamesh Bandivadekar

unread,
Nov 16, 2016, 2:56:32 PM11/16/16
to Play Framework
I removed

lazy val root = (project in file(".")).enablePlugins(PlayScala)

and the Netty server is gone.

 But now i am not able to run project with below error:

java.lang.RuntimeException: No main class detected.

I must be doing something wrong, and i am not able to figure it out. Due to lack of knowledge. :-(

Igmar Palsenberg

unread,
Nov 16, 2016, 2:58:16 PM11/16/16
to Play Framework
 
I removed

lazy val root = (project in file(".")).enablePlugins(PlayScala)

and the Netty server is gone.

 But now i am not able to run project with below error:

java.lang.RuntimeException: No main class detected.

I must be doing something wrong, and i am not able to figure it out. Due to lack of knowledge. :-(

See my previous message.


Igmar 

Prathamesh Bandivadekar

unread,
Nov 17, 2016, 6:40:34 AM11/17/16
to Play Framework

Hi,

I am now able to run application with evolutions working fine.

Actually i was making mistake in plugins.sbt by mentioning older version of sbt plugin. i corrected that and it started working.

Thanks for your help.
Reply all
Reply to author
Forward
0 new messages