| Author |
exception with JPA application
|
Anil Deshpande
Ranch Hand
Joined: Jan 13, 2008
Posts: 117
|
|
This is the code of the application:
persistance.xml
main method:
And the Exception it is throwing is:
How to Solve this Problem?
|
Anil Deshpande
SCJP 1.5, SCWCD 1.5
|
 |
Shannon McGee
Greenhorn
Joined: Oct 01, 2009
Posts: 18
|
|
Hi Anil,
The first thing that caught my eye is that your password is never set. Did you remove it to post the example, or forgot to set it in your code?
It looks like your persistence.xml file is never read. Is it on the classpath?
-Shannon
|
 |
James Sutherland
Ranch Hand
Joined: Oct 01, 2007
Posts: 550
|
|
You are using the wrong persistence unit properties for your connection as you are using EclipseLink, not TopLink,
change to:
<property name="eclipelink.jdbc.url" value="jdbc:mysql://localhost/experiments"/>
<property name="eclipelink.jdbc.user" value="root"/>
<property name="eclipelink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="eclipelink.jdbc.password" value=""/>
<property name="eclipelink.ddl-generation" value="create-tables"/>
<property name="eclipelink.jdbc.connections.min" value="1"/>
<property name="eclipelink.jdbc.connections.max" value="2"/>
<property name="eclipelink.logging.level" value="FINEST"/>
or, since you are using EclipseLink 1.2 which supports JPA 2.0 use the standard JPA 2.0 JDBC properties:
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/experiments"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="eclipelink.ddl-generation" value="create-tables"/>
<property name="eclipelink.jdbc.connections.min" value="1"/>
<property name="eclipelink.jdbc.connections.max" value="2"/>
<property name="eclipelink.logging.level" value="FINEST"/>
|
TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
|
 |
Anil Deshpande
Ranch Hand
Joined: Jan 13, 2008
Posts: 117
|
|
There is no password set for the database. that is why I have not given the password. And After I did the changes to the persistance .xml as indicated by James Still I am getting the exception? I did the both the changes. But still it gives the same problem.
The Exception is
Just to check whether I am using proper driver and url, I tried jdbc program with connection and manager, It works perfectly fine. I don't understand where the problem is?
|
 |
 |
|
|
subject: exception with JPA application
|
|
|