SEVERE: Servlet.service() for servlet default threw exception java.lang.StackOve linux服务器ssh项目日志 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有可能是验证码的问题 <%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*,java.text.*,com.cloudsoar3c.tools.*" pageEncoding="utf-8"%><%@page import="java.io.OutputStream"%><%@page import="java.awt.geom.Arc2D"%><%!String[] fonts = { "宋体", "楷体","黑体","Arial","Times New Roman"};// 字体 //String[] fonts2 = {"华文彩云"};// 字体 //int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC, // Font.BOLD + Font.ITALIC };// 样式 int[] styles2 = { Font.PLAIN, Font.ITALIC, Font.ITALIC, Font.ITALIC };// 样式 //int[] sizes = { 14, 15, 16, 17, 18, 19, 20 };// 字体大小 //int[] sizes2 = { 18, 19, 20, 18, 19, 20, 20 };// 字体大小 Color getRandColor(int fc, int bc) {//给定范围获得随机颜色 Random random = new Random(); if (fc > 255) fc = 255; if (bc > 255) bc = 255; int r = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc); return new Color(r, g, b); } %><% try { //设置页面不缓存 response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); // 在内存中创建图象 int width = 3000, height = 500; BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); BufferedImage image_error = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); // 获取图形上下文 Graphics gr = image.getGraphics(); Graphics2D g = (Graphics2D) gr; g.setStroke(new BasicStroke(3));//设置线条的粗细 //生成随机类 Random random = new Random(); // 设定背景色 g.setColor(getRandColor(200, 250)); g.fillRect(0, 0, width, height); g.drawRect(0, 0, width - 1, height - 1); String sRand = Code.getCode(session);//rand g.setColor(getRandColor(10, 100)); g.setFont(new Font(fonts[0], styles2[0], 550)); g.drawString(sRand, 5, 450); // 图象生效 g.dispose(); ImageIO.write(image, "JPEG", response.getOutputStream()); out.clear(); out=pageContext.pushBody(); } catch (Exception e) { e.printStackTrace(); }%>public static String getCode(HttpSession session) { boolean hasBrackets = false; float num1, num2, num3, result = -1; char op1, op2; text = new String(); boolean running = true; try { do { num1 = getNum(1, 5); num2 = getNum(1, 5); num3 = getNum(1, 5); op1 = getOp(); op2 = getOp(); text = new String(); hasBrackets = false; if (op1 == op2) { continue; } hasBrackets = hasBrackets(); // 添加括号 if (hasBrackets) { result = getBracketsStr(num1, num2, num3, op1, op2, position); if (result > 0) { running = false; } } else { result = getStr(num1, num2, num3, op1, op2); if (result > 0) { running = false; } } } while (running); byte[] encryptResult = Encrypt.encrypt((((int) result) + "").toLowerCase()); String encryptResultStr = Encrypt.parseByte2HexStr(encryptResult); Util.log("Code.java code = " + ((int) result) + "||encryptResultStr = " + encryptResultStr); session.setAttribute("rand", encryptResultStr); } catch (Exception e) { e.printStackTrace(); } return text; } HttpServletRequestWrapper.getSession中调用了ApplicationHttpRequest.getSession,又在ApplicationHttpRequest.getSession中调用了HttpServletRequestWrapper.getSession,所以产生了死循环了!你看下你的项目里哪里用了循环 导致内存溢出了 怎么实现用户输入问题,根据问题中的关键字查询出相应的问题(急急急急急!!!) 关于iframe的一个小问题 StandardWrapper.Throwable 这它马的什么舍会 如何获取一个JSP页面的数据啊?谢谢了 报表中显示条形码 一个奇怪的乱码问题 jsp网站 jsp 中如何取得某个查询数据库的结果集的行数和列数? 北京公司招聘 java 、Spring出现异常,求大神解决 [国产OSGI]动态模块化MVC框架研究 Java HotSwap
有可能是验证码的问题
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*,java.text.*,com.cloudsoar3c.tools.*" pageEncoding="utf-8"%>
<%@page import="java.io.OutputStream"%>
<%@page import="java.awt.geom.Arc2D"%>
<%!String[] fonts = { "宋体", "楷体","黑体","Arial","Times New Roman"};// 字体
//String[] fonts2 = {"华文彩云"};// 字体
//int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC,
// Font.BOLD + Font.ITALIC };// 样式
int[] styles2 = { Font.PLAIN, Font.ITALIC, Font.ITALIC, Font.ITALIC };// 样式
//int[] sizes = { 14, 15, 16, 17, 18, 19, 20 };// 字体大小
//int[] sizes2 = { 18, 19, 20, 18, 19, 20, 20 };// 字体大小 Color getRandColor(int fc, int bc) {//给定范围获得随机颜色
Random random = new Random();
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
} %>
<%
try {
//设置页面不缓存
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0); // 在内存中创建图象
int width = 3000, height = 500;
BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
BufferedImage image_error = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); // 获取图形上下文
Graphics gr = image.getGraphics(); Graphics2D g = (Graphics2D) gr;
g.setStroke(new BasicStroke(3));//设置线条的粗细
//生成随机类
Random random = new Random();
// 设定背景色
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
g.drawRect(0, 0, width - 1, height - 1);
String sRand = Code.getCode(session);//rand
g.setColor(getRandColor(10, 100));
g.setFont(new Font(fonts[0], styles2[0], 550));
g.drawString(sRand, 5, 450);
// 图象生效
g.dispose();
ImageIO.write(image, "JPEG", response.getOutputStream());
out.clear();
out=pageContext.pushBody(); } catch (Exception e) {
e.printStackTrace();
}
%>public static String getCode(HttpSession session) { boolean hasBrackets = false;
float num1, num2, num3, result = -1;
char op1, op2;
text = new String();
boolean running = true;
try {
do {
num1 = getNum(1, 5);
num2 = getNum(1, 5);
num3 = getNum(1, 5);
op1 = getOp();
op2 = getOp();
text = new String();
hasBrackets = false;
if (op1 == op2) {
continue;
}
hasBrackets = hasBrackets();
// 添加括号
if (hasBrackets) {
result = getBracketsStr(num1, num2, num3, op1, op2, position);
if (result > 0) {
running = false;
}
} else {
result = getStr(num1, num2, num3, op1, op2);
if (result > 0) {
running = false;
}
}
} while (running);
byte[] encryptResult = Encrypt.encrypt((((int) result) + "").toLowerCase());
String encryptResultStr = Encrypt.parseByte2HexStr(encryptResult);
Util.log("Code.java code = " + ((int) result) + "||encryptResultStr = " + encryptResultStr);
session.setAttribute("rand", encryptResultStr);
} catch (Exception e) {
e.printStackTrace();
}
return text; }