Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes problem with jpa+spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "problem with jpa+spring" Watch "problem with jpa+spring" New topic
Author

problem with jpa+spring

hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
i am working a project with jpa+spring+maven+flex
i have this exception in a popup when my application runs :

in the console i have :
i attach to the subject persistence.xml and springconfiguration.xml please help me
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

I cannot see: persistence.xml and springconfiguration.xml. Please, attach them.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
this is applicationContext.xml

this is persistence.xml
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Post the code that tries to open hibernate session.
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
I think it is a problem of configuration not in the code no?
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Try if you can create DB connection with plain JDBC:
http://www.mkyong.com/jdbc/how-do-connect-to-postgresql-with-jdbc-driver-java/

Please, include the whole stacktrace, not just selected pieces.
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
but i should work with jpa
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Yes, I know, but we have to examine if there is any problem in the lower layer.

Please, include the whole stacktrace, not just selected pieces.
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
this is the result


[Thumbnail for 1111111111.png]

hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
result


[Thumbnail for 22222222222222222.png]

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

You have executed it incorrectly. You should give the name of the Main class:

C:\test>java -cp c:\test\postgresql-8.3-603.jdbc4.jar;c:\test JDBCExample

Where JDBCExample is the class with main method.
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
yes i excute it with the name of the class of the main


[Thumbnail for 12.png]

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

No, because you do not have space between your classpath and Main class. You have just specified classpath.
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
i have made the space because i followed the tuto ,it doesn't workkkkkk :\


[Thumbnail for oooooooooooooooooo.png]

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

You should try this:
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample

NOT
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test\JDBCExample.java
AND NOT
C:\test>java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test\JDBCExample
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
thanks i have this result


[Thumbnail for looooooooooooooooooooooooooooooooo.png]

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

You have typed BAD command once again. Please, stay focused and type:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample

Pay attention to every single sign and space!
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
it doesn't work please what is the error now ?


[Thumbnail for cccccccccccccccccccccccc.png]

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

You have typed:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\testJDBCExample

You SHOULD type:

java -cp c:\test\postgresql-8.1-404.jdbc3.jar;c:\test JDBCExample


hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
it didn't work also :\ :\


[Thumbnail for naaaaaaaaaaaaaa.png]

hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
i have :-------- PostgreSQL JDBC Connection Testing ------------
PostgreSQL JDBC Driver Registered!
You made it, take control your database now!
hana jenhani
Greenhorn

Joined: May 05, 2013
Posts: 18
how i can be sure that the problem is not from mey server?
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

OK, we are sure that your DB is accessible from the code.

You gave us the exception:
org.springframework.transaction.CannotCreateTransactionException : Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
null

Please paste the full stack trace despite the fact that it can be very long.
 
wood burning stoves
 
subject: problem with jpa+spring
 
Similar Threads
Exception starting filter in Struts2
Http Status 404 - Unable to configure TOMCAT 7.0 in ECLIPSE (JUNO) version
java.lang.ClassNotFoundException: org.apache.wicket.protocol.http.WicketFilter
Problem with tiles plugin in struts 1.3.8
Null pointer Exception when insert new record to database using struts2 and hibernate3