problem getting sbt 0.11.2/Lift 2.4/Jetty initially set up

557 views
Skip to first unread message

Toby Thain

unread,
Apr 7, 2012, 5:48:40 PM4/7/12
to lif...@googlegroups.com
Hi,

Not really a Lift problem but more an sbt/Jetty problem, but hoping someone here might have hit this and knows how to solve it.

Running sbt I see this:

[info] Resolving org.eclipse.jetty#jetty-webapp;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-xml;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-util;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-servlet;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-security;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-server;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty.orbit#javax.servlet;2.5.0.v201103041518 ...
[info] Resolving org.eclipse.jetty#jetty-continuation;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-http;7.6.2.v20120308 ...
[info] Resolving org.eclipse.jetty#jetty-io;7.6.2.v20120308 ...
[warn]     [NOT FOUND  ] org.eclipse.jetty.orbit#javax.servlet;2.5.0.v201103041518!javax.servlet.orbit (22ms)
[warn] ==== Jetty Eclipse: tried
[warn]   http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.orbit
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     ::              FAILED DOWNLOADS            ::
[warn]     :: ^ see resolution messages for details  ^ ::
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     :: org.eclipse.jetty.orbit#javax.servlet;2.5.0.v201103041518!javax.servlet.orbit
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/toby/Documents/flikz/api/}default-6dcebb/*:update: sbt.ResolveException: download failed: org.eclipse.jetty.orbit#javax.servlet;2.5.0.v201103041518!javax.servlet.orbit


Which appears to be this problem:
http://stackoverflow.com/questions/9889674/sbt-jetty-and-servlet-3-0

But the ivyXML workaround posted there doesn't work for me.

Anyone solved this?

--Toby

Diego Medina

unread,
Apr 8, 2012, 10:27:51 PM4/8/12
to lif...@googlegroups.com

The dirty but easy solution would be to download the jar, create a lib folder at the root of your project and place the jar there.

Regards
Diego

Diego
Sent from my android cell

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Diego Medina

unread,
Apr 8, 2012, 10:28:28 PM4/8/12
to lif...@googlegroups.com

could you post your build.sbt file too?

Diego
Sent from my android cell

On Apr 8, 2012 7:18 PM, "Toby Thain" <to...@telegraphics.com.au> wrote:

Fred

unread,
Apr 9, 2012, 6:22:31 AM4/9/12
to lif...@googlegroups.com

Try this: https://github.com/heiflo/lift-basic-2.4-sbt-0.11.2

Sent from Galaxy SII

Bud Weiser

unread,
Apr 9, 2012, 8:13:04 AM4/9/12
to lif...@googlegroups.com
I also had many problems with eclipse, did you try it with maven?
It works simple without problems. Also tell me if you have syntax problems in eclipse I got solutions for that which are hard to follow if you research them. 

Toby Thain

unread,
Apr 11, 2012, 10:14:49 PM4/11/12
to lif...@googlegroups.com


On Sunday, 8 April 2012 22:28:28 UTC-4, fmpwizard wrote:

could you post your build.sbt file too?


Thanks for the replies, everyone.

I did get this working, but only with Jetty 6. Here is my build.sbt with the working configuration. Commented out are the configurations which fail (Jetty 7 and Jetty 8).

name := "xx-API"

version := "0.1"

libraryDependencies += "org.scalaquery" % "scalaquery_2.9.0-1" % "0.9.5"

seq(webSettings: _*)

// using 0.2.4+ of the sbt web plugin
scanDirectories in Compile := Nil

resolvers ++= Seq(
  //"Scala Tools Releases" at "http://scala-tools.org/repo-releases/",
  "Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
  "Jetty Eclipse" at "http://repo1.maven.org/maven2/"
)

libraryDependencies ++= {
  val liftVersion = "2.4" // Put the current/latest lift version here
  Seq(
    "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-wizard" % liftVersion % "compile->default"
  )
}

libraryDependencies ++= Seq(
  // see http://docs.codehaus.org/display/JETTY/Downloading+Jetty for Jetty versions
  //"org.eclipse.jetty" % "jetty-webapp" % "8.1.2.v20120308" % "container",  // Does not work :(
  //"org.eclipse.jetty" % "jetty-webapp" % "7.6.2.v20120308 " % "container", // Does not work
  "org.mortbay.jetty" % "jetty" % "6.1.26" % "container",
  "junit" % "junit" % "4.7" % "test",
  "ch.qos.logback" % "logback-classic" % "0.9.26"
  //"org.scala-tools.testing" %% "specs" % "1.6.8" % "test"
  //"mysql" % "mysql-connector-java" % "5.1.18"
)

 

Olek Swirski

unread,
Apr 12, 2012, 10:16:46 PM4/12/12
to lif...@googlegroups.com
I also had same problem with the latest 8.1.2, but the 8.1.0 makes no trouble, try:

"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "test, container", // For Jetty 8

Toby Thain

unread,
Apr 24, 2012, 10:56:21 AM4/24/12
to lif...@googlegroups.com


On Wednesday, 11 April 2012 22:14:49 UTC-4, Toby Thain wrote:


On Sunday, 8 April 2012 22:28:28 UTC-4, fmpwizard wrote:

could you post your build.sbt file too?


Thanks for the replies, everyone.

I did get this working, but only with Jetty 6.

Since I am deploying with Jetty, is there a way I can import Jetty utility classes from my Lift project? A simple import does not find the package; obviously I am new to Java deployment—is there some step I need to take to make this possible?

Toby Thain

unread,
Apr 24, 2012, 11:35:24 PM4/24/12
to lif...@googlegroups.com


On Thursday, 12 April 2012 22:16:46 UTC-4, Olek Swirski wrote:
I also had same problem with the latest 8.1.2, but the 8.1.0 makes no trouble, try:

"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "test, container", // For Jetty 8


You are quite right. This works fine! Thanks.



--Toby

 

Diego Medina

unread,
Apr 24, 2012, 11:50:35 PM4/24/12
to lif...@googlegroups.com
which jetty utilities are you trying to use?
You would normally have to add the correct dependencies to your
project, if you are using SBT, there is a build.sbt or build.scala
file you would need to modify, if you are using maven, you modify a
pom.xml file.

Regards,

Diego

> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com

Toby Thain

unread,
Apr 29, 2012, 8:03:56 PM4/29/12
to lif...@googlegroups.com


On Tuesday, 24 April 2012 23:50:35 UTC-4, fmpwizard wrote:
which jetty utilities are you trying to use?
You would normally have to add the correct dependencies to your
project, if you are using SBT, there is a build.sbt or build.scala
file you would need to modify, if you are using maven, you modify a
pom.xml file.

My build.sbt is described above. The Jetty container is working fine. I am just wondering how I can import a class from Jetty, e.g.
extended by org.mortbay.util.UrlEncoded

 

Regards,

  Diego

Diego Medina

unread,
Apr 29, 2012, 9:05:23 PM4/29/12
to lif...@googlegroups.com

Diego
Sent from my android cell

On Apr 29, 2012 8:04 PM, "Toby Thain" <to...@telegraphics.com.au> wrote:
>
>
>
> On Tuesday, 24 April 2012 23:50:35 UTC-4, fmpwizard wrote:
>>
>> which jetty utilities are you trying to use?
>> You would normally have to add the correct dependencies to your
>> project, if you are using SBT, there is a build.sbt or build.scala
>> file you would need to modify, if you are using maven, you modify a
>> pom.xml file.
>
>
> My build.sbt is described above.

I'm not sure how you see this email thread, but I just saw one email and no sample build file.

I want to help you but I don't think it's fair for me to have to go and search the mailing list to see where your build file  went.

Regards

Diego

The Jetty container is working fine. I am just wondering how I can import a class from Jetty, e.g.
>

> org.mortbay.util.UrlEncoded
>
>
>  
>>
>> Regards,
>>
>>   Diego

Toby Thain

unread,
May 2, 2012, 7:56:01 PM5/2/12
to lif...@googlegroups.com


On Sunday, 29 April 2012 21:05:23 UTC-4, fmpwizard wrote:

Diego
Sent from my android cell
On Apr 29, 2012 8:04 PM, "Toby Thain" <to...@telegraphics.com.au> wrote:
>
>
>
> On Tuesday, 24 April 2012 23:50:35 UTC-4, fmpwizard wrote:
>>
>> which jetty utilities are you trying to use?
>> You would normally have to add the correct dependencies to your
>> project, if you are using SBT, there is a build.sbt or build.scala
>> file you would need to modify, if you are using maven, you modify a
>> pom.xml file.
>
>
> My build.sbt is described above.

I'm not sure how you see this email thread, but I just saw one email and no sample build file.

I want to help you but I don't think it's fair for me to have to go and search the mailing list to see where your build file  went.


Apologies; libraryDependencies look like this:



libraryDependencies ++= Seq(
  // see http://docs.codehaus.org/display/JETTY/Downloading+Jetty for Jetty versions
  "org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "container",
  //...
)

 

Diego Medina

unread,
May 2, 2012, 9:17:10 PM5/2/12
to lif...@googlegroups.com
Hi,

Ok, if you want to access
org.mortbay.util.UrlEncoded
you cannot use
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "container",

because org.mortbay is jetty until version 6

So, you will have to downgrade to jetty 6 or see what the new name is
for jetty 8.1
I think the new name is
org.eclipse.jetty.util.UrlEncoding
so try using that name, if that import does not work, you need to add
a dependency that has that class.

Just guesing here, but you can try adding

"org.eclipse.jetty" % "jetty-util" % "8.1.0.v20120127" % "container",

do your build file and run sbt update.

Regards,

Diego

Toby Thain

unread,
May 3, 2012, 9:07:31 AM5/3/12
to lif...@googlegroups.com


On Wednesday, 2 May 2012 21:17:10 UTC-4, fmpwizard wrote:
Hi,

Ok, if you want to access
org.mortbay.util.UrlEncoded
you cannot use
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "container",

because org.mortbay is jetty until version 6

Right, my initial experiments were with v6, then I got v8 working later for the webapp.

 

So, you will have to downgrade to jetty 6 or see what the new name is
for jetty 8.1
I think the new name is
org.eclipse.jetty.util.UrlEncoding
so try using that name, if that import does not work, you need to add
a dependency that has that class.

Just guesing here, but you can try adding

"org.eclipse.jetty" % "jetty-util" % "8.1.0.v20120127" % "container",

That sounds like the missing piece of the puzzle! Thanks, I'll try it.

--Toby
 

Toby Thain

unread,
May 4, 2012, 11:13:48 PM5/4/12
to lif...@googlegroups.com


On Wednesday, 2 May 2012 21:17:10 UTC-4, fmpwizard wrote:
Hi,

Ok, if you want to access
org.mortbay.util.UrlEncoded
you cannot use
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "container",

because org.mortbay is jetty until version 6

So, you will have to downgrade to jetty 6 or see what the new name is
for jetty 8.1
I think the new name is
org.eclipse.jetty.util.UrlEncoding
so try using that name, if that import does not work, you need to add
a dependency that has that class.

Just guesing here, but you can try adding

"org.eclipse.jetty" % "jetty-util" % "8.1.0.v20120127" % "container",

This doesn't seem to work. I have the right class name, via:
http://download.eclipse.org/jetty/8.1.0.v20120127/apidocs/
e.g.
import org.eclipse.jetty.util.B64Code

but:
$ sbt
[info] Loading project definition from /Users/toby/Documents/xx/api/project
[info] Set current project to xx-API (in build file:/Users/toby/Documents/xx/api/)
[info] Updating {file:/Users/toby/Documents/xx/api/}default-6dcebb...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving org.scalaquery#scalaquery_2.9.0-1;0.9.5 ...
[info] Resolving net.liftweb#lift-webkit_2.9.1;2.4 ...
[info] Resolving commons-fileupload#commons-fileupload;1.2.2 ...
[info] Resolving net.liftweb#lift-util_2.9.1;2.4 ...
[info] Resolving commons-codec#commons-codec;1.4 ...
[info] Resolving nu.validator.htmlparser#htmlparser;1.2.1 ...
[info] Resolving javax.mail#mail;1.4.4 ...
[info] Resolving javax.activation#activation;1.1 ...
[info] Resolving joda-time#joda-time;1.6.2 ...
[info] Resolving net.liftweb#lift-actor_2.9.1;2.4 ...
[info] Resolving net.liftweb#lift-common_2.9.1;2.4 ...
[info] Resolving org.slf4j#slf4j-api;1.6.4 ...
[info] Resolving net.liftweb#lift-json_2.9.1;2.4 ...
[info] Resolving com.thoughtworks.paranamer#paranamer;2.3 ...
[info] Resolving org.scala-lang#scalap;2.9.1 ...
[info] Resolving org.scala-lang#scala-compiler;2.9.1 ...
[info] Resolving net.liftweb#lift-mapper_2.9.1;2.4 ...
[info] Resolving net.liftweb#lift-db_2.9.1;2.4 ...
[info] Resolving net.liftweb#lift-proto_2.9.1;2.4 ...
[info] Resolving com.h2database#h2;1.2.147 ...
[info] Resolving org.apache.derby#derby;10.7.1.1 ...
[info] Resolving net.liftweb#lift-wizard_2.9.1;2.4 ...
[info] Resolving ch.qos.logback#logback-classic;0.9.26 ...
[info] Resolving ch.qos.logback#logback-core;0.9.26 ...
[info] Resolving junit#junit;4.7 ...
[info] Resolving org.eclipse.jetty#jetty-webapp;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-xml;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-util;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-servlet;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-security;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-server;8.1.0.v20120127 ...
[info] Resolving org.mortbay.jetty#servlet-api;3.0.20100224 ...
[info] Resolving org.eclipse.jetty#jetty-continuation;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-http;8.1.0.v20120127 ...
[info] Resolving org.eclipse.jetty#jetty-io;8.1.0.v20120127 ...
[info] Done updating.
> compile
[info] Compiling 26 Scala sources and 1 Java source to /Users/toby/Documents/xx/api/target/scala-2.9.1/classes...
[error] /Users/toby/Documents/xx/api/src/main/scala/sandbox/DbTest.scala:14: object eclipse is not a member of package org
[error] import org.eclipse.jetty.util.B64Code
[error]            ^
[error] one error found
[error] {file:/Users/toby/Documents/xx/api/}default-6dcebb/compile:compile: Compilation failed
[error] Total time: 7 s, completed May 4, 2012 11:11:51 PM
>

 

Toby Thain

unread,
May 4, 2012, 11:43:27 PM5/4/12
to lif...@googlegroups.com


On Friday, 4 May 2012 23:13:48 UTC-4, Toby Thain wrote:


On Wednesday, 2 May 2012 21:17:10 UTC-4, fmpwizard wrote:
Hi,

Ok, if you want to access
org.mortbay.util.UrlEncoded
you cannot use
"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.v20120127" % "container",

because org.mortbay is jetty until version 6

So, you will have to downgrade to jetty 6 or see what the new name is
for jetty 8.1
I think the new name is
org.eclipse.jetty.util.UrlEncoding
so try using that name, if that import does not work, you need to add
a dependency that has that class.

Just guesing here, but you can try adding

"org.eclipse.jetty" % "jetty-util" % "8.1.0.v20120127" % "container",

This doesn't seem to work. I have the right class name, via:
http://download.eclipse.org/jetty/8.1.0.v20120127/apidocs/
e.g.
import org.eclipse.jetty.util.B64Code


Never mind - it does work. The "configuration" part did not match the configuration I was running. By using dependency:

  "org.eclipse.jetty" % "jetty-util" % "8.1.0.v20120127",

I can import the class and run in default configuration (sbt run).

Thanks for the help!

Jones

unread,
Sep 27, 2012, 9:24:11 AM9/27/12
to lif...@googlegroups.com
Hello, 

I have got a similar problem trying to import my project in eclipse (I created it using "sbt> eclipse with-source=true").
In the file "RunWebApp.scala", the four imports are refused:

import org.eclipse.jetty.server.handler.ContextHandler

import org.eclipse.jetty.server.nio.SelectChannelConnector

import org.eclipse.jetty.server.{Handler, Server}

import org.eclipse.jetty.webapp.WebAppContext

Here are my library dependencies:

"net.liftweb"       %% "lift-webkit"        % liftVersion        % "compile",

    "net.liftweb"       %% "lift-mapper"        % liftVersion        % "compile",

    "net.liftmodules"   %% "lift-jquery-module" % (liftVersion + "-1.0"),

    "org.eclipse.jetty" % "jetty-webapp"        % "8.1.7.v20120910"  % "container",

    "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container" artifacts Artifact("javax.servlet", "jar", "jar"),

    "ch.qos.logback"    % "logback-classic"     % "1.0.6",

    "org.specs2"        %% "specs2"             % "1.12.1"           % "test",

    "com.h2database"    % "h2"                  % "1.3.167"

Do you know what I have been missing? I created the project using https://github.com/lift/lift_25_sbt and imported it in Eclipse. It is the first time I use eclipse for a Lift Webapp so I don't have any idea :-/. I can run my Webapp using "sbt> container:start" and see it in the browser without any problem.

Thanks in advance!
Jones

--

Diego Medina

unread,
Sep 27, 2012, 9:26:47 AM9/27/12
to lif...@googlegroups.com
> Do you know what I have been missing? I created the project using
> https://github.com/lift/lift_25_sbt and imported it in Eclipse. It is the
> first time I use eclipse for a Lift Webapp so I don't have any idea :-/. I
> can run my Webapp using "sbt> container:start" and see it in the browser
> without any problem.

When you find yourself in a case like this, where the IDE tells you
there is a problem, but sbt runs fine, then it is an IDE bug
I don;t know where you would report those bugs, (I use Intellij, and
I love it :) )

Thanks

Diego
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
>
>



Jones

unread,
Sep 27, 2012, 11:29:54 AM9/27/12
to lif...@googlegroups.com
Okay, I had heard some people saying that they were loving Eclipse for Lift =). I'll maybe try IntelliJ then!

Diego Medina

unread,
Sep 27, 2012, 1:55:48 PM9/27/12
to lif...@googlegroups.com
On Thu, Sep 27, 2012 at 11:29 AM, Jones <mistic....@gmail.com> wrote:
> Okay, I had heard some people saying that they were loving Eclipse for Lift
> =). I'll maybe try IntelliJ then!

Yes, you will find people loving eclipse, emacs, vim, etc :) What I
like ab out intellij is the maintainer really fixes issues as we find
them, basically, if you run into some code marked as error that is not
a real error, you can report them on
http://youtrack.jetbrains.com/issues/SCL
post a link here on the list, so we all vote on the issue and some
time later the fix should magically appear :)

Thanks

Diego

Peter Petersson

unread,
Sep 29, 2012, 9:33:26 AM9/29/12
to lif...@googlegroups.com, Jones
Hi Jones

First a quick note: You are not required to use the functionality of RunWebApp.scala to integrate your Scala/Lift work into Eclipse.

I use eclipse for all my java/scala projects but when It comes to running lift/scala apps I mostly do it from within sbt (with jrebel) but if you prefer you can just as easy run it from within eclipse.
When I need to dig deeper and debug the app I run from within eclipse with the use of the RunJettyRun eclipse plugin. See [1] for more information it's really simple to set up.

Generally when you want to work on a Lift app with the use of Eclipse IDE you start by import the lift project into eclipse (ones)

Here is the 2 steps for the initial setup:

1) Start sbt and run the eclipse command to create project files.
project$ ./sbt
> eclipse

2) Now in Eclipse menu ..
File ==> Import...
Select General ==> Existing Project into Workspace
Use "Brows" to look up the project root ....

Most of my github projects includes this step information in the "Scala IDE for Eclipse" section in the readme.md file in [1] or any of my other github projects (they generally includes this information).

[1] http://higherlogics.blogspot.se/2012/03/debugging-lift-24-with-eclipse.html 

[2] https://github.com/karma4u101/Templating-With-Twitter-Bootstrap

best regards
  Peter Petersson
--

Peter Petersson

unread,
Sep 29, 2012, 9:45:04 AM9/29/12
to lif...@googlegroups.com
... and of corese (I forget to mention) when you are working with Scala in Eclipse you need the Scala ide plugin for eclipse [1].

[1] http://scala-ide.org/

best regards
  Peter Petersson

Olek Swirski

unread,
Sep 29, 2012, 10:10:20 AM9/29/12
to lif...@googlegroups.com
I think, that you may get the error, because you try to:
import org.eclipse.jetty.webapp.WebAppContext
but in your sbt file jetty-webapp is in "container" configuration,
but not in compile configuration, so will be available when your jetty
is used by sbt to serve your app, but not during compilation. I think
using "container,compile" instead should fix your problem. It works
for me and I can do the imports you listed.
--
Reply all
Reply to author
Forward
0 new messages