Hello Antonio, Matt, Tim,
Thanks for your replies. I have tried the various suggestions, here are the results:
1. Try running the command without the -jar option
When I tried running the command without the -jar option, here is the error I got:
java target/scala-2.11/lift-jetty-fatjar-myproject-assembly-0.0.4.jar
Error: Could not find or load main class target.scala-2.11.lift-jetty-fatjar-myproject-assembly-0.0.4.jar
2. Try specifying the class you want to run instead of using -jar (Tim's suggestion above):
java -cp target/scala-2.11/lift-jetty-fatjar-myproject-assembly-0.0.4.jar path.to.Main
I don't know where the Main class is located in the lift framework. Does anyone know?
3. Matt Farmer's achortab project.
I don't fully understand what Start.scala is doing, but I copied that into my project and ran ./sbt assembly and then
java -jar target/scala-2.11/lift-jetty-fatjar-myproject-assembly-0.0.4.jar
as before. I got the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Handler
at bootstrap.Start.main(Start.scala)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Handler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Here is what I have in my build.sbt file:
"com.h2database" % "h2" % "1.4.+" % "test",
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftmodules" %% "lift-jquery-module_2.6" % "2.8",
"org.eclipse.jetty" % "jetty-webapp" % "9.1.4.v20140401" % "container;provided",
"org.eclipse.jetty" % "jetty-plus" % "8.1.7.v20120910" % "container,test", // For Jetty Config
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
"org.specs2" %% "specs2" % "2.3.12" % "test",
"net.liftmodules" %% ("ng_"+liftEdition) % "0.6.4" % "compile",
"net.liftmodules" %% ("ng-js_"+liftEdition) % ("0.2_"+ngVersion) % "compile",
"net.liftweb" %% "lift-squeryl-record" % liftVersion % "compile",
"org.mortbay.jetty" % "jetty" % "6.1.26",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "container",
"org.postgresql" % "postgresql" % "9.2-1003-jdbc4" % "compile",
"net.liftmodules" %% "extras_2.6" % "0.4-SNAPSHOT",
"ch.qos.logback" % "logback-classic" % "1.1.+",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
I should note that in order to get ./sbt to compile successfully using this approach to create a fat jar, I've have to comment out my tests and the RunWebApp.scala file in src.test.scala. I don't know why.
Would anyone have any more suggestions? Many thanks.