Friday, November 07, 2008

Fatal Error in the logs by Grails

I recently started working on a project using Grails and the following message in the logs appeared consistently and annoyed me quite a lot.

[Fatal Error] :-1:-1: Premature end of file.

So I started digging through the code and searching the web for an answer. And I found it. It is a bug that has been reported to Grails and you can find it at GRAILS-3088. It apparently affects Grails 1.0.3 (which I am using) and it should be fixed in next release, 1.0.4.

The bug is triggered with each request from Firefox 3 and Opera 9.5 and even Firefox 2 if you render the response as "text/xml" using

withFormat { xml { render(contentType:"text/xml"){ ... } } }

The current workaround suggested by Graeme Rocher is to edit Config.groovy file and remove (or comment out) "text/xml" from the Grails MIME types mapping

grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
// xml: ['text/xml', 'application/xml'],
text: 'text-plain',

This works for me. No more annoying messages in the logs. I am not quite sure how or if it affects XML responses. But I do not need those for now, so I will worry about that later, if I need to

1 comment:

Unknown said...

The side effect of this fix is that Grails won't do its magic to respond to text/xml and application/xml in the HTTP Accept request header.

Looks like it's been fixed for 1.0.4 though.


Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.