Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not parse configuration: /hibernate.cfg.xml

 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I know little about hibernate, and then decided to explore this framework and came across an error!

Could anyone help me?

My application is returning me the following error:


Here is my hibernate.cfg.xml:


Mapping (Cadastro.hbm.xml):


Thank you guys!
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes, is the XML declaration which you do in the first 3 or 4 lines contains an extra space or some extra character, it's possible that you might get this error.
Also your properties in HBM files have no mapped columns. Is that okay? I'm not sure about that. It's been long time since I worked in hibernate.
 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other research found that people resolvero your problem by removing a blank header but already checked mine and found nothing that is strange. I added the columns in my HBM and still continue with the error. I'm lost

Thank you!

 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try opening the xml in IE and check if there are any errors.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the file in classpath and is it able to find the file?
 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried a little more and got out the error!

I changed the link in the header
The configuration file looks like this (hibernate.cfg.xml):
by:
and hbm.xml
by:
 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I now have a new error and I am trying to solve! any information is welcome!

the new error:

Thank you!
 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolvido!

Estava faltando um JAR.
Importei o: javassist-3.12.0.GA.jar.

New error!


I'm trying to solve here!

Thank you!
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try setting this property - "hibernate.current_session_context_class" in your configuration file.
This Link might help.
 
Leonardo Terrao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Arun Kumarr!

I added the following lines in my hibernate.cfg.xml:


Now it's working!

The file looks like this:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic