Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

The debug process for PersistenceException  RSS feed

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upon attempting to start my web application. I get the exception "javax.persistence.PersistenceException: [PersistenceUnit: persistence_unit] Unable to build Hibernate SessionFactory".
I expect that this exception is caused by some incorrect configuration somewhere in the persistence.xml file and some incorrect configuration in my JPA-annotated code. But, i want to know what exactly is it. The problem however is that the exception message doens't say much.
What should i do if i want to be able to perilously find out what's causing the exception.

Note: I am using Spring REST + JPA (Hibernate implementation) connecting to a mysql database on a tomcat servlet container.
 
Bartender
Posts: 19735
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be more information than that in the stack trace.

However, you can also set debug logging options to get a better look at What Hibernate is trying to do.
 
Toni Lane
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the last cause exception.
The resulting exceptions were about how spring can't create "entityManager" bean.
I am now researching hibernate logging. Any guides on that are appreciated.
 
Tim Holloway
Bartender
Posts: 19735
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Toni Lane wrote:That's the last cause exception.
The resulting exceptions were about how spring can't create "entityManager" bean.
I am now researching hibernate logging. Any guides on that are appreciated.



The reason that no SessionFactory could be built was because the prerequisite EntityManager could not be created.

I know that stack traces are long, dreary and boring, and believe me, we get buried in enough excessive detail on questions that we do appreciate it when people try and keep it short, but in this case, we really do need you to copy and paste the entire stack trace from the log.

Here's the documentation on getting Hibernate to log: http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging
 
Toni Lane
Ranch Hand
Posts: 30
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the delayed response.
I learned Log4j2 and used it to debug the issue.
I was able to find the cause in the logs.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!