fnzf14428547
fnzf14428547
采纳率25%
2016-03-07 02:53 阅读 9.3k

spring-mybatis.xml配置出错了,请大神看看

这是第一个错

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.fishoad.services.QuartzService] for bean with name 'quartzTask' defined in class path resource [spring-quartz.xml]; nested exception is java.lang.ClassNotFoundException: com.fishoad.services.QuartzService
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1327)
Caused by: java.lang.ClassNotFoundException: com.fishoad.services.QuartzService
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
`



三月 07, 2016 10:49:24 上午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: 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/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] 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)

第二个错

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/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] 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)
... 21 more
Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:/com/fishoad/dao/*.xml]: class path resource [com/fishoad/dao/] 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)
... 27 more


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

8条回答 默认 最新

  • qq_24848969 大头荣 2016-05-01 16:37

    在pom.xml 下面的build便签下加上


    src/main/resources

    /*.properties
    /*.xml
    **/*.tld

    false

    点赞 2 评论 复制链接分享
  • rui888 兔子托尼啊 2016-03-07 03:00

    class path resource [com/fishoad/dao/] cannot be resolved to URL because it does not exist
    提升路径不存在啊。

    点赞 评论 复制链接分享
  • rui888 兔子托尼啊 2016-03-07 03:27

    对了你第一个错误 com.fishoad.services.QuartzService 这个也没有。

    点赞 评论 复制链接分享
  • wojiushiwo945you 毕小宝 2016-03-07 04:53

    配置文件路径修正下:classpath:/com/fishoad/dao/*.xml去掉第一个斜杠试试。

    点赞 评论 复制链接分享
  • qq_24848969 大头荣 2016-05-01 16:39
    点赞 评论 复制链接分享
  • Hreo111 NeedFSpeeed 2017-08-19 19:59

    在POM.XML文件追加

      <resources>  
        <!--编译之后包含xml-->  
        <resource>  
          <directory>src/main/java</directory>  
          <includes>  
            <include>**/*.xml</include>  
          </includes>  
          <filtering>true</filtering>  
        </resource>  
      </resources>  
    
    点赞 评论 复制链接分享
  • Hreo111 NeedFSpeeed 2017-08-19 20:00
    <build>
        <resources>
            <!--编译之后包含xml-->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    
    </build>
    
    点赞 评论 复制链接分享
  • Hreo111 NeedFSpeeed 2017-08-19 20:00

    更新一下

        <resources>
            <!--编译之后包含xml-->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    
    </build>
    
    点赞 评论 复制链接分享

相关推荐