刚创建一个项目,之前配置文件一直用的这个,运行jsp页面报错404,把这段代码注释掉就不报错了,那位大神知道哪错了怎么改?在线等 急急急!控制台报错如下:
Error creating bean with name 'sqlSessionFactory' defined in file [E:\sht.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MySht\WEB-INF\classes\springconfig\common.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:dao/*.xml]: class path resource [dao/] cannot be resolved to URL because it does not exist
spring配置:<?xml version="1.0" encoding="UTF-8"?>
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:jdbc.properties"></property>
destroy-method="close">
<!--
自动扫描mapping.xml文件
-->
把这行注释掉就不报错了:
<!-- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="ds" />
自动扫描mapping.xml文件
<property name="mapperLocations" value="classpath:dao/*.xml"></property>
-->