mr_lbc
mr_lbc
采纳率100%
2017-04-05 09:32

Spring+mybatis,打war包在linux环境tomcat启动后,调用接口报错

已采纳

eclipse跑项目,没问题。打war包后放在windows环境的tomcat下跑,没问题。
linux环境下,报错:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mr_lbc.sqlcovDao.AllUsersMapper.getAllUser
org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:230)
org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
com.sun.proxy.$Proxy18.getAllUser(Unknown Source)
com.mr_lbc.sqlcovServiceImpl.GetCovServiceImpl.getAllUser(GetCovServiceImpl.java:31)
com.mr_lbc.sqlcovController.GetCovController.getAllUser(GetCovController.java:25)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)war包中有xml

 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!-- 自动扫描mapping.xml文件,**表示迭代查找 -->
        <property name="mapperLocations" value="classpath*:com\mr_lbc\sqlcovMapper\*.xml"/>
    </bean>

    <!-- DAO接口所在包名,Spring会自动查找其下的类 -->  
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">  
        <property name="basePackage" value="com.mr_lbc.sqlcovDao" />  
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>  
    </bean> 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • Pnfy__Shan 單鵬飛 4年前

    找不到一定是路径问题,linux只认“/”,不认“\”,windows两种都认 。

    点赞 评论 复制链接分享
  • lihongbiao0610 lihongbiao0610 4年前

    可能是路径的问题 com\mr_lbc\sql
    斜杠改下试试

    点赞 评论 复制链接分享
  • Pnfy__Shan 單鵬飛 4年前

    很明显,org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mr_lbc.sqlcovDao.AllUsersMapper.getAllUser,就是你的Dao没找到嘛

    点赞 评论 复制链接分享

相关推荐