首页 新闻 会员 周边 捐助

java.lang.StackOverflowError

0
悬赏园豆:20 [已解决问题] 解决于 2018-05-15 14:31

[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.mybatis.spring.SqlSessionUtils]Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@66da182e]
[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.mybatis.spring.SqlSessionUtils]Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSessio
n@66da182e]
[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.mybatis.spring.SqlSessionUtils]Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@66da
182e]
[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.springframework.jdbc.datasource.DataSourceUtils]Returning JDBC Connection to DataSource
[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.springframework.jdbc.datasource.DataSourceTransactionManager]Should roll back transaction but cannot - no transaction available
[DEBUG][2017-12-04 16:54:15][catalina-exec-182] [org.springframework.web.servlet.DispatcherServlet]Could not complete request
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.StackOverflowError
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1287)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.zhiban.zbw.filter.LoginFilter.doFilter(LoginFilter.java:246)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.zhiban.faces.tools.xss.XSSFilter.doFilter(XSSFilter.java:28)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
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)
Caused by: java.lang.StackOverflowError
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$Curly.match1(Pattern.java:4185)
at java.util.regex.Pattern$Curly.match(Pattern.java:4134)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$Curly.match1(Pattern.java:4185)
at java.util.regex.Pattern$Curly.match(Pattern.java:4134)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$Curly.match1(Pattern.java:4185)
at java.util.regex.Pattern$Curly.match(Pattern.java:4134)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
at java.util.regex.Pattern$Loop.match(Pattern.java:4683)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
at java.util.regex.Pattern$Curly.match1(Pattern.java:4185)
at java.util.regex.Pattern$Curly.match(Pattern.java:4134)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
:

猫咪233的主页 猫咪233 | 初学一级 | 园豆:37
提问于:2017-12-04 17:02
< >
分享
最佳答案
0

java.util.regex.Pattern 这里是否有递归的死循环

或者是栈空间设置可以大些看看

收获园豆:20
2012 | 高人七级 |园豆:21445 | 2017-12-05 08:17

  代码如下,麻烦大神帮看下

public static List<List<Object>> replaceOriginalXML(List<ReportTemplet> tempList) throws DocumentException{
     List<List<Object>> returnList = new ArrayList<List<Object>>();
     Document document = null;
     StringBuffer xmlString = null;
     List<Object> objlist = null;
     String xmlStr = null;
     for(ReportTemplet templet:tempList){
     //读取模板文档
       objlist = new ArrayList<Object>();
    //document = XmlU.loadXML(filepath);
       String file_name = templet.getFile_name();
       file_name = file_name.substring(file_name.lastIndexOf("/")+1);
    document = XmlU.loadXML(templet.getReport_path()+file_name);
    xmlString = new StringBuffer(document.asXML());
    //xmlString = new StringBuffer(xmlString.toString().replaceAll("\n", "&#xA;").replaceAll("\r\n", "&#xA;"));
    //去掉xmlString中的文档标签
    Pattern p = Pattern.compile("\\$(<(.*?)>)*\\{[^}]*}"); //${...}
    Matcher m = p.matcher(xmlString);
    int start = 0;
    int end = 0;
    
    List<int[]> list = new ArrayList<int[]>();
    while(m.find()){
     start = m.start();
     end = m.end();
     int[] intArr = {start,end};
     list.add(intArr);
    }
    Collections.reverse(list); 
       for(int i=0;i<list.size();i++){
        String tempStr = xmlString.substring(list.get(i)[0], list.get(i)[1]);
        tempStr = tempStr.replaceAll("<(.*?)>", "");
        xmlString.replace(list.get(i)[0], list.get(i)[1],tempStr);
       }
      
       xmlStr = xmlString.toString();
       xmlString = new StringBuffer(xmlStr);
       //读取最后一个表格的内容
       Pattern p2 = Pattern.compile("<w:tbl>(.*?)</w:tbl>");
       Matcher m2 = p2.matcher(xmlString);
       int start1 = 0;
       int end1 = 0;
       StringBuffer childSB = null;
       Map<String,String> relMap = new HashMap<String,String>();
       while(m2.find()){
        childSB = new StringBuffer(m2.group());
        start1 = m2.start();
        end1 = m2.end();
        if(childSB.toString().contains("DCT&lt;数据对应表&gt;")){
         //将最后一个表格的公式和代码关系放到一个Map中
         Pattern p3 = Pattern.compile("\\$\\{(.*?)}");
         Matcher m3 = p3.matcher(childSB);
         List<String> list1 = new ArrayList<String>();
         String tempStr4 = null;
         while(m3.find()){
          tempStr4 = m3.group();
          tempStr4 = replaceStr(tempStr4);
          tempStr4 = tempStr4.substring(2, tempStr4.length()-1);
          list1.add(tempStr4);
         }
         if(list1.size()>1){
          if(list1.get(1).matches("\\d+")){
           for(int i=1;i<list1.size();i+=2){
            relMap.put(list1.get(i+1), list1.get(i));
        }
          }else{
           for(int i=1;i<list1.size();i+=2){
            relMap.put(list1.get(i+1), list1.get(i));
        }
          }
         }
         //去掉最后一个表格
         xmlString = xmlString.delete(start1, end1);
         break;
        }
       }
   
       objlist.add(xmlString.toString());
       objlist.add(relMap);
       objlist.add(templet);
       returnList.add(objlist);
     }
     return returnList;
    }

猫咪233 | 园豆:37 (初学一级) | 2017-12-05 09:04
其他回答(1)
0

已自己解决

猫咪233 | 园豆:37 (初学一级) | 2017-12-22 17:10

也莫名遇到这种问题了,大哥是怎么解决的

支持(0) 反对(0) LJ9197 | 园豆:200 (初学一级) | 2019-12-07 12:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册