简体   繁体   English

java.util.NoSuchElementException

[英]java.util.NoSuchElementException

I am getting the following error while trying to execute my code 尝试执行我的代码时出现以下错误

--- Check the Segment.getVirtualSegmentId.  
--- Check the SQL statement.  
--- Cause: java.util.NoSuchElementException

(but the method does exist and the query runs correctly in SQL Developer), redeploy the tomcat did the trick but again after sometime without changing anything in the code, the above error has been thrown. (但是该方法确实存在,并且查询在SQL Developer中正确运行),重新部署tomcat可以达到目的,但是在一段时间后又没有更改代码中的任何内容,则抛出了上述错误。

The code which is throwing the error is 引发错误的代码是

<select id="getVirtualSegmentId" resultClass="java.lang.String" >
  select max(substr(attr_value,instr(attr_value, '-')+1))
  from circ_inst inner join circ_attr_settings
     on circ_inst.circ_inst_id=circ_attr_settings.circ_inst_id and val_attr_inst_id=1045
  where REGEXP_LIKE (circ_attr_settings.attr_value, 'LAYER 2 SWITCH-[0-9]+$') or
      REGEXP_LIKE (circ_attr_settings.attr_value, 'IPANEMA-[0-9]+$') or
      REGEXP_LIKE (circ_attr_settings.attr_value, 'FIREWALL-[0-9]+$')
</select>

I could avoid the exception by removing the "+$" from the query. 我可以通过从查询中删除“ + $”来避免异常。 Thanks everyone for the responses 谢谢大家的回应

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM