Invocation of init method failed; 无法解析hibernate配置文件
刚才傻了,不小心按错了给结贴了...==.重发一张吧..小妹我是新人,没有多少分的,先这些把.不过答的好解决了可以追加Invocationofinitmethodfail...
刚才傻了,不小心按错了给结贴了...= = .重发一张吧..
小妹我是新人,没有多少分的,先这些把.不过答的好解决了可以追加
Invocation of init method failed; 无法解析hibernate配置文件
悬赏分: - 解决时间:2010-3-24 13:25
求高手帮忙解答一下,我这是SSH整合过程中,由于User.hbm.xml不能解析导致org.springframework.beans.factory.BeanCreationException,spring配置文件老是出错,问题在什么地方,怎么解决啊,先谢谢各位大侠了.
这是User.java类
package com.asps.entity;
public abstract class User {
private Integer userid;
private String username;
private String password;
private String capabilities;
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCapibilities() {
return capabilities;
}
public void setCapibilities(String capibilities) {
this.capabilities = capibilities;
}
}
User.hbm.xml文件
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.asps.entity">
<class name="User" table="user">
<id name="userid" column="userID">
</id>
<property name="username" column="username" />
<property name="password" column="password" />
<property name="capabilities" column="capabilities" />
</class>
</hibernate-mapping>
applicationContext.xml
配置session部分
<bean id="_sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
<!-- 配置HibernateTemplate,注入SessionFactory属性 -->
<bean id="_hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="_sessionFactory"/>
</bean>
<bean id="AdminAction" class="com.asps.action.AdminAction">
<property name="userdaoimpl" ref="userdaoimpl"/>
</bean>
<bean id="userdaoimpl"
class="com.asps.daoimpl.UserDaoImpl" parent="_baseDaoTemplate">
</bean>
<bean id="_baseDaoTemplate" abstract="true">
<property name="hibernateTemplate" ref="_hibernateTemplate"></property>
</bean>
提问者: ningnwind - 二级最佳答案<bean id="_baseDaoTemplate" abstract="true">
abstract="true"去掉试试
0回答者: shiryu963 展开
小妹我是新人,没有多少分的,先这些把.不过答的好解决了可以追加
Invocation of init method failed; 无法解析hibernate配置文件
悬赏分: - 解决时间:2010-3-24 13:25
求高手帮忙解答一下,我这是SSH整合过程中,由于User.hbm.xml不能解析导致org.springframework.beans.factory.BeanCreationException,spring配置文件老是出错,问题在什么地方,怎么解决啊,先谢谢各位大侠了.
这是User.java类
package com.asps.entity;
public abstract class User {
private Integer userid;
private String username;
private String password;
private String capabilities;
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCapibilities() {
return capabilities;
}
public void setCapibilities(String capibilities) {
this.capabilities = capibilities;
}
}
User.hbm.xml文件
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.asps.entity">
<class name="User" table="user">
<id name="userid" column="userID">
</id>
<property name="username" column="username" />
<property name="password" column="password" />
<property name="capabilities" column="capabilities" />
</class>
</hibernate-mapping>
applicationContext.xml
配置session部分
<bean id="_sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
<!-- 配置HibernateTemplate,注入SessionFactory属性 -->
<bean id="_hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="_sessionFactory"/>
</bean>
<bean id="AdminAction" class="com.asps.action.AdminAction">
<property name="userdaoimpl" ref="userdaoimpl"/>
</bean>
<bean id="userdaoimpl"
class="com.asps.daoimpl.UserDaoImpl" parent="_baseDaoTemplate">
</bean>
<bean id="_baseDaoTemplate" abstract="true">
<property name="hibernateTemplate" ref="_hibernateTemplate"></property>
</bean>
提问者: ningnwind - 二级最佳答案<bean id="_baseDaoTemplate" abstract="true">
abstract="true"去掉试试
0回答者: shiryu963 展开
展开全部
你说User.hbm.xml这个文件无法解析,意思是不是其他的hbm.xml可以解析?
简单看了一下,User.hbm.xml中各个属性的配置没有类型,问题应该出在这里吧,你改完试试
简单看了一下,User.hbm.xml中各个属性的配置没有类型,问题应该出在这里吧,你改完试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询