Grails

Premature end of file

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.3
  • Fix Version/s: 1.0.4
  • Component/s: None
  • Labels:
    None
  • Environment:
    jdk6u10

Description

run the application created and browse the main page.

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

see the attached app.

Thanks,
Daniel.Sun

D:\_DEV\grails_apps\Grails103>grails run-app

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:\D\MY_DEV\grails-1.0.3

Base Directory: D:\_DEV\grails_apps\Grails103
Note: No plugin scripts found
Running script D:\D\MY_DEV\grails-1.0.3\scripts\RunApp.groovy
Environment set to development
  [groovyc] Compiling 1 source file to C:\Documents and Settings\Daniel\.grails\1.0.3\projects\Grail
s103\classes
     [copy] Copying 1 file to C:\Documents and Settings\Daniel\.grails\1.0.3\projects\Grails103
Running Grails application..
2008-06-10 21:49:55.631::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2008-06-10 21:49:55.787::INFO:  jetty-6.1.4
2008-06-10 21:49:56.06::INFO:  No Transaction manager found - if your webapp requires one, please co
nfigure one.
2008-06-10 21:49:56.428:/Grails103:INFO:  Set web app root system property: 'Grails103-development-0
.1' = [D:\_DEV\grails_apps\Grails103\web-app\]
2008-06-10 21:49:56.428:/Grails103:INFO:  Initializing log4j from [file:C:\Documents and Settings\Da
niel/.grails/1.0.3/projects/Grails103/resources/log4j.properties]
2008-06-10 21:49:56.459:/Grails103:INFO:  Initializing Spring root WebApplicationContext
[0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWe
bApplicationContext@1364ee5: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplic
ationContext@1364ee5]; startup date [Tue Jun 10 21:49:59 CST 2008]; parent: org.springframework.web.
context.support.XmlWebApplicationContext@177ab84
[0] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.gra
ils.commons.spring.GrailsWebApplicationContext@1364ee5]: org.springframework.beans.factory.support.D
efaultListableBeanFactory@b0c5a
2008-06-10 21:50:03.050:/Grails103:INFO:  Initializing Spring FrameworkServlet 'grails'
2008-06-10 21:50:03.126::INFO:  Started SelectChannelConnector@0.0.0.0:8080
Server running. Browse to http://localhost:8080/Grails103
2008-06-10 21:50:10.296:/Grails103:INFO:  GSP servlet initialized
[Fatal Error] :-1:-1: Premature end of file.

Activity

Hide
Graeme Rocher added a comment -

Yes its related to usage of firefox 3, we will fix it soon, the error doesn't occur in other browsers

Show
Graeme Rocher added a comment - Yes its related to usage of firefox 3, we will fix it soon, the error doesn't occur in other browsers
Hide
Daniel.Sun added a comment -

You're right, Graeme.

I tested the toy app with other browsers, no such an error occurred

Cheers,
Daniel.Sun

Show
Daniel.Sun added a comment - You're right, Graeme. I tested the toy app with other browsers, no such an error occurred Cheers, Daniel.Sun
Hide
Mase Warner added a comment -

After FF3 Day this is now a big problem for me

Show
Mase Warner added a comment - After FF3 Day this is now a big problem for me
Hide
Graeme Rocher added a comment -

Mase - a workaround is to remove "xml" from the list of mime types:

grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
xml: ['text/xml', 'application/xml'], <--- REMOVE THIS LINE
...

Show
Graeme Rocher added a comment - Mase - a workaround is to remove "xml" from the list of mime types: grails.mime.types = [ html: ['text/html','application/xhtml+xml'], xml: ['text/xml', 'application/xml'], <--- REMOVE THIS LINE ...
Hide
Mase Warner added a comment -

Thanks Graeme, seems to fix the problem for now.

Show
Mase Warner added a comment - Thanks Graeme, seems to fix the problem for now.
Hide
Mase Warner added a comment -

One more issue is that when you comment out the xml line workaround - you then break IE6 so it no longer works.

Show
Mase Warner added a comment - One more issue is that when you comment out the xml line workaround - you then break IE6 so it no longer works.
Hide
Graeme Rocher added a comment -

No longer works in what way? It should have no effect

Show
Graeme Rocher added a comment - No longer works in what way? It should have no effect
Hide
Tomas Lin added a comment -

Please note that the withFormat tag will always render an xml file, rather than the HTML file, even when the XML line is removed. We have to set the format=html or add the .html extension to see our GSP pages

Firefox sends a header as

text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

My hunch is that the parsing of this request header is being processed as

text/html - 0
application/xhtml+xml - 0
application/xml - 0.9

which automatically gives xml precedence over any other defined types.

Show
Tomas Lin added a comment - Please note that the withFormat tag will always render an xml file, rather than the HTML file, even when the XML line is removed. We have to set the format=html or add the .html extension to see our GSP pages Firefox sends a header as text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 My hunch is that the parsing of this request header is being processed as text/html - 0 application/xhtml+xml - 0 application/xml - 0.9 which automatically gives xml precedence over any other defined types.
Hide
Steve Tekell added a comment -

not just Firefox 3

I get this with Firefox/2.0.0.14 (Linux)
Not on every page, but when displaying XML.

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

Show
Steve Tekell added a comment - not just Firefox 3 I get this with Firefox/2.0.0.14 (Linux) Not on every page, but when displaying XML. I am using withFormat { xml { render(contentType:"text/xml"){ ... } } }
Hide
Hank Gay added a comment -

This error also appears with Opera 9.5 on every page I've tested.

Show
Hank Gay added a comment - This error also appears with Opera 9.5 on every page I've tested.
Hide
Graeme Rocher added a comment -

Fixed

Show
Graeme Rocher added a comment - Fixed
Hide
Graeme Rocher added a comment -

Just a few implementation notes. We were defaulting to a q value of 0, which is incorrect according to the spec. So we now default to 1.0 which gives the correct precedence order in Firefox 3, but incorrect in Firefox 2. However, more specific XML types like application/xhtml+xml now take precendence over less specific ones if they have the same q value so this fixes the issue in Firefox 2.

If others have problems in different browsers please open separate issues.

Show
Graeme Rocher added a comment - Just a few implementation notes. We were defaulting to a q value of 0, which is incorrect according to the spec. So we now default to 1.0 which gives the correct precedence order in Firefox 3, but incorrect in Firefox 2. However, more specific XML types like application/xhtml+xml now take precendence over less specific ones if they have the same q value so this fixes the issue in Firefox 2. If others have problems in different browsers please open separate issues.
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (14)
Watch (16)

Dates

  • Created:
    Updated:
    Resolved: