0 Replies Latest reply on Oct 16, 2018 4:45 AM by Min-wook Park

    Have problem in mybatis when using wildcard for SqlSession setup

    Min-wook Park Newbie

      Hey,

       

      I'm using Wildfly 12.0.0.Final with Spring4 + mybatis3 + MariaDB.
      When i'm running my application, it gives me this error.

       

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

       

      15:13:04,137 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /board-1.0/board1List: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

      ### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)

      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)

      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)

      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

      at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:67)

      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

      at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)

      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)

      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)

      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)

      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)

      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)

      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)

      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)

      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)

      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)

      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)

      at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)

      at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)

      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)

      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1349)

      at java.lang.Thread.run(Thread.java:748)

      Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

      ### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)

      at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)

      at com.sun.proxy.$Proxy35.selectList(Unknown Source)

      at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:188)

      at gu.board1.board1Svc.selectBoardList(board1Svc.java:16)

      at gu.board1.board1Ctr.boardList(board1Ctr.java:22)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:498)

      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)

      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)

      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)

      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)

      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)

      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)

      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)

      ... 51 more

      Caused by: org.apache.ibatis.exceptions.PersistenceException:

      ### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)

      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)

      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:94)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:498)

      at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)

      ... 68 more

      Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for selectBoard1List

      at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)

      at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)

      at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)

      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:103)

      ... 75 more

       

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

       

      It occurs when using wildcard in mapper path.

       

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

       

      <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"

        p:driverClassName="net.sf.log4jdbc.sql.jdbcapi.DriverSpy" p:url="jdbc:log4jdbc:mysql://localhost:3306/board"

                p:username="root" p:password="my-secret-pw"

                p:initialSize="2"

                p:maxActive="30"

                p:maxIdle="10"

                p:minIdle="3"

                p:maxWait="30000"

                p:removeAbandoned="true"

                p:removeAbandonedTimeout="30"

                p:validationQuery="SELECT 1" />

       

       

      <!-- SqlSession setup for MyBatis Database Layer -->

      <bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">

      <property name="dataSource" ref="dataSource" />

      <property name="mapperLocations" value="classpath:/sql/**/*-mapper.xml" />

      <property name="mapperLocations" value="classpath:/sql/test/board/*-mapper.xml" />

      </bean>

       

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

      I changed this not to use wildcard and it works fine.

       

      you guys think this is an error?