1
첫 번째 grails 애플리케이션에 문제가 있습니다. 내 최대 절전 모드가 백 번 파일을 수정했지만, 나는 아직도이 예외를 얻을 :Hibernate "리소스에서 매핑 문서를 파싱 할 수 없음"
| Error 2012-12-03 13:24:23,190 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps:
Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org
.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve
reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframewor
k.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed;
nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource user.hbm.xml
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exceptio
n is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot
resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method
failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource user.
hbm.xml
Line | Method
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 's
essionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanC
reationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is
org.hibernate.InvalidMappingException: Could not parse mapping document from resource user.hbm.xml
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; neste
d exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource user.hbm.xml
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by InvalidMappingException: Could not parse mapping document from resource user.hbm.xml
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by DuplicateMappingException: Duplicate class/entity mapping santrain.User
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
User.groovy :
package test
class User {
Integer id
String f1
String f2
static constraints = {
}
}
있는 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'>
<hibernate-configuration>
<session-factory>
<mapping resource='user.hbm.xml'/>
</session-factory>
</hibernate-configuration>
편집 : 내가 쓸 때 -> 모든 것이 작동하므로 오류는 user.hbm.xml에 있어야합니다 ...
user.hbm.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="test">
<class name="test.User" table="test_user">
<id name="id" column="id" type="java.lang.Integer" />
<property column="f1" name="f1" type="java.lang.String" />
<property column="f2" name="f2" type="java.lang.String" />
</class>
</hibernate-mapping>
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
username = "testuser"
password = "testpass"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/testdb?autoreconnect=true"
}
}
...
어떤 도움을 DataSource.groovy에
가 감사합니다, 감사합니다!
최대 절전 모드 구성 파일은 어디에 있습니까? [그들은 grails-app/conf/hibernate에 있어야합니다.] (http://grails.org/doc/latest/guide/hibernate.html). –
예, 두 파일 모두 grails-app/conf/hibernate에 있습니다. – sbo
'DuplicateMappingException : 중복 클래스/엔티티 매핑 santrain.User' 그게 문제라고 생각합니다. 수업을 도메인 폴더에 넣으시겠습니까? –