简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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