How to set up jndi.properties for DataStore?

Posted by FarmBoy on Stack Overflow See other posts from Stack Overflow or by FarmBoy
Published on 2010-05-03T15:53:24Z Indexed on 2010/05/03 15:58 UTC
Read the original article Hit count: 445

Filed under:
|
|
|
|

I'm struggling to set connect a Java program to MySQL using JPA/Hibernate.

I'm currently getting the following error when I try to call createEntityManagerFactory():

[main] ERROR org.hibernate.connection.DatasourceConnectionProvider - Could not find datasource: java:jdbc/myDataDS
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)

Googling seems to indicate that I need a jndi.properties file in META-INF in my classpath, but I can't seem to find any information about what that file should contain in my case.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate