Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:07:14+00:00 2026-06-15T10:07:14+00:00

I’ve a problem in my first grails application. I tried to modify my hibernate

  • 0

I’ve a problem in my first grails application. I tried to modify my hibernate files a hundred times, but I still get this exception:

    | 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>

EDIT: When I write –> everything works, so the error must be anywhere in 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.groovy

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"
        }
    }
...

Any help is appreciated, thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:07:14+00:00Added an answer on June 15, 2026 at 10:07 am

    I removed all hibernate-mappings and used
    static mapping = { table ‘groovy_user’ }
    Thanks to Ian Roberts!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.