NullPointerException when running in production mode

249 views
Skip to first unread message

Gilberto Garcia

unread,
Oct 24, 2011, 7:31:02 PM10/24/11
to lif...@googlegroups.com
Hi All,

I'm new to lift and I hope one of you guys could help me with this
little problem.

I just finished my first lift app and I get no exception when I start
jetty in dev mode but when I start getting the following exception
when jetty is started in production mode.

I don't understand why I'm getting this since I'm not using Comet (at
least that I know of)

LiftRules - Exception being returned to browser when processing
Req(List(F1135806610807OKRBFQ, _), Map(F1135806610807OKRBFQ ->
List(1135806610814), _ -> List(1319155726629)),
ParsePath(List(comet_request, 93859598055, sqigj8s96n5d1hxprpqvma53l,
F1135806610801VE4JLK),,true,false), , GetRequest, Empty)
java.lang.NullPointerException: null
at org.eclipse.jetty.server.Request.getServerName(Request.java:1008)
~[na:na]
at org.eclipse.jetty.server.Request.getServerPort(Request.java:1071)
~[na:na]
at net.liftweb.http.provider.servlet.HTTPRequestServlet.serverPort(HTTPRequestServlet.scala:92)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req$$anonfun$hostAndPath$1.apply(Req.scala:968)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req$$anonfun$hostAndPath$1.apply(Req.scala:968)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.common.Full.map(Box.scala:491)
~[lift-common_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req.hostAndPath(Req.scala:968)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftSession$$anonfun$cometForHost$1.apply(LiftSession.scala:600)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftSession$$anonfun$cometForHost$1.apply(LiftSession.scala:599)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
~[scala-library-2.9.0-1.jar:na]
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
~[scala-library-2.9.0-1.jar:na]
at scala.collection.immutable.List.foreach(List.scala:45)
~[scala-library-2.9.0-1.jar:na]
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
~[scala-library-2.9.0-1.jar:na]
at scala.collection.immutable.List.filter(List.scala:45)
~[scala-library-2.9.0-1.jar:na]
at net.liftweb.http.LiftSession.cometForHost(LiftSession.scala:599)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftRules$$anonfun$7.apply(LiftRules.scala:292)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftRules$$anonfun$7.apply(LiftRules.scala:289)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftRules.net$liftweb$http$LiftRules$$_getLiftSession(LiftRules.scala:280)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftRules$$anonfun$5.apply(LiftRules.scala:237)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftRules$$anonfun$5.apply(LiftRules.scala:237)
~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet.getLiftSession(LiftServlet.scala:75)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet.doService(LiftServlet.scala:270)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:128)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:127)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:344)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.Helpers$.calcTime(Helpers.scala:34)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.TimeHelpers$class.logTime(TimeHelpers.scala:363)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.Helpers$.logTime(Helpers.scala:34)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet.doIt$1(LiftServlet.scala:127)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.LiftServlet.service(LiftServlet.scala:138)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(HTTPProvider.scala:69)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply(HTTPProvider.scala:68)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2$$anonfun$apply$mcV$sp$1.apply(HTTPProvider.scala:68)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.URLRewriter$.doWith(Req.scala:1234)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply$mcV$sp(HTTPProvider.scala:67)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply(HTTPProvider.scala:67)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$2.apply(HTTPProvider.scala:67)
[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
[lift-util_2.9.0-1-2.4-M3.jar:2.4-M3]


I appreciate any help,
Thanks in advance

Diego Medina

unread,
Oct 24, 2011, 10:51:36 PM10/24/11
to lif...@googlegroups.com
Hi,

Just a few questions to hopefully help here.
1- Do you start jetty both times (dev and production) from sbt or maven?
2- If when you get a NPE you are deploying the war file to your
container, can you try starting the container (jetty) in dev mode and
see if you get a NPE there?
3- Can you try to upgrade to Lift 2.4-M4 ?


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
Web Developer
di...@fmpwizard.com
http://www.fmpwizard.com

Gilberto Garcia

unread,
Oct 25, 2011, 4:00:56 PM10/25/11
to lif...@googlegroups.com
Hi Diego,

Thanks for you reply.

1 - Both times from maven
2 - I can see the NPE after deploying the war file to my container
(jetty 8). I get no NPE when I start it in dev mode.
3 - I think I'm running Lift 2.4-M3 but I'll double check it, and I'll
upgrade it if that's the case.

I'll let you know.

Thanks again.

David Pollak

unread,
Oct 26, 2011, 12:21:32 AM10/26/11
to lif...@googlegroups.com
On Tue, Oct 25, 2011 at 1:00 PM, Gilberto Garcia <giba...@gmail.com> wrote:
Hi Diego,

Thanks for you reply.

1 - Both times from maven
2 - I can see the NPE after deploying the war file to my container
(jetty 8). I get no NPE when I start it in dev mode.
3 - I think I'm running Lift 2.4-M3 but I'll double check it, and I'll
upgrade it if that's the case.

This is a bug in Jetty... it's come up on the list from time to time.  Please upgrade to Jetty 7 or 8.

Sergey Trofimov

unread,
Oct 26, 2011, 1:14:14 AM10/26/11
to lif...@googlegroups.com
On Wed, Oct 26, 2011 at 07:21, David Pollak <feeder.of...@gmail.com> wrote:


On Tue, Oct 25, 2011 at 1:00 PM, Gilberto Garcia <giba...@gmail.com> wrote:
Hi Diego,

Thanks for you reply.

1 - Both times from maven
2 - I can see the NPE after deploying the war file to my container
(jetty 8). I get no NPE when I start it in dev mode.
3 - I think I'm running Lift 2.4-M3 but I'll double check it, and I'll
upgrade it if that's the case.

This is a bug in Jetty... it's come up on the list from time to time.  Please upgrade to Jetty 7 or 8.


Similar happened in jetty 7 as well (in my experience)



 

Jonathan Ferguson

unread,
Oct 26, 2011, 9:00:27 AM10/26/11
to lif...@googlegroups.com
Does anyone have a reproducible test case for this? I believe we are getting this with Lift 2.4M4 with jetty6. I will endeavour to upgrade to the latest jetty and see if it solves the issue.

Thank you 

Jono

Gilberto Garcia

unread,
Oct 25, 2011, 8:13:49 PM10/25/11
to lif...@googlegroups.com
Diego,

I just updated lift to 2.4-M4 and now it's ok when running with maven.
but I'm still getting the NPE when I deploy the war file into the
container.

I'm starting jetty using jetty.sh file.

Thanks.

Gilberto Garcia

unread,
Oct 25, 2011, 9:40:01 PM10/25/11
to lif...@googlegroups.com
I restarted jetty and it all seems ok now.

Thanks for your help.

Gilberto Garcia

unread,
Oct 26, 2011, 1:12:48 AM10/26/11
to lif...@googlegroups.com
Hi David,

As I said earlier, I'm running jetty 8 already.
After upgrading lift to 2.4-M4 the NPE is gone.

Thanks

Diego Medina

unread,
Oct 26, 2011, 2:11:19 PM10/26/11
to lif...@googlegroups.com

Great!

Diego
Sent from my android cell

Francois

unread,
Oct 28, 2011, 4:15:02 AM10/28/11
to lif...@googlegroups.com, David Pollak
On 26/10/2011 06:21, David Pollak wrote:


On Tue, Oct 25, 2011 at 1:00 PM, Gilberto Garcia <giba...@gmail.com> wrote:
Hi Diego,

Thanks for you reply.

1 - Both times from maven
2 - I can see the NPE after deploying the war file to my container
(jetty 8). I get no NPE when I start it in dev mode.
3 - I think I'm running Lift 2.4-M3 but I'll double check it, and I'll
upgrade it if that's the case.

This is a bug in Jetty... it's come up on the list from time to time.  Please upgrade to Jetty 7 or 8.
 


We just encounter that bug too, with Lift 2.4-M3 on a Jetty 7.2.2 and a 8.0.1 version.
That was on both development mode and production mode, happened on a comet request, and seems to be related to a high server load.
We didn't success in reproducing it though, and so that mail don't bring much more information...

-- 
Francois ARMAND
http://fanf42.blogspot.com
http://www.normation.com

Antonio Salazar Cardozo

unread,
Oct 29, 2011, 2:15:52 PM10/29/11
to lif...@googlegroups.com, David Pollak
Yes, this is a problem we've run into as well. Nothing we've tried, including different jetty versions, has worked. We're going to be trying switching to Glassfish over the next week or two in hopes that that will eliminate the problem (and not introduce any new ones). We'll report back after we've run this setup under sufficiently high load.
Thanks,
Antonio

Sergey Trofimov

unread,
Nov 17, 2011, 3:35:17 PM11/17/11
to lif...@googlegroups.com, David Pollak
Antonio, any success with Glassfish?

We've just launched new project in production mode under jetty 6 on debian and application goes in unstable state in several hours after producing enormous amount of NPE in log :-( I'm frustrated and not sure what to try in first...

--
Sergey

Gilberto Garcia

unread,
Nov 17, 2011, 8:25:13 PM11/17/11
to lif...@googlegroups.com, David Pollak
I've changed to jetty 7.5.4 and things are running smoothly.

Didn't try glassfish

cheers

Sergey Trofimov

unread,
Nov 23, 2011, 12:42:08 AM11/23/11
to lif...@googlegroups.com, David Pollak
Well, as I found such exceptions could occur in case of insufficient JVM memory settings.
At least after tuning of memory and GC settings my problems with exceptions gone.
Even on Jetty 6.


--
Sergey Trofimov


Antonio Salazar Cardozo

unread,
Nov 23, 2011, 1:48:32 PM11/23/11
to lif...@googlegroups.com, David Pollak
Sorry for the lack of reply; I haven't posted an update yet, but Glassfish was a bit of wash. We ended up with some serious issues with leaking file descriptors that required a server restart about once a day, and switched back to Jetty 6 until we have a chance to try again with Jetty 7.
Thanks,
Antonio

David Pollak

unread,
Nov 28, 2011, 12:39:42 PM11/28/11
to lif...@googlegroups.com
Antonio,

Please open a ticket on this issue with the full stack trace for the Jetty NPE, assign it to me, and I'll try to work around the Jetty issue.

Sigh.

David
--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net

Jakub Czuchnowski

unread,
Dec 8, 2011, 6:40:45 PM12/8/11
to lif...@googlegroups.com
Hi all,

I had the same problem with Jetty 7.5 and 8.0. I just tried the new 7.6.0.RC1 and it seem to work. With 7.5 I got the exception after few minutes from start, but my 7.6 has been running for few hours now with no exception. 
Jetty team resolved some issues with server not closing connections. I am guessing here but maybe this was the problem:

--
Jakub

Everson Alves da Silva

unread,
Dec 9, 2011, 10:35:59 AM12/9/11
to lif...@googlegroups.com
I was getting NPE exceptions after migrating to jetty "8.0.4.v20111024" with Lift 2.4M4 and 2.4M5. Switched to "7.3.0.v20110203" and it's fine so far.

David Pollak

unread,
Dec 12, 2011, 4:14:32 PM12/12/11
to lif...@googlegroups.com
Apparently, this issue is caused by the request being terminated by the client.  Jetty does some cleanup when it loses the NIO connection.  There's nothing that tells Lift that the request is terminated and when Lift accesses certain resources, the NPE happens.

The kind folks at OpenStudy will open a ticket on this issue and I'll work on a better error message.

On Fri, Dec 9, 2011 at 7:35 AM, Everson Alves da Silva <khro...@gmail.com> wrote:
I was getting NPE exceptions after migrating to jetty "8.0.4.v20111024" with Lift 2.4M4 and 2.4M5. Switched to "7.3.0.v20110203" and it's fine so far.

--



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net

Antonio Salazar Cardozo

unread,
Dec 13, 2011, 12:49:46 PM12/13/11
to lif...@googlegroups.com
Heh. Thanks for the reminder/subtle kick in the behind ;) I'll get that ticket opened up and a blog post up with more details on our adventures by tomorrow.
Thanks,
Antonio

Antonio Salazar Cardozo

unread,
Dec 15, 2011, 2:22:31 PM12/15/11
to lif...@googlegroups.com

David Pollak

unread,
Dec 15, 2011, 2:32:43 PM12/15/11
to lif...@googlegroups.com
Thanks!  This is super-helpful.

On Thu, Dec 15, 2011 at 11:22 AM, Antonio Salazar Cardozo <savedf...@gmail.com> wrote:

--

Gilberto Garcia

unread,
Dec 15, 2011, 6:32:07 PM12/15/11
to lif...@googlegroups.com
Well done :D
Reply all
Reply to author
Forward
0 new messages