错误:“文件过早结束。”在jsp页面上

时间:2018-08-21 14:26:09

标签: xml jsp jstl

以下代码引发错误:

<c:set var="product" value='<%= request.getAttribute("jaxbString")%>'></c:set><c:import var="xsl" url="<%= ConstantManager.xslProduct%>" charEncoding="UTF-8"></c:import>                            
<x:transform doc="${product}" xslt="${xsl}"></x:transform>

以及日志文件上的错误:
文件1:输出文件-错误详细信息

> ERROR:  'Premature end of file.'
>     ERROR:  'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:

Premature end of file.'

File 2: Log file - Exception Detail

> 21-Aug-2018 20:57:19.151 SEVERE [http-nio-8084-exec-199] 
> org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service()
> for servlet [ProcessServlet] in context with path [/XMLProjectVer2] threw exception [javax.servlet.ServletException:
> javax.servlet.jsp.JspException:
> javax.xml.transform.TransformerException:
> javax.xml.transform.TransformerException:
> com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:
> Premature end of file.] with root cause
>      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Premature end of file.
>       at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:464)
>       at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:252)
>       at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:565)
>       at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:748)
>       at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:359)
>       at org.apache.taglibs.standard.tag.common.xml.TransformSupport.doEndTag(TransformSupport.java:237)
>       at org.apache.jsp.MainPage_jsp._jspx_meth_x_005ftransform_005f0(MainPage_jsp.java:406)
>       at org.apache.jsp.MainPage_jsp._jspService(MainPage_jsp.java:321)
>       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
>       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
>       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
>       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
>       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
>       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
>       at sample.servlet.GetProductServlet.processRequest(GetProductServlet.java:62)
>       at sample.servlet.GetProductServlet.doGet(GetProductServlet.java:84)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
>       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
>       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
>       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
>       at sample.servlet.SetCateServlet.processRequest(SetCateServlet.java:51)
>       at sample.servlet.SetCateServlet.doGet(SetCateServlet.java:72)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
>       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
>       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
>       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
>       at sample.servlet.ProcessServlet.processRequest(ProcessServlet.java:51)
>       at sample.servlet.ProcessServlet.doGet(ProcessServlet.java:68)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
>       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
>       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
>       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
>       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>       at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
>       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
>       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
>       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
>       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
>       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
>       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>       at java.lang.Thread.run(Thread.java:745)
> 

请帮助找出原因和解决方法

1 个答案:

答案 0 :(得分:0)

您正在使用相同的变量来回传输。只需更改变量