maven 整合springmvc spring mybatisc 启动tomcat时报的错(求各位大虾们帮忙看看是啥情况)

许伟伟 2015-04-22 04:16:46
[org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization started
[org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing Root WebApplicationContext: startup date [Wed Apr 22 14:52:09 CST 2015]; root of context hierarchy
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [spring-mybatis.xml]
[org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - Loading properties file from class path resource [jdbc.properties]
[org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.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:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:681)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: 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:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:479)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
... 20 more
Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:140)
at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:430)
at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:403)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:181)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459)
... 26 more
...全文
7943 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
阮少年、 2017-08-26
  • 打赏
  • 举报
回复
引用 12 楼 u012126500 的回复:
[quote=引用 11 楼 xiaobaihaohaode 的回复:] 亲,你的问题处理了吗?我也有同样的问题
主要原因在于 maven 并不会自动将 src/main/java 中的 xml 等资源文佳复制到 target/classes 中去, 解决办法参考: http://blog.csdn.net/u012599988/article/details/44041205[/quote]感谢大神,可以了
小拽海马 2016-06-22
  • 打赏
  • 举报
回复
在pom.xml中添加: <build> <resources> <!--编译之后包含xml--> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </build>
li47936 2016-04-06
  • 打赏
  • 举报
回复
引用 11 楼 xiaobaihaohaode 的回复:
亲,你的问题处理了吗?我也有同样的问题
主要原因在于 maven 并不会自动将 src/main/java 中的 xml 等资源文佳复制到 target/classes 中去, 解决办法参考: http://blog.csdn.net/u012599988/article/details/44041205
xiaobaihaohaode 2016-03-17
  • 打赏
  • 举报
回复
亲,你的问题处理了吗?我也有同样的问题
sunaer 2015-05-04
  • 打赏
  • 举报
回复
/com/sdfadf/**/**.xml这个包没有在 source package下
yangbiao0326 2015-04-27
  • 打赏
  • 举报
回复
spring给你提示 1、Error creating bean with name 'sqlSessionFactory' defined in class path resource 创造 sqlSessionFactory时报错了 2、 Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations' 填 充mapperLocations属性时失败,原因是转换类型。mapperLocations属性需要'org.springframework.core.io.Resource[]'。 3、classpath:com/prtdonsl/mapping/*Mapper.xml 检查一下classpath:com/prtdonsl/mapping/*Mapper.xml下的文件是否存在
用手敲过才算 2015-04-24
  • 打赏
  • 举报
回复
最上边 [org.springframework.web.context.ContextLoader] - Context initialization failed xml中context路径不对吧
iKoni 2015-04-24
  • 打赏
  • 举报
回复
pom.xml里的<resources>里怎么配置的 可能跟这个有关 最好自己查一下了解下
许伟伟 2015-04-23
  • 打赏
  • 举报
回复
引用 2 楼 yl784248831 的回复:
.xml文件不存在
对的后来发现在classes 下面没有生成:com/sdfasd/**/**/**/mapper/*Mapper.xml 其他类都生成的,就这个对应的没有生成!求解
亦笑为红颜 2015-04-23
  • 打赏
  • 举报
回复
路径不存在哟
tony4geek 2015-04-23
  • 打赏
  • 举报
回复
class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist 找找原因
kky2010_110 2015-04-22
  • 打赏
  • 举报
回复
<property name="mapperLocations"> <list> <value>classpath:com/sdfasd/**/**/**/mapper/*Mapper.xml</value> </list> </property> 你的路径不存在
yl784248831 2015-04-22
  • 打赏
  • 举报
回复
.xml文件不存在
许伟伟 2015-04-22
  • 打赏
  • 举报
回复
四月 22, 2015 2:52:10 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.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:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:681) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: 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:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:479) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ... 20 more Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:com/prtdonsl/mapping/*Mapper.xml]: class path resource [com/prtdonsl/mapping/] cannot be resolved to URL because it does not exist at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:140) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:430) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:403) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:181) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459) ... 26 more 这是下半部分的错误

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧