0 0

org.hibernate.InvalidMappingException: Could not parse mapping document from5

照网上方法,试了很多,但仍解决不了。

=========================================================================================================

12:01:14,672  INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

12:01:14,721  INFO Version:41 - HHH000412: Hibernate Core {4.1.10.Final}

12:01:14,731  INFO Environment:239 - HHH000206: hibernate.properties not found

12:01:14,734  INFO Environment:342 - HHH000021: Bytecode provider name : javassist

12:01:14,783  INFO Configuration:1926 - HHH000043: Configuring from resource: /hibernate.cfg.xml

12:01:14,784  INFO Configuration:1945 - HHH000040: Configuration resource: /hibernate.cfg.xml

12:01:15,199  INFO Configuration:718 - HHH000221: Reading mappings from resource: cn/jhost/alibaba/user/vo/UserModel.hbm.xml

12:01:15,522  INFO Configuration:2067 - HHH000041: Configured SessionFactory: null

org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/jhost/alibaba/user/vo/UserModel.hbm.xml

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3423)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3412)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3400)

at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1330)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1730)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781)

at cn.jhost.alibaba.common.HibernateUtil.<clinit>(HibernateUtil.java:13)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:68)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:1)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:22)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:1)

at cn.jhost.alibaba.user.business.factory.UserEbiFactory.main(UserEbiFactory.java:20)

Caused by: org.hibernate.PropertyNotFoundException: field [password] not found on cn.jhost.alibaba.user.vo.UserModel

at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)

at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)

at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)

at org.hibernate.internal.util.ReflectHelper.getter(ReflectHelper.java:253)

at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)

at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:324)

at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2311)

at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2276)

at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2166)

at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:407)

at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:322)

at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:173)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3420)

... 11 more

Exception in thread "main" java.lang.NullPointerException

at cn.jhost.alibaba.common.HibernateUtil.currentSession(HibernateUtil.java:26)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:68)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:1)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:22)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:1)

at cn.jhost.alibaba.user.business.factory.UserEbiFactory.main(UserEbiFactory.java:20)

===============================================================================================

<?xml version="1.0" encoding='utf-8'?>

<!DOCTYPE hibernate-mapping PUBLIC 

"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

 

<hibernate-mapping>

 

    <class name="cn.jhost.alibaba.user.vo.UserModel" table="tbl_user"  dynamic-insert="true" dynamic-update="true" optimistic-lock="version">

    <id name="uuid">

    <generator class="uuid"/>

    </id>

    <version name="version" column="version"/>

    <property name="name" column="name" />

    <property name="password" column="password"/>

<property name="type" column="type"/>

 

</class>

 

</hibernate-mapping>

====================================================================================

<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

 

<hibernate-configuration>

 

    <session-factory>

 

        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>

        <property name="connection.url">jdbc:mysql://localhost:3306/alibaba?useUnicode=true&amp;characterEncoding=UTF-8</property>

        <property name="connection.username">root</property>

        <property name="connection.password">123456</property>

 

<property name="c3p0.min_size">5</property>

        <property name="c3p0.max_size">20</property>

        <property name="c3p0.timeout">180</property>

        <property name="c3p0.max_statements">5</property>

        

        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

 

        <!-- Enable Hibernate's automatic session context management -->

        <property name="current_session_context_class">thread</property>

 

        <property name="show_sql">true</property>

<property name="format_sql">true</property>

 

 

        <mapping resource="cn/jhost/alibaba/user/vo/UserModel.hbm.xml"/>

 

    </session-factory>

 

</hibernate-configuration>

2013年5月01日 12:07

2个答案 按时间排序 按投票排序

0 0

采纳的答案

org.hibernate.PropertyNotFoundException: field [password] not found on cn.jhost.alibaba.user.vo.UserModel

你的cn.jhost.alibaba.user.vo.UserModel 里边有 password属性吗?  贴下看看

2013年5月01日 12:49
0 0

错误不是很明显了么?
Caused by: org.hibernate.PropertyNotFoundException: field [password] not found on cn.jhost.alibaba.user.vo.UserModel

cn.jhost.alibaba.user.vo.UserModel这个类中没有password属性,而你的配置文件中确有这个字段,检查一下吧。

2013年5月01日 12:46

相关推荐

    java.text.ParseException: Unparseable date: 2/10/2010 15:20:05

    在Java编程中,`ParseException` 是 `java.text.ParseException` 类的一个异常,通常在尝试解析日期或时间字符串时遇到无法解析的格式时抛出。在给定的标题 "java.text.ParseException: Unparseable date: 2/10/2010...

    annotations.zip

    Android Build 时报错: java.io.IOException: Could not parse XML from android/accounts/annotati...Android构建时报错: app:lintVitalRelease[Fatal Error] :3:214: 与元素类型 “item” 相关联的 “name” ...

    JSqlparser4.4版作者提供的应急版,解决无法解析mysql中JSON_OBJECT函数存在其它函数问题

    SELECT JSON_ARRAYAGG(obj) FROM (SELECT trt.relevance_id,JSON_OBJECT('id',CAST(trt.id AS CHAR),'taskName',trt.task_name,'openStatus',trt.open_status,'taskSort',trt.task_sort) as obj FROM tb_review_task...

    httpcomponents-client-4.5.9.zip

    import org.apache.http.ParseException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; import ...

    java调用net开发的webservice实例

    javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing '- WSDL Document -'.: org.xml.sax.SAXParseException: The element type "p" must be terminated by the matching end-tag ...

    py4j源码安装包源码

    安装JayDeBeApi时,如果报错,提示:error: Could not find suitable distribution for Requirement.parse('py4j') 需要先安装这个py4j

    El表达式使用问题javax.el.ELException:Failed to parse the expression的解决方式

    然而,当出现`javax.el.ELException: Failed to parse the expression`错误时,这通常意味着EL表达式没有被正确解析,导致程序无法正常运行。该错误通常是由于违反了EL表达式的语法规则,或者尝试执行了不合法的操作...

    annotations.zip app:lintVitalRelease[Fatal Error] :3:214: 与元素类型 “item” 相关联的 “nam

    用于解决,Android构建APk时报错: ...java.io.IOException: Could not parse XML from android/accounts/annotations.xml 将上述文件替换替换SDK目录下的/platform-tools/api/下对应的文件即可解决

    通过import org.springframework.web.multipart.MultipartFile;上传文件

    通过import org.springframework.web.multipart.MultipartFile;上传文件的一个工具性的jar.

    Jboss启动报Failed to parse WEB-INFweb.xml; - nested throwable错误

    Jboss启动报Failed to parse WEB-INF/web.xml; - nested throwable错误解决方案 在Jboss应用服务器中,启动报错Failed to parse WEB-INF/web.xml; - nested throwable是一种常见的错误,本文将对此错误进行深入分析...

    Downloads.zip

    Could not read /Users/panxin/Library/Android/sdk/platform-tools/api/annotations.zip java.io.IOException: Could not parse XML from annotations/android/widget/annotations.xml 请将本文件解压后的...

    asm5.0.jar

    nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis- config.xml]; nested exception is org.apache.ibatis.builder....

    pytz-2020.1.tar.gz

    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytz&gt;=2010') 下载后解压安装 tar zxvf pytz-2020.1.tar.gz cd pytz python setup.py install

    hive函数大全(中文版)

    1. UNIX时间戳转日期函数: from_unixtime 18 2. 获取当前UNIX时间戳函数: unix_timestamp 18 3. 日期转UNIX时间戳函数: unix_timestamp 18 4. 指定格式日期转UNIX时间戳函数: unix_timestamp 18 5. 日期时间转日期...

    解决dbf Failed to parse Number: For input string: "-.---"

    本文将深入探讨标题和描述中提到的问题:“解决dbf Failed to parse Number: For input string: "-.---""”,以及如何在不依赖特定jar包的情况下处理DBF文件。 首先,"Failed to parse Number: For input string: ...

    org.jsoup.zip

    "org.jsoup.zip" 是一个与Java相关的压缩包文件,它包含了一个名为 "org.jsoup" 的开发包以及一些相关资源。这个开发包是用于处理HTML解析和提取数据的库,非常适用于网页抓取和数据挖掘任务。以下是关于org.jsoup库...

    org.apache.commons.lang.StringEscapeUtils

    解决json数据中,返回的数据格式中带有反斜杠 如下所示{\"Count\":\"3\",\"ErrorString\":\"\",\"Success\":true,\"URL\":\"http:\\\/\\\/172.16.80.65:8080\\\/LoginSSO.aspx?UserCode=wubg&Type=WorkItem\",\...

    AndroidSDK下/platform-tools/api/annotations.zip

    编译时遇到以下报错:app:...java.io.IOException: Could not parse XML from annotations/android/widget/annotations.xml 请将本文件替换SDK目录下的/platform-tools/api/annotations.zip文件,建议替换前备份原文件

    dom4j解析XML(带jar包了).

    3. **读取XML文件**:使用`DocumentFactory`的`parse()`方法,传入XML文件的路径,来读取XML文件并生成`Document`对象。 ```java File file = new File("mjy.xml"); DocumentFactory factory = DocumentFactory....

    Android代码-PhotoDraweeView

    PhotoDraweeView PhotoView For Fresco ...mPhotoDraweeView.setPhotoUri(Uri.parse("http://your.image.url")); Using the ControllerBuilder PipelineDraweeControllerBuilder controller = Fres

Global site tag (gtag.js) - Google Analytics