NumberFormatException 에러

2021. 2. 9. 14:19JSP/ERROR

Spring Mybatis 를 사용하여 작업을 진행 하는중 NumberFormatException 에러가 발생하여 포스팅 하였습니다.

 

NumberFormatException 에러...

 

 

문제는 도대채 Y 값을 넣었을뿐인데 왜 NumberFormatException 에러가 발생하는가..... 

 

검색해보니 " 표와 ' 의 차이때문이라고 합니다.

 

기존소스를 보자면 

 

            ...
            <if test="admin_use == 'Y' ">
           	, fail_cnt = 0
           	</if>
            ...

 

변경된 소스를 보자면 

 

			...
            <if test='admin_use == "Y" '>
            , login_fail_cnt = 0
            </if>
            ...

test 를 감싸는 큰따옴표를 작은따옴표로 바꾸고 Y 를 감싸던작은따옴표를 큰따옴표로 바꾸니 해결되었습니다.

 

원인을 살펴보자면

 

================================================================

myBatis 문제는 아니고 OGNL(Object Graph Navigation Language) 의 문제이다.
OGNL 인터프리터에서는 위 구문의 ‘Y’를 char 형으로 인식하고, ‘YY’나 “Y”는 String으로 인식한다.

================================================================

참조 : t-ara72.blogspot.com/2013/10/mybatis-numberformatexception.html

 

mybatis에서 NumberformatException이 나는 경우

출처: http://sinius.net/?p=308 java.lang.NumberFormatException: For input string: “y” 에러 해결방법 ### Error querying database. Cause: java.l...

t-ara72.blogspot.com