| Author |
Exception while getting transaction
|
Max Vaha
Greenhorn
Joined: Nov 27, 2007
Posts: 29
|
|
Hello, ranchers! I have the following method in a JSF bean I have tried this code with MySql and Postgres, application server is Tomcat 6.14. This is the exception: Has anyone any ideas about this? [ June 09, 2008: Message edited by: Max Vaha ]
|
 |
Rodrigo Lopes
Ranch Hand
Joined: Feb 29, 2008
Posts: 118
|
|
|
Please, show how your datasource is configured in the hibernate.cfg.xml file.
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
It does look like a datasource problem, that's for sure. Perhaps you have a way of testing your datasource apart from Hibernate? Like just write some code that looks it up, opens a db connection, queries the database, and closes the connection? If there's an easy way to do that, it might be worth your time. Your hibernate.cfg.xml file might have a peculiar setting as well. Post it and maybe there's something in there that stands out. Database, app server and how the datasource is being managed or created might be great info as well. -Cameron McKenzie
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14460
|
|
|
I think you need to show how your datasource is configured in Tomcat.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Max Vaha
Greenhorn
Joined: Nov 27, 2007
Posts: 29
|
|
I want to use hibernate as a JPA provider, so do I need hibernate.cfg.xml? This is persistence.xml Context.xml in tomcat I checked connection using my IDE. It's ok.
|
 |
Rodrigo Lopes
Ranch Hand
Joined: Feb 29, 2008
Posts: 118
|
|
I believe that you don't need these lines in your persistence.xml file: They are already in your tomcat config (context.xml) When you call em.getTransaction(); you're asking the container for a new connection. But if you keep these properties in your persistence.xml, then you're saying that hibernate will handle you connections, not the container [ June 10, 2008: Message edited by: Rodrigo Lopes ]
|
 |
Max Vaha
Greenhorn
Joined: Nov 27, 2007
Posts: 29
|
|
Hmm, thanks, but the same exception is thrown without these properties in persistence.xml. It is thrown even if there is no properties. Has anyone other idea's? [ June 17, 2008: Message edited by: Max Vaha ]
|
 |
Max Vaha
Greenhorn
Joined: Nov 27, 2007
Posts: 29
|
|
|
Thanks! Finally it is done!
|
 |
 |
|
|
subject: Exception while getting transaction
|
|
|