No such file or directory

158 views
Skip to first unread message

Vijay Kandy

unread,
Apr 20, 2011, 9:45:38 PM4/20/11
to scalatra-user
Hello,

I just started a simple exercise based on prototype application. The
prototype runs well with sbt and jetty. However, if its packaged as a
war and deployed in Tomcat, I keep getting this exception:

20-Apr-2011 7:34:25 PM org.apache.catalina.core.StandardContext
filterStart
SEVERE: Exception starting filter scalatra
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1716)
at java.io.File.createTempFile(File.java:1804)
at java.io.File.createTempFile(File.java:1840)
at
org.fusesource.scalate.TemplateEngine.workingDirectory(TemplateEngine.scala:
240)
at
org.fusesource.scalate.servlet.ServletTemplateEngine.<init>(ServletTemplateEngine.scala:
108)
at org.scalatra.scalate.ScalateSupport$$anon
$2.<init>(ScalateSupport.scala:28)
at org.scalatra.scalate.ScalateSupport
$class.createTemplateEngine(ScalateSupport.scala:28)
at
com.ksi.lf.web.filter.MyScalatraFilter.createTemplateEngine(MyScalatraFilter.scala:
14)
at org.scalatra.scalate.ScalateSupport
$class.initialize(ScalateSupport.scala:20)
at
com.ksi.lf.web.filter.MyScalatraFilter.initialize(MyScalatraFilter.scala:
14)
at
com.ksi.lf.web.filter.MyScalatraFilter.initialize(MyScalatraFilter.scala:
14)
at org.scalatra.ScalatraFilter$class.init(ScalatraFilter.scala:33)
at com.ksi.lf.web.filter.MyScalatraFilter.init(MyScalatraFilter.scala:
14)

Has anyone run into this issue? I tried to change the temp directory
like so in the filter:

before {
contentType = "text/html"
templateEngine.workingDirectory = new File("~/tmp")
}

That still throws same exception. What am I doing wrong? Please
advise.

Regards,
Vijay

Ross A. Baker

unread,
Apr 20, 2011, 11:27:12 PM4/20/11
to scalat...@googlegroups.com
The before filter doesn't work because the template engine is
initialized in the constructor. You can set Scalate's working
directory with the scalate.workdir system property.

As for why it doesn't work out of the box, my only guess is that you
have an odd setting for the java.io.tempdir system property in Tomcat.
Scalate's default is based on that.

--
Ross A. Baker
ba...@alumni.indiana.edu
Indianapolis, IN, USA

Vijay Kandy

unread,
Apr 22, 2011, 12:10:41 AM4/22/11
to scalatra-user
Thanks Ross. That worked.

Regards,
Vijay
Reply all
Reply to author
Forward
0 new messages