Error creating bean with name 'sessionFactory' defined
Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.w...
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 展开
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 展开
2个回答
展开全部
Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'
这句话就是关键,你定义sessionFactory bean 的时候可能把该用<ref bean = "dataSource">的地方用了<value>dataSource</value>了吧????最好吧你的ApplicationContext.xml贴出来
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation">
<value>WEB-INF/classes/hibernate.cfg.xml</value>
</property>
<property name="hibernateProperties"
value="hibernate.dialect=org.hibernate.dialect.MySQLDialect" />
</bean>
这句话就是关键,你定义sessionFactory bean 的时候可能把该用<ref bean = "dataSource">的地方用了<value>dataSource</value>了吧????最好吧你的ApplicationContext.xml贴出来
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation">
<value>WEB-INF/classes/hibernate.cfg.xml</value>
</property>
<property name="hibernateProperties"
value="hibernate.dialect=org.hibernate.dialect.MySQLDialect" />
</bean>
展开全部
Failed
to
convert
property
value
of
type
[java.lang.String]
to
required
type
[javax.sql.DataSource]
for
property
'dataSource'
这句话就是关键,你定义sessionFactory
bean
的时候可能把该用<ref
bean
=
"dataSource">的地方用了<value>dataSource</value>了吧????最好吧你的ApplicationContext.xml贴出来
<bean
id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property
name="dataSource">
<ref
bean="dataSource"
/>
</property>
<property
name="configLocation">
<value>WEB-INF/classes/hibernate.cfg.xml</value>
</property>
<property
name="hibernateProperties"
value="hibernate.dialect=org.hibernate.dialect.MySQLDialect"
/>
</bean>
to
convert
property
value
of
type
[java.lang.String]
to
required
type
[javax.sql.DataSource]
for
property
'dataSource'
这句话就是关键,你定义sessionFactory
bean
的时候可能把该用<ref
bean
=
"dataSource">的地方用了<value>dataSource</value>了吧????最好吧你的ApplicationContext.xml贴出来
<bean
id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property
name="dataSource">
<ref
bean="dataSource"
/>
</property>
<property
name="configLocation">
<value>WEB-INF/classes/hibernate.cfg.xml</value>
</property>
<property
name="hibernateProperties"
value="hibernate.dialect=org.hibernate.dialect.MySQLDialect"
/>
</bean>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询