Javascript and CSS files results in 404 Not Found, after one week

1,035 views
Skip to first unread message

KajMagnus

unread,
Jan 17, 2012, 7:24:43 PM1/17/12
to Lift
Hi

I have a server up and running, and always after 1 or 2 weeks uptime,
LiftWeb says:
"The Requested URL /classpath/0/js/debiki.js was not found on this
server"
for requests for Javascript and CSS files.

The first 1 or 2 weeks the server functions fine, and it starts to
work again (that is, find .js and .css files) after restart.

Do you know what could the problem be? Or how I can troubleshoot it?
(I've found nothing unusual in the log files, except for status code
404 Not Found not 200 OK suddenly being returned.)

(Since the server works fine the first 1 or 2 weeks, and since I think
that requests for .js and .css is not handled by my own code, it feels
to me that this is something happening inside Lift-Web.
Requests for html pages always continue to work as intended, returns
status 200 OK and html.
Even when all requests like: http://server/classpath/file.js
and ..../file.css results in status 404 (Not
Found).)

Best regards, KajMagnus

David Pollak

unread,
Jan 17, 2012, 7:30:20 PM1/17/12
to lif...@googlegroups.com
What kind of container are you using?

If it's Jetty, there's a wacky thing that Jetty does... it unpacks WAR files into the /tmp directory and if you've got a cron job that cleans up files in the /tmp directory, those files may be getting cleaned out.

Also, why are you serving them via /classpath?  Why not just make them static files in the WAR?


--
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



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


KajMagnus

unread,
Jan 17, 2012, 8:02:03 PM1/17/12
to Lift
Hi David

On Jan 18, 1:30 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> What kind of container are you using?

Jetty

> If it's Jetty, there's a wacky thing that Jetty does... it unpacks WAR
> files into the /tmp directory and if you've got a cron job that cleans up
> files in the /tmp directory, those files may be getting cleaned out.

`crontab -l' lists no jobs -- but I'll remember to check whether or
not
the files are present in /tmp/ the next time the problem happens.
(Perhaps they get deleted for some other reason)

> Also, why are you serving them via /classpath?  Why not just make them
> static files in the WAR?

The files reside in a `core' module that is supposed to be fairly
framework
independent. I include it in my `app-liftweb' project, hence the /
classpath/
path. (The main WAR project, `app-liftweb', is actually an almost
empty SBT
project that only provides a tiny Boot class, and includes various
other
modules)

Thanks for your help

Best regards, KajMagnus
> Visi.Pro, Cloud Computing for the Rest of Ushttp://visi.pro
> Lift, the simply functional web frameworkhttp://liftweb.net

Olek Swirski

unread,
Jan 17, 2012, 8:29:09 PM1/17/12
to lif...@googlegroups.com
I think, if your app is indeed unpacked into the tmp directory, this can
be the problem. Jetty does this by default. You can change that in the
jetty configuration for your app.

To override this default seting edit jetty/contexts/yourapp.xml
by adding line like this:
<Set name="tempDirectory">/some/other/directory/instead/of/default/tmp</Set>
in the section below
<!-- Optional context configuration -->

KajMagnus

unread,
Jan 17, 2012, 10:53:43 PM1/17/12
to Lift
Hi Olek

Okay thanks. I added a note in my deployment script that I change the
Jetty <Set name="tempDirectory"> configuration option the next time I
deploy my app.

I'll try to remember to update this email thread and tell you what
happened.
(That won't happen until after some weeks though -- I think I should
keep the website up and running a few weeks to know for sure that the
problem is gone)

Best regards, KajMagnus

KajMagnus

unread,
Jan 31, 2012, 6:16:12 AM1/31/12
to Lift
Hi again David and Olek

The reason my webapp started replying 404 Not Found, was indeed that
the Jetty WAR had been deleted from /tmp/. I don't know how it's
getting deleted (I've found no cron job)
but now I've moved it elsewhere anyway.

Thanks!

Regards, KajMagnus

Olek Swirski

unread,
Jan 31, 2012, 7:55:22 PM1/31/12
to lif...@googlegroups.com
pretty much anything can clear /tmp
it's temporary storage

fmpwizard

unread,
Jun 22, 2013, 11:53:23 PM6/22/13
to lif...@googlegroups.com
I know this is a very old thread and we don't like when people post on old email threads but this may be a good exception to the rule:

It turns out that you can simply create a folder named    work   in the jetty directory and then jetty will not use /tmp, but instead the this new folder

(for those that did not get the original thread, it is
 )

jetty 6 doc with this info

Thanks

  Diego

Richard Dallaway

unread,
Jun 24, 2013, 7:04:52 AM6/24/13
to liftweb
I've taken this and used it as the first entry in a page of hints about Jetty: https://www.assembla.com/spaces/liftweb/wiki/Jetty

( Along the same lines as we have a page about Tomcat gotchas: https://www.assembla.com/spaces/liftweb/wiki/Tomcat )


--
--
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
 
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Diego Medina

unread,
Jun 24, 2013, 7:32:26 AM6/24/13
to Lift
thanks!
--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://fmpwizard.telegr.am
Reply all
Reply to author
Forward
0 new messages