2009-8-31 4:57:43 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:1112)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
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:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1116)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Unknown Source)
2009-8-31 4:57:43 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-8-31 4:57:43 org.apache.catalina.core.StandardContext start
严重: Context [/guestbook3] startup failed due to previous errors
2009-8-31 4:57:43 org.apache.catalina.core.ApplicationContext log

解决方案 »

  1.   

    加载spring框架出错了,可能是web.xml里面fiter配置出问题了,
      

  2.   

    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 把你的配置文件发上来看看吧我觉得是datasource配置错误
      

  3.   

    这是我的配置文件
    <?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="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" value="dataSource">

    </property>
    <property name="mappingResources">
    <list>
    <value>com/v512/guestbook/model/Guestbook.hbm.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> </props>
    </property>
    </bean>
    <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:orcl">
    </property>
    <property name="username" value="scott"></property>
    <property name="password" value="tiger"></property>
    </bean>
    <bean id="guestbookDao" class="com.v512.guestbook.dao.hibernate.GuestbookDaoHibernate"
    abstract="false" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="guestbookManager" class="com.v512.guestbook.service.impl.GuestbookManagerImpl"
    abstract="false" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="guestbookDao">
    <ref bean="guestbookDao" />
    </property>
    </bean>
    </beans>
      

  4.   

    少这个<ref bean="dataSource" />
      

  5.   

    <bean id="sessionFactory" 
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    <property name="dataSource" value="dataSource"> 把下面一句
    改成
    <property name="dataSource" ref="dataSource"> 
      

  6.   

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

  7.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    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-2.5.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
    <property name="url"
    value="jdbc:sqlserver://localhost:1433;databasename=northwind" />
    <property name="username" value="sa" />
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list> <value>com/ssh2/shop/model/po/Categories.hbm.xml</value>
    <value>com/ssh2/shop/model/po/Suppliers.hbm.xml</value>
    <value>
    com/ssh2/shop/model/po/Territories.hbm.xml
    </value>
    <value>com/ssh2/shop/model/po/Orders.hbm.xml</value>
    <value>com/ssh2/shop/model/po/Region.hbm.xml</value>
    <value>
    com/ssh2/shop/model/po/CustomerCustomerDemo.hbm.xml
    </value>
    <value>com/ssh2/shop/model/po/Shippers.hbm.xml</value>
    <value>
    com/ssh2/shop/model/po/CustomerDemographics.hbm.xml
    </value>
    <value>com/ssh2/shop/model/po/Products.hbm.xml</value>
    <value>
    com/ssh2/shop/model/po/EmployeeTerritories.hbm.xml
    </value>
    <value>com/ssh2/shop/model/po/Customers.hbm.xml</value>
    <value>com/ssh2/shop/model/po/Employees.hbm.xml</value>
    <value>
    com/ssh2/shop/model/po/OrderDetails.hbm.xml
    </value>
    </list>
    </property>
    </bean>
    <!-- 注解事务生效 使用tx事务的命名空间 -->
    <tx:annotation-driven transaction-manager="txManager" />
    <!-- 定义受事务管理的数据源 -->
    <bean id="txManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
    </bean>
    <!-- dao -->
    <bean id="proddao" class="com.ssh2.shop.base.GenericHibernateDao">
    <constructor-arg index="0" value="com.ssh2.shop.model.po.Products" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="orderdao"
    class="com.ssh2.shop.base.GenericHibernateDao">
    <constructor-arg index="0" value="com.ssh2.shop.model.po.Orders" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="custdao" class="com.ssh2.shop.base.GenericHibernateDao">
    <constructor-arg index="0"
    value="com.ssh2.shop.model.po.Customers" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="orderdetaildao"
    class="com.ssh2.shop.base.GenericHibernateDao">
    <constructor-arg index="0"
    value="com.ssh2.shop.model.po.OrderDetails" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- service -->
    <bean id="prodservice"
    class="com.ssh2.shop.service.impl.ProductsServiceImpl">
    <property name="proddao" ref="proddao" />
    </bean>
    <bean id="orderservice"
    class="com.ssh2.shop.service.impl.OrdersServiceImpl">
    <property name="orderdao" ref="orderdao" />
    <property name="orderdetaildao" ref="orderdetaildao" />
    </bean>
    <bean id="custservice"
    class="com.ssh2.shop.service.impl.CustomersServiceImpl">
    <property name="customerdao" ref="custdao" />
    </bean>
    <!-- baseaction -->
    <bean id="baseaction" abstract="true">
    <property name="ps" ref="prodservice" />
    <property name="os" ref="orderservice" />
    <property name="cs" ref="custservice"></property>
    </bean>
    <!-- Action -->
    <bean id="shopaction" class="com.ssh2.shop.presentation.ShopAction"
    parent="baseaction" scope="prototype">
    </bean>
    </beans>
    给你个购物车ssh玩