ricardojmendez / grails-imagetools

Basic image tools plugin for Grails based on JAI. CURRENTLY UNSUPPORTED, since I haven't used it myself in years. You're welcome to take over it.

Home Page:http://www.grails.org/ImageTools+plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImageTool.load() fails in war

opened this issue · comments

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

Resolved this problem, at least for now.
This turned out to be a problem with the commons daemon jsvc on Mac OS/X Lion
Now I am running Tomcat using the startup.sh/ shutdown.sh scripts and everything is fine. This is strange, because everything else was working fine in the webapp besides the imagetools plugin.
Don't have any more time to spend on this now.

Other details:
Mac OS/X Lion / grails 1.3.7
Tomcat V. 7.0.21
Postgresql 9.0.4

jsvc and jni binaries built without issue in x86_64.
I also tried using the jai calls from the plugin source and, as before, everything
worked fiun except when running in a tomcat instance started by jsvc.

closed this issue as it was not due to a problem with the image-tools plugin