java.lang.StackOverflowError错误

  今天,在运行wiring your web application with open source java时,当提交一份订单后,老是出现java.lang.StackOverflowError错误,经过调试,发现问题出在SaveOrderAction.java中,

里面有一段代码如下:

order.setOrderLineItems(lineItems);

__log.debug("the order before save is: "+ order.getUserName()+"this order is:"+order);

// delegate the save to the service layer and further upstream

Order returnedOrder = getOrderService().saveNewOrder(order);

__log.debug("the user's name who placed returnedOrder is: "+ returnedOrder.getUserName()+"this order is:"+returnedOrder);

oForm.setOrder(order);

request.setAttribute("form",oForm);

//ActionErrors errors = new ActionErrors();

//errors.add(Globals.ERROR_KEY, new ActionError("message.order.saved.successfully"));

//saveErrors(request, errors);

__log.debug("the order after set into form is: "+ order.getUserName()+"this order is:"+order);

return mapping.findForward("success");

  如果不注释掉上面3行,就会出现这个错误,真不知道是什么原因。报错信息如下:

“type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.StackOverflowError

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.

  另外,如果把log4j配置成显示debug信息,控制台就会一直报告如下信息,不知是怎么一回事:

2006-01-06 22:40:21,564 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/01/00) - Connection #41 created to achieve minimum of 2 = AVAILABLE

2006-01-06 22:40:21,594 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/02/00) - Connection #42 created to achieve minimum of 2 = AVAILABLE

2006-01-06 22:40:51,618 DEBUG logicalcobwebs.proxool.spring:431  -> 000003 (00/01/00) - #0041 removed because it has problems: java.sql.SQLException: Syntax error or access violation,  message from server: "You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'values(current TimeStamp)' at line 1".

2006-01-06 22:40:51,628 DEBUG logicalcobwebs.proxool.spring:431  -> 000003 (00/00/00) - #0042 removed because it has problems: java.sql.SQLException: Syntax error or access violation,  message from server: "You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'values(current TimeStamp)' at line 1".

2006-01-06 22:40:51,638 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/01/00) - Connection #43 created to achieve minimum of 2 = AVAILABLE

2006-01-06 22:40:51,658 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/02/00) - Connection #44 created to achieve minimum of 2 = AVAILABLE

2006-01-06 22:41:00,661 INFO  proxool.stats.spring:66  -> 22:40:00 - 22:41:00, s:0:0.00/s, r:0:0.00/s, a:0.00ms/0.00

2006-01-06 22:41:21,671 DEBUG logicalcobwebs.proxool.spring:431  -> 000003 (00/01/00) - #0043 removed because it has problems: java.sql.SQLException: Syntax error or access violation,  message from server: "You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'values(current TimeStamp)' at line 1".

2006-01-06 22:41:21,681 DEBUG logicalcobwebs.proxool.spring:431  -> 000003 (00/00/00) - #0044 removed because it has problems: java.sql.SQLException: Syntax error or access violation,  message from server: "You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'values(current TimeStamp)' at line 1".

2006-01-06 22:41:21,711 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/01/00) - Connection #45 created to achieve minimum of 2 = AVAILABLE

2006-01-06 22:41:21,731 DEBUG logicalcobwebs.proxool.spring:181  -> 000003 (00/02/00) - Connection #46 created to achieve minimum of 2 = AVAILABLE

(java.sql.SQLException产生的原因是proxool.xml的配置问题:http://www.learndiary.com/disDiaryContentAction.do?goalID=1468)

我用的是tomcat5.0+mysql4.0.14

3 thoughts on “java.lang.StackOverflowError错误”

  1. 我用的struts1.2,在1.2中,下面这几句就会出问题:

    ActionErrors errors = new ActionErrors();

    errors.add(Globals.ERROR_KEY, new ActionError("message.order.saved.successfully"));

    saveErrors(request, errors);

    具体原因不知道,好像是ActionError类在1.2中已经被Deprecated. Please use ActionMessage instead, deprecated since 1.2.0. (引自Struts1.2.4API)

    但是这也不应该是出错的原因呢。

Comments are closed.