Hi,
I was trying to use the ClassResources to load a configuration file for my application. I’ve placed the app.config.xml file in the same package as my application main. Here is a section of Scala code:
application = app
resource = new ClassResource("app.config.xml",application)
debug("resource mimeType = {}",resource.getMIMEType)
debug("resource bufferSize = {}", resource.getBufferSize)
debug("resource cacheTime = {}",resource.getCacheTime)
debug("resource fileName = {}", resource.getFilename)
if (resource.getStream != null) {
// get the java InputStream
val is = resource.getStream.getStream
if (is != null) {
is.reset
if (Source.fromInputStream(is).nonEmpty) {
debug("resource stream = {}", Source.fromInputStream(is).mkString)
} else {
debug("stream is empty")
}
} else {
debug("Input stream was null")
}
} else {
debug("Download stream was null")
}
When I deploy to the Apache server and the code executes, I get the following debug output:
01:20:07.221 [http-8084-3]
DEBUG c.s.app.Configuration$ - resource mimeType = text/xml
01:20:07.226 [http-8084-3]
DEBUG c.s.app.Configuration$ - resource bufferSize = 0
01:20:07.228 [http-8084-3]
DEBUG c.s.app.Configuration$ - resource cacheTime = 86400000
01:20:07.228 [http-8084-3]
DEBUG c.s.app.Configuration$ - resource fileName = app.config.xml
01:20:07.230 [http-8084-3]
DEBUG c.s.app.Configuration$ - Input stream was null
So, it seems like the file is not being found. Can someone help me understand what’s going wrong?
Thanks,
John