标题:[求助]spring+hibernate出了错误!
只看楼主
独孤无痕
Rank: 1
等 级:新手上路
威 望:2
帖 子:159
专家分:0
注 册:2006-7-12
 问题点数:0 回复次数:2 
[求助]spring+hibernate出了错误!

HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet message threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)

root cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'send' defined in ServletContext resource [/WEB-INF/message-servlet.xml]: Can't resolve reference to bean 'sendDAO' while setting property 'sendDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sendDAO' defined in ServletContext resource [/WEB-INF/message-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [net.sf.hibernate.SessionFactory] for property 'sessionFactory']

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:180)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1013)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:824)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
报了很长的错误,但是我真的不知道原因。麻烦各位帮忙。谢谢!
搜索更多相关主题的帖子: spring hibernate 
2007-04-14 00:01
无理取闹
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:53
帖 子:4264
专家分:0
注 册:2006-7-26
得分:0 
Error creating bean with name 'send' defined in ServletContext resource [/WEB-INF/message-servlet.xml]: Can't resolve reference to bean 'sendDAO' while setting property 'sendDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sendDAO' defined in ServletContext resource [/WEB-INF/message-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [net.sf.hibernate.SessionFactory] for property 'sessionFactory']
这些不就是错误么?

win32汇编
病毒 加密
目前兴趣所在
2007-04-14 19:41
独孤无痕
Rank: 1
等 级:新手上路
威 望:2
帖 子:159
专家分:0
注 册:2006-7-12
得分:0 

谢谢楼上的兄弟.我能够看懂这个错误.但是真不知道是哪里错了.为什么不能解析呢.我的配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>




<!--定义映射 -->

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver"></bean>

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="send.do">sendcontrol</prop>
</props>
</property>
</bean>
<!--定义控制器 -->
<bean id="sendcontrol" class="com.message.action.SendController">
<property name="send">
<ref bean="send"/>
</property>
<property name="commandClass">
<value>com.message.vo.Message</value>
</property>
<property name="formView">
<value>Sendmessage.jsp</value>
</property>
<property name="successView">
<value>success.jsp</value>
</property>
</bean>
<bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://192.168.1.2:3306/libing?user=libing&amp;password=libing</value>
</property>
<property name="username">
<value>libing</value>
</property>
<property name="password">
<value>libing</value>
</property>
</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.MySQLDialect</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/message/po/User.hbm.xml</value>
<value>com/message/po/Message.hbm.xml</value>
</list>
</property>
</bean>
<!--定义事务 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!-- 定义事务拦截器bean -->
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>

<!--定义事务处理的代理 -->
<bean id="sendDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="sendDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="create*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>

<!--定义各种DAO -->
<bean id="sendDAO" class="com.message.dao.impl.SendDAOimpl">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!--实现依赖注入 -->
<bean id="send" class="com.message.service.impl.Sendimpl">
<property name="sendDAO">
<ref local="sendDAO"/>
</property>
</bean>
</beans>

谢谢!


2007-04-16 11:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-131742-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018985 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved