Comet4j 报错500 :json转换错误 解决方式

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/pea378/article/details/69945478

将server.xml中的连接器配置替换

<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

改为

 <Connector URIEncoding="UTF8" connectionTimeout="20000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>


如果还有错误,检查自己的tomcat版本和comet4j-tomcat7.jar或者comet4j-tomcat6.jar是不是对应的。

展开阅读全文

500 错误

11-05

HTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Unable to compile class for JSP: rnrnAn error occurred at line: 7 in the generated java filernSyntax error on token "import", delete this tokenrnrnAn error occurred at line: 39 in the jsp file: /addMessageHandler.jsprnThe method lookup(String) is undefined for the type Stringrn36: request.getParameter("content");rn37: rn38: Context initContext = new InitialContext();rn39: Context envCtx = (Context)context.lookup("java:comp/env");rn40: DataSource ds = (DataSource)envCtx.lookup("jdbc/sqlserver");rn41: QueryRunner qr = new QueryRunner(ds);rn42: result = qr.update(sql, param);rnrnrnAn error occurred at line: 61 in the jsp file: /addMessageHandler.jsprnSyntax error, insert "Finally" to complete BlockStatementsrn58: <%rn59: rn60: rn61: rn62: %>rn63: rn64: <%@include file="/footer.html"%>rnrnrnAn error occurred at line: 177 in the generated java filernSyntax error, insert "" to complete BlockrnrnAn error occurred at line: 187 in the generated java filernSyntax error on token "", delete this tokenrnrnAn error occurred at line: 188 in the generated java filernSyntax error, insert "" to complete ClassBodyrnrnStacktrace:rn org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)rn org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)rn org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.rn 什么意思 ?rnrn一下是提交后源文件rnrnrn<%@ page language="java" pageEncoding="gb2312"%>rn<%@ page import="java.io.IOException,import java.io.PrintWriter,java.sql.*,javax.naming.*,javax.servlet.ServletException,javax.servlet.http.*,javax.sql.DataSource"%>rn<%@ page import="org.apache.commons.dbutils.*" %>rn<%@ page import="com.v512.guestbook.*"%>rn<%@ include file="/header.jsp"%>rn rn<% rn String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433"; rn String username = "aa"; rn String password = "bb"; rn String sql = "insert into guest(name,phone,email,title,content)values(?,?,?,?,?)"; rn int result = 0; rn rn request.setCharacterEncoding("gb2312"); rn String name = request.getParameter("name"); rn String title = request.getParameter("title"); rn rn rn if (StringUtil.validateNull(name)) rn%>rnrn对不起,用户名不能为空,请重新输入!rn添加留言 rn<%rn else if (StringUtil.validateNull(title)) rn%>rn对不起,主题不能为空,请重新输入!rn添加留言 rn rn <% rn else rn try rn rn String param[] = StringUtil.filterHtml(name), StringUtil.filterHtml(request.getParameter("email")),rn StringUtil.filterHtml(request.getParameter("phone")), StringUtil.filterHtml(title),rn request.getParameter("content");rnrn Context initContext = new InitialContext();rn Context envCtx = (Context)context.lookup("java:comp/env");rn DataSource ds = (DataSource)envCtx.lookup("jdbc/sqlserver");rn QueryRunner qr = new QueryRunner(ds);rn result = qr.update(sql, param);rnrn rn if (result == 0) %>rn对不起,用户不能为空,请重新输入!rn添加留言 rn rnrn<% rn else rn%>rn恭喜添加成功!rn查看留言 rn rnrnrn<%rn rnrn rn%>rnrn<%@include file="/footer.html"%>rnrnrnrnrn 论坛

错误500

01-12

HTTP Status 500 - An exception occurred processing JSP page /displayBlog.jsp at line 32rnrntype Exception reportrnrnmessage An exception occurred processing JSP page /displayBlog.jsp at line 32rnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexceptionrnrnorg.apache.jasper.JasperException: An exception occurred processing JSP page /displayBlog.jsp at line 32rnrn29: rn30: rn31: rn32: <% for(int i=0;irn35: rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn lvjianyu.blog.GetBlogServlet.doGet(GetBlogServlet.java:43)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:621)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rnroot causernrnjava.lang.NullPointerExceptionrn org.apache.jsp.displayBlog_jsp._jspService(displayBlog_jsp.java:104)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn lvjianyu.blog.GetBlogServlet.doGet(GetBlogServlet.java:43)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:621)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rnrnrn应该怎么改啊! 论坛

没有更多推荐了,返回首页