【问题标题】:org.xml.sax.SAXParseException: Premature end of file with birt 2.3.2 and firefox 15org.xml.sax.SAXParseException:使用 birt 2.3.2 和 firefox 15 的文件过早结束
【发布时间】:2012-10-05 14:30:16
【问题描述】:

我们使用的是 Birt 2.3.2。 我们尝试在 Firefox 15.0.1 中打开我们的报告,我们得到了异常“org.xml.sax.SAXParseException: Premature end of file”而没有堆栈跟踪。

我们尝试调试它,发现 Firefox 发送的内容类型错误。当我使用 Tamper Data 插件修改请求标头时,它起作用了。

发送的请求是

POST <<URL>> 
Request Headers:
Host[<<MYHOST>>]
User-Agent[Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[en-us,en;q=0.5]
Accept-Encoding[gzip, deflate]
Connection[keep-alive]
Content-Length[1702]
Content-Type[application/x-www-form-urlencoded]
Referer[<<URL>>]
request-type[SOAP]
SOAPAction[""]
X-Prototype-Version[1.4.0]
X-Requested-With[XMLHttpRequest]
Cookie[JSESSIONID=A5E874082FE87F814F32B103EE864EBF.]
Pragma[no-cache]
Cache-Control[no-cache]
Post Data:
POST_DATA[<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><<SOAPBODY>></soap:Body></soap:Envelope>]
Response Headers:
Server[Apache-Coyote/1.1]
X-Powered-By[Servlet 2.5; JBoss-5.0/JBossWeb-2.1]
Content-Type[text/xml;charset=utf-8]
Transfer-Encoding[chunked]
Date[Fri, 28 Sep 2012 00:05:39 GMT]
Connection[close]

当我们修改Content-Type为text/xml时; charset=UTF-8,它起作用了

它也适用于 chrome 和 IE,有时它适用于 FF,但在我们重新启动 FF 后再次出现问题。

有办法解决吗?

On server we are getting following exception

jvm 1    | java.io.CharConversionException: isHexDigit
jvm 1    |      at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
jvm 1    |      at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
jvm 1    |      at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:429)
jvm 1    |      at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:412)
jvm 1    |      at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:363)
jvm 1    |      at org.apache.catalina.connector.Request.parseParameters(Request.java:2562)
jvm 1    |      at org.apache.catalina.connector.Request.getParameterNames(Request.java:1102)
jvm 1    |      at org.apache.catalina.connector.Request.getParameterMap(Request.java:1082)
jvm 1    |      at org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:414)
jvm 1    |      at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:196)
jvm 1    |      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
jvm 1    |      at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
jvm 1    |      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
jvm 1    |      at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
jvm 1    |      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
jvm 1    |      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

【问题讨论】:

    标签: birt


    【解决方案1】:

    如果您从 servlet 使用引擎,请确保在响应中设置内容类型:

    response.setContentType("text/html");

    【讨论】:

      【解决方案2】:

      我相信这是一个已知的错误,称为 listed on Eclipse bug list

      看评论#6:

      解决方法是注释掉 webcontent/birt/ajax/lib/prototype.js 的第 668 和 669 行

      在注释掉这些行之前,Chrome 会将 Content-type 发送为“application/x-www-form-urlencoded, text/xml; charset=UTF-8”,这会导致异常。

      在注释掉这些行之后,Chrome 会像其他行为良好的浏览器一样发送 Content-type 为“text/xml; charset=UTF-8” :)

      BIRT 报告附带的prototype.js 似乎相当陈旧,因为这部分代码已在4 多年前的1.5.0_rc0 版本中进行了修改

      【讨论】:

        猜你喜欢
        • 2011-08-19
        • 1970-01-01
        • 2012-06-22
        • 1970-01-01
        • 2018-11-02
        • 1970-01-01
        • 2018-12-10
        相关资源
        最近更新 更多