Lift WebServices

7 views
Skip to first unread message

abruzzo

unread,
Sep 8, 2009, 12:43:43 PM9/8/09
to Lift
I'm trying to set up a simple web service using Lift v1.0. I've
scoured
across many examples but because of changes in the api's, none of them
compile. I finally found an example of a dispatcher tha compiles but
in the
sample as in others the dispatcher is added in the boot method of the
Boot
class as follows:

LiftRules.dispatch.prepend(RestApi.dispatch)


This compiles fine however, upon startup I get the following stack:

ERROR - Failed to Boot
java.lang.IllegalStateException: Cannot modify after boot.
at net.liftweb.http.RulesSeq$class.safe_$qmark(LiftRules.scala:885)
at net.liftweb.http.RulesSeq$class.prepend(LiftRules.scala:892)
at net.liftweb.http.RulesSeq$$anon$3.prepend(LiftRules.scala:872)
at net.liftweb.http.LiftFilter.preBoot(LiftServlet.scala:581)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:572)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:548)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:653)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
1239)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
466)
at
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
(Jetty6PluginWebAppContext.java:124)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at
org.mortbay.jetty.handler.ContextHandlerCollection.doStart
(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.plugin.Jetty6PluginServer.start
(Jetty6PluginServer.java:132)
at
org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty
(AbstractJettyMojo.java:441)
at
org.mortbay.jetty.plugin.AbstractJettyMojo.execute
(AbstractJettyMojo.java:383)
at
org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute
(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:
184)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:451)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:558)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal
(DefaultLifecycleExecutor.java:512)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:482)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
2009-09-07 11:57:17.823::INFO: Started
SelectChann...@0.0.0.0:8080

Any help would be greatly appreciated. Also, if anyone knows of where
I can
find a sample Lift / BlazeDS application that will actually compile
using
Lift 1.0, please let me know.

David Pollak

unread,
Sep 8, 2009, 12:56:22 PM9/8/09
to lif...@googlegroups.com
Can you privately send me a zipped file containing your project (please remove the target directory before sending).  I think there is something very wrong, but can't diagnose it from the stack trace.
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

David Pollak

unread,
Sep 8, 2009, 4:44:02 PM9/8/09
to lif...@googlegroups.com
You declared the LiftFilter twice in your web.xml file:

  <filter>
    <filter-name>LiftFilter</filter-name>
    <display-name>Lift Filter</display-name>
    <description>The Filter that intercepts lift calls</description>
    <filter-class>net.liftweb.http.LiftFilter</filter-class>
  </filter>

THis caused the filter to be loaded twice.

Remove one of the filter declarations and you should be fine.

On Tue, Sep 8, 2009 at 9:43 AM, abruzzo <java.p...@gmail.com> wrote:

abruzzo

unread,
Sep 8, 2009, 7:19:50 PM9/8/09
to Lift
Whoops! Should have looked there. That fixed it. Thanks again for the
help.
> > SelectChannelConnec...@0.0.0.0:8080
>
> > Any help would be greatly appreciated. Also, if anyone knows of where
> > I can
> > find a sample Lift / BlazeDS application that will actually compile
> > using
> > Lift 1.0, please let me know.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
Sep 8, 2009, 10:47:08 PM9/8/09
to lif...@googlegroups.com
On Tue, Sep 8, 2009 at 4:19 PM, abruzzo <java.p...@gmail.com> wrote:

Whoops! Should have looked there. That fixed it. Thanks again for the
help.

Sure thing.



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Reply all
Reply to author
Forward
0 new messages