有时又报这样的错 14:29:51,640 ERROR Configuration:407 - Could not configure datastore from input stream org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing. at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398) at org.hibernate.cfg.Configuration.addResource(Configuration.java:449) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing.映射类型出错仔细检查你的持久化类和数据库字段是否类型一致
org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing.映射类型出错仔细检查你的持久化类和数据库字段是否类型一致 ====================================== 严重同意!!!
用的什么版本?我用你给出的试了一下,觉得configuration没有问题。你看看我的打印出来的log.Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.1.2 Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: autocommit mode: false Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure SEVERE: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQLServerDriver
2006-08-25 11:43:45,437 INFO (Environment.java:464) - Hibernate 3.0.5 2006-08-25 11:43:45,453 INFO (Environment.java:482) - loaded properties from resource hibernate.properties: {hibernate.connection.username=sa, hibernate.connection.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.SQLServerDialect, hibernate.connection.url=jdbc:jtds:sqlserver://2.2.2.102:1433/PFMIS, hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'} 2006-08-25 11:43:45,453 INFO (Environment.java:510) - using CGLIB reflection optimizer 2006-08-25 11:43:45,484 INFO (Environment.java:540) - using JDK 1.4 java.sql.Timestamp handling 2006-08-25 11:43:45,625 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml 2006-08-25 11:43:45,625 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml 2006-08-25 11:43:45,640 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml 2006-08-25 11:43:45,640 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml 2006-08-25 11:43:45,656 ERROR (Configuration.java:1172) - problem parsing configuration/com/power/data/hibernate.cfg.xml org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing. at org.dom4j.io.SAXReader.read(SAXReader.java:358) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168) at org.hibernate.cfg.Configuration.configure(Configuration.java:1112) at com.power.data.HibernateFactory.currentSession(HibernateFactory.java:59
我下载过hibernate3并且用了hibernate.properties方法,出错在上面
2006-08-25 12:30:45,453 DEBUG (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] 2006-08-25 12:30:45,453 DEBUG (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/这个干嘛用的呀
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.power.hibernate">
<class name="FMenu_function" table="menu_function">
<id name="mf_func_id" column="mf_func_id" type="java.lang.String" length="50">
<generator class="assigned"/></id>
<property name="mf_func_desc" column="mf_func_desc" type="java.lang.String" length="50"/>
<property name="mf_fun" column="mf_fun" type="java.lang.String" length="50"/>
<property name="mf_menu_id" column="mf_menu_id" type="java.lang.String" length="50"/>
<property name="java_url" column="java_url" type="java.lang.String" length="50"/>
</class>
</hibernate-mapping>
学得这个连数据库没问题,我以前另一个项目也是这样连,没错过
14:29:51,640 ERROR Configuration:407 - Could not configure datastore from input stream
org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing.
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
error或warning
<generator class="assigned"/></id> 应该是这个问题吧 主键应该为Integer类型
1.把<?xml version='1.0' encoding='UTF-8'?>解成双引号试试
2.把
<mapping resource="/com/power/hibernate/FMenu_function.hbm.xml" />
...
映射文件前面的斜杠拿掉看看~_~
======================================
严重同意!!!
<id name="mf_func_id" column="mf_func_id" type="java.lang.String" length="50">
<generator class="assigned"/></id>
<property name="mf_func_desc" column="mf_func_desc" type="java.lang.String" length="50"/>
<property name="mf_fun" column="mf_fun" type="java.lang.String" length="50"/>
<property name="mf_menu_id" column="mf_menu_id" type="java.lang.String" length="50"/>
<property name="java_url" column="java_url" type=((((("java.lang.String"))))))))))) length="50"/> 我不记得hibernate 里面有 java.lang.String 类型 hibernate type 后边只能接 string int
character binary timetamp
2006-08-18 10:02:46,876 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml
2006-08-18 10:02:46,876 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml
2006-08-18 10:02:46,891 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml
2006-08-18 10:02:46,891 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml
2006-08-18 10:02:46,907 ERROR (Configuration.java:1172) - problem parsing configuration/com/power/data/hibernate.cfg.xml我只留一个了,发现是这个文件错一样,,hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.url">jdbc:microsoft:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=dei_net_ftjls</property>
<property name="connection.username">sa</property>
<property name="connection.password">powerdata</property>
<property name="show_sql">false</property>
<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
</session-factory></hibernate-configuration>
最好是找篇文章看一下,或者是驱动问题也说不定
hibernate.properties
的,,,怎么连法
现在不关MS SQL SERVER的事啦,,现在感觉是读XML,或者 我的XML写得有问题
INFO: Hibernate 3.1.2
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Aug 17, 2006 11:17:57 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Aug 17, 2006 11:17:57 AM org.hibernate.connection.DriverManagerConnectionProvider configure
SEVERE: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQLServerDriver
<class name="FMenu_function" table="menu_function">
<id name="mf_func_id" column="mf_func_id" type="java.lang.String" length="50">
<generator class="assigned"/></id>
你的mf_func_id是业务主键,我建议楼主使用代理主键
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/dei_net_ftjls?useUnicode=true&characterEncoding=GBK
hibernate.connection.username=sa
hibernate.connection.password=powerdata
hibernate.show_sql=true另外,看看xml的头文件定义
一位迷人的女郎夏天开着车子到全国旅行,由于天气实在太热,她全身已经香汗淋漓。开到某个乡下地方时,她看到一座水池,于是她决定停车游个水,凉凉身,她脱光跳进水中,享受几分钟的清凉后,突然发现两位农夫躲在树丛下偷看。由于她的衣服摆在水池的另一边,不过靠近她身边有个澡盆,于是她拿起澡盆遮住身子,往那两位农夫走去。
“你们两个王八蛋,难道没别事好做吗?”她咆哮道,“你们知道我怎么想吗?”
“是的,女士。”个子较高的一位说,“你一定想问我们什么地方可以补你那浴盆上的大窟窿!” www.xiaohua007.com
LZ试试
2006-08-25 11:43:45,453 INFO (Environment.java:482) - loaded properties from resource hibernate.properties: {hibernate.connection.username=sa, hibernate.connection.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.SQLServerDialect, hibernate.connection.url=jdbc:jtds:sqlserver://2.2.2.102:1433/PFMIS, hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'}
2006-08-25 11:43:45,453 INFO (Environment.java:510) - using CGLIB reflection optimizer
2006-08-25 11:43:45,484 INFO (Environment.java:540) - using JDK 1.4 java.sql.Timestamp handling
2006-08-25 11:43:45,625 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml
2006-08-25 11:43:45,625 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml
2006-08-25 11:43:45,640 INFO (Configuration.java:1110) - configuring from resource: /com/power/data/hibernate.cfg.xml
2006-08-25 11:43:45,640 INFO (Configuration.java:1081) - Configuration resource: /com/power/data/hibernate.cfg.xml
2006-08-25 11:43:45,656 ERROR (Configuration.java:1172) - problem parsing configuration/com/power/data/hibernate.cfg.xml
org.dom4j.DocumentException: FWK005 parse may not be called while parsing. Nested exception: FWK005 parse may not be called while parsing.
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at com.power.data.HibernateFactory.currentSession(HibernateFactory.java:59
2006-08-25 12:30:45,453 DEBUG (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/这个干嘛用的呀