'Framework'에 해당되는 글 8건

  1. 2011.09.15 iBatis Exception Cause: java.lang.IllegalArgumentException 2
2011. 9. 15. 13:45

아래와같이 Cause: java.lang.IllegalArgumentException 예외가 났을땐 총 3가지 정도 발생원인을 찝어볼 수 있다.

1. SQL상에는 classificationSeq2 컬럼이 있는데 빈즈상에는 없는경우
2. 빈즈상에는 있지만 set메소드가 없는경우
3. classificationSeq2컬럼과 빈즈의 컬럼타입이 맞지 않았을 경우
어느정도 맞춰보면 1, 2, 3번은 찾기 쉽지만 한가지 더 체크해야 할 부분이 있다.
예를들어

CL1.CLASSIFICATION_SEQ AS classificationSeq1,
CL2.CLASSIFICATION_SEQ AS classificationSeq2,
CL3.CLASSIFICATION_SEQ AS classificationSeq3

식으로 SQL에서 가져올 경우(가져오는 데이터는 숫자) DB데이터는 0이 아닌 null 이 들어가 있을 수도 있다.
이 때 쿼리상에서 처리하지 않으면 3번과 같은 예외가 발생... 정말 찾기 힘들었다.
필히 작성할 땐 데이터 타입까지 맞추고 쿼리상에서 가져올 땐 NULL 처리 까지 해주는 것이 좋다.

com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in com/shareInput/record/writing/sql/Writing.xml. 
--- The error occurred while applying a result map. 
--- Check the writing.getBranchFileInfo-AutoResultMap. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setClassificationSeq2' of 'com.shareInput.record.writing.dto.WritingFileDto@b2945d'.  Cause: java.lang.IllegalArgumentException
 at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:204)
 at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
 at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
 at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
 at com.shareInput.record.writing.service.WritingServiceImpl.getBranchFileInfo(WritingServiceImpl.java:812)
 at com.shareInput.record.writing.controller.WritingController.getBranchFileInfo(WritingController.java:885)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:473)
 at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:410)
 at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
 at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.shareInput.util.filter.EncodingFilter.doFilter(EncodingFilter.java:104)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: Error setting property 'setClassificationSeq2' of 'com.shareInput.record.writing.dto.WritingFileDto@b2945d'.  Cause: java.lang.IllegalArgumentException
 at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)
 at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java:112)
 at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setResultObjectValues(ResultMap.java:371)
 at com.ibatis.sqlmap.engine.mapping.result.AutoResultMap.setResultObjectValues(AutoResultMap.java:57)
 at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64)
 at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:385)
 at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)
 at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)
 at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
 at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
 ... 36 more
Caused by: java.lang.IllegalArgumentException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.ibatis.common.beans.MethodInvoker.invoke(MethodInvoker.java:17)
 at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:46)
 ... 45 more
Posted by silver0r