[求助]maven模块install连接数据库报com.ibatis.sqlmap.client.SqlMapException: There is no statement named XXX_by_id in this SqlMap.

丶小宝 发布于 2018/08/01 11:09
阅读 275
收藏 0

maven包含spring boot子模块的一个项目, 项目本身是可以运行, 并且功能都可以实现 , 现在要对项目进行打包处理, 在install到dao模块的时候,

Running com.xiao.DaoAeriesTest的时候却抛出了

com.ibatis.sqlmap.client.SqlMapException: There is no statement named MemberRightsMapper.select in this SqlMap.

如果直接跑test的话是可以跑得通的,使用的是spring-orm-3.0.5,下面是sqlMapClient的配置

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation">
        <value>conf/SqlMapConfig.xml</value>
    </property>
    <property name="mappingLocations">
        <value>classpath*:com/xiao/**/*SQL.xml
        </value>
    </property>
    <property name="dataSource" ref="dataSource"/>
</bean>

另外我的SQL.xml文件是在pojo模块中的,因为放入dao模块中的话,本地启动就会抛出

There is no statement named XXX in this SqlMap.这个异常,install也是一样的.

现在把test模块去掉之后可以打包成功,

但是在使用java -jar XXX.jar启动spring boot打成的包后 ,调用的dao层的方法,控制台又会直接抛出这个异常

org.springframework.data.redis.RedisSystemException: Unknown jedis exception; nested exception is com.ibatis.sqlmap.client.SqlMapException: There is no statement named ACTIVITY.selectAvailableActivities in this SqlMap.
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:58)
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:37)
        at org.springframework.data.redis.connection.jedis.JedisConverters.toDataAccessException(JedisConverters.java:117)
        at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.translateExceptionIfPossible(JedisConnectionFactory.java:156)
        at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
        at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
        at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl$$EnhancerBySpringCGLIB$$5b37250d.selectAvailableActivities(<generated>)
        at com.miyun.biz.activity.manager.impl.ActivityManagerImpl.selectAvailableJoinActivities(ActivityManagerImpl.java:168)
        at com.miyun.biz.activity.manager.impl.ActivityManagerImpl.join(ActivityManagerImpl.java:331)
        at com.jinju.demojms.Receive.joinActivity(Receive.java:194)
        at com.jinju.demojms.Receive.joinInvsetActivity(Receive.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181)
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114)
        at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:51)
        at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:182)
        at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:120)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named ACTIVITY.selectAvailableActivities in this SqlMap.
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:558)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
        at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
        at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:295)
        at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:1)
        at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
        at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293)
        at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl.selectAvailableActivities(ActivityDAOImpl.java:67)
        at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl$$FastClassBySpringCGLIB$$f4e9b4c6.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
        ... 25 more

 

怀疑和install dao模块时抛出的异常是一个原理,  两天了 都没解决

加载中
0
丶小宝
丶小宝

已解决, 在model模块中编译之后没有xml文件 在pom中加入以下解决

<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>
返回顶部
顶部