I have tested a play 2.3.4 app, and in the console it complains the following:
! @6jg7imio5 - Internal server error, for (GET) [/favicon.ico] ->
play.api.Application$$anon$1: Execution exception[[NoSuchElementException: key not found: favicon.ico]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.10-2.3.0.jar:2.3.0]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.10-2.3.0.jar:2.3.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.10-2.3.0.jar:2.3.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.10-2.3.0.jar:2.3.0]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [scala-library.jar:na]
Caused by: java.util.NoSuchElementException: key not found: favicon.ico
at scala.collection.MapLike$class.default(MapLike.scala:228) ~[scala-library.jar:na]
at scala.collection.AbstractMap.default(Map.scala:58) ~[scala-library.jar:na]
at scala.collection.MapLike$class.apply(MapLike.scala:141) ~[scala-library.jar:na]
at scala.collection.AbstractMap.apply(Map.scala:58) ~[scala-library.jar:na]
at controllers.Application$$anonfun$list$1$$anonfun$apply$7$$anonfun$apply$8.apply(Application.scala:68) ~[classes/:2.3.0]
Then I searched all the source code and can't find anywhere used favicon.ico. Is it used in some library?
The library I used in slick. The library configuration is as below:
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-slick" % "0.7.0",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"joda-time" % "joda-time" % "2.3",
"org.joda" % "joda-convert" % "1.5",
"com.github.tototoshi" %% "slick-joda-mapper" % "1.1.0",
jdbc,
anorm
)
UPDATE:
oracle@SomeHost ~/activator-1.2.10/abb_web_1/public $ tree
.
├── images
│ └── favicon.ico
├── javascripts
│ ├── forms.js
│ └── jquery.js
└── stylesheets
├── bootstrap.min.css
└── main.css
In the route file, I added the following per biesior's reply. But it still complain the same error.Did I put the favicon.ico on the wrong place?
GET /favicon.ico controllers.Assets.at(path="/public", file="favicon.ico")
you should denote the path as controllers.Assets.at(path="/public/images", file="favicon.ico")
Could you be missing the link in your HTML?
Every browser looks for
favicon.ico
when visiting the address. Just add that file to yourpublic
folder and add a route:TIP: it can be also png file - in default new PlayJava or PlayScala project it can be found in
public/images/favicon.png