救救孩子吧
发表在JavaWeb图书答疑 2020-03-17 《JavaWeb项目开发实战入门》第3章 BBS——程序源论坛
是否精华
版块置顶:

在学习过程中修改了包名导致项目运行404,其他配置文件已经修改。

报错信息

严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener]

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/mrkj/ygl/config/spring-transaction.xml]; nested exception is java.io.FileNotFoundException: class path resource [com/mrkj/ygl/config/spring-transaction.xml] cannot be opened because it does not exist

spring-transaction.xml配置代码:

<bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="location" value="classpath:jdbc.properties" />

</bean>


<bean id="setting"

class="org.springframework.beans.factory.config.PropertiesFactoryBean">

<property name="locations">

<list>

<value>classpath:jdbc.properties</value>

<value>classpath:forum.properties</value>

</list>

</property>

<!-- 设置编码格式 -->

<property name="fileEncoding" value="UTF-8"></property>

</bean>


<bean id="dataSourceDDS" class="com.alibaba.druid.pool.DruidDataSource"

destroy-method="close">

<property name="driverClassName" value="${driver}" />

<property name="url" value="${url}" />

<property name="username" value="${username}" />

<property name="password" value="${password}" />

<!-- 初始化连接大小 -->

<property name="initialSize" value="${initialSize}"></property>

<!-- 连接池最大数量 -->

<property name="maxActive" value="${maxActive}"></property>

<!-- 连接池最大空闲 -->

<property name="maxIdle" value="${maxIdle}"></property>

<!-- 连接池最小空闲 -->

<property name="minIdle" value="${minIdle}"></property>

<!-- 获取连接最大等待时间 -->

<property name="maxWait" value="${maxWait}"></property>

</bean>

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

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

<!-- 自动扫描mapping.xml文件 -->

<!-- <property name="mapperLocations" value="classpath:com/yida/oa/entity/*.xml"></property> -->

<property name="mapperLocations">

<list>

<!-- <value>classpath:com/expect/framework/entity/userlogin/*.xml</value> -->

<value>classpath:com/ymu/dfq/config/mapping/*.xml</value>

</list>

</property>

</bean>



<!-- DAO接口所在包名,Spring会自动查找其下的类 -->

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<property name="basePackage" value="com.ymu.dfq.dao" />

<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>

</bean>


<!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->

<bean id="transactionManager"

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

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

</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">

<tx:attributes>

<tx:method name="delete*" propagation="REQUIRED" read-only="false"

rollback-for="java.lang.Exception" />

<tx:method name="insert*" propagation="REQUIRED" read-only="false"

rollback-for="java.lang.Exception" />

<tx:method name="update*" propagation="REQUIRED" read-only="false"

rollback-for="java.lang.Exception" />

<tx:method name="save*" propagation="REQUIRED" read-only="false"

rollback-for="java.lang.Exception" />

</tx:attributes>

</tx:advice>

<aop:aspectj-autoproxy proxy-target-class="true" />

<aop:config>

<aop:pointcut id="pc"

expression="execution(* com.ymu.dfq.service..*(..))" />

<aop:advisor pointcut-ref="pc" advice-ref="txAdvice" />

</aop:config>


</beans>


分享到:
精彩评论 1
段同学
学分:34 LV2
2020-03-17
沙发

报错信息

image.png

首页上一页 1 下一页尾页 1 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照