2009-4-30 22:57:47 org.apache.catalina.startup.HostConfig checkResources
信息: Reloading context [/guestbook5]
2009-4-30 22:57:47 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/guestbook5] has not been started
2009-4-30 22:57:53 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-4-30 22:57:54 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 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.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 [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1107)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1307)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
at java.lang.Thread.run(Unknown Source)
2009-4-30 22:57:54 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-4-30 22:57:54 org.apache.catalina.core.StandardContext start
严重: Context [/guestbook5] startup failed due to previous errors
2009-4-30 22:57:54 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext

解决方案 »

  1.   

    [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found 
    重点是这两句,本来应该配置dataSource的地方,配了字符串。或者你本来相配DataSource名字的,但DataSource这个Bean忘了配进去。或者有写错了不匹配。仔细检查/WEB-INF/applicationContext.xml 
      

  2.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="oracle.jdbc.driver.OracleDriver">
    </property>
    <property name="url"
    value="jdbc:oracle:thin:@localhost:1521:admin">
    </property>
    <property name="username" value="scott"></property>
    <property name="password" value="tiger"></property>
    </bean>    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" value="dataSource"></property>
    <property name="mappingResources">
    <list>
    <value>com.hibernate.pojo.Guestbook.hbm.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.Oracle9Dialect
    </prop>
    </props>
    </property>
    </bean>
        
    <bean id="guestbookDao"
    class="com.huahua.guestbook.dao.Impl.guestbookDaoImpl"
    abstract="false" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean> <bean id="manager"
    class="com.huahua.guestbook.manager.Impl.managerImpl" abstract="false"
    lazy-init="default" autowire="default" dependency-check="default">
    <property name="guestbookDao">
    <ref bean="guestbookDao" />
    </property> </bean>
    </beans>
      

  3.   

    <bean id="sessionFactory" 
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    <property name="dataSource" value="dataSource"> </property> value改成ref,因为你引用的是另外一个bean,
    如果用value,就变成赋值“dataSource”这个字符串。
      

  4.   

    楼上很厉害不过最好把ref设置成子节点  再附加bean属性,要不你还得报错:)
    <ref bean="dataSource"></ref>