ricardojmendez/grails-imagetools — Issue #6: ImageTool.load() fails in war
Author: mackeyma
Created: 2011-11-26 23:30:21+00:00
State: open

Hi,

Thanks for the ImageTools plugin!

I have been trying to use the image-tools plugin in my grails application. It works as expected when running in InteliJ or under 'grails run-app' but is failing when I deploy it as a war in Tomcat.

I have been persisting the image files to the database (it fails for both hSQLdb and PostgreSQ data sources)/ The problems occurs when I create and image from the stored byte [] object in production.

I have made s small test app that demonstrates the problem.

domain class:

class Image {
byte [] img
static constraints = {
}
}

controller:

class ImageController {
...
...
...

def getImageThumbnail = {
def imageInstance = Image.get(params.id)

def imageTool = new ImageTool()

println "starting load"
imageTool.load(imageInstance.img)
println "done!"

imageTool.thumbnail(55)
def thumbImage = imageTool.getBytes("JPEG")

response.contentType = "image/jpeg"
response.contentLength = thumbImage.length
response.outputStream << thumbImage
}

(I have trimmed things down to the bare essentials here)

the point is the getImageThumbnail action works fine in development, but fails when I build a war and deploy it in Tomcat.

I don't think it is the Tomcat config - my other web apps and other aspects of the app work fine, but the getImageThumbnail action fails at the ImageTool.load call. In other words the output to the log file is the single line
'starting load' and the app hangs

What am I doing wrong?

Mike