我安装tomcat之后,打http://localhost:8080可以看到tomcat的欢迎页面。但是老是不能打开自己的jsp测试页面,打http://localhost:8080/jsp-examples/jsp2/test.jsp时老实提示:
type 异 常 报 告
信 息
描 述 服务器遇到内部错误,无法满足这个访问请求
异 常
org.apache.jasper.JasperException: 无法编译JSP
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
起 因
org.apache.jasper.JasperException: 无法编译JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:572)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
起 因
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
org.apache.jasper.xmlparser.UTF8Reader.invalidByte(UTF8Reader.java:620)
org.apache.jasper.xmlparser.UTF8Reader.read(UTF8Reader.java:491)
org.apache.jasper.xmlparser.XMLEncodingDetector.load(XMLEncodingDetector.java:999)
org.apache.jasper.xmlparser.XMLEncodingDetector.skipString(XMLEncodingDetector.java:950)
org.apache.jasper.xmlparser.XMLEncodingDetector.scanXMLDecl(XMLEncodingDetector.java:1208)
org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:120)
org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:108)
org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:304)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:169)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
注 意 完整的起因在Apache Tomcat/5.5.20里。
大家帮忙看看是怎么回事,最好给个解决方法.先谢谢了!
------解决方案--------------------
这个问题是由于数据源的XML文件中有非法字符的引起的。具体Exception为:java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence。找出无效字符的来源是一个极富挑战的侦探工作,特别是这些字符也许在通常的检测中都是很正常的。可以尝试修改xml的encode例如将 <?xml version= "1.0 " encoding= "utf-8 "?> 修改为 <?xml version= "1.0 " encoding= "iso-8859-1 "?>
__________________________________
J2EE技术交流QQ群:6890959
欢迎大家一起来切磋交流..
共同进步..
------解决方案--------------------