JNDI lookup works fine using lookUp but not when used in persistence.xml of JPA

后端 未结 2 2119
感情败类
感情败类 2021-02-19 10:10

I am using tomcat connection pool, jpa, hibernate. The datasource i created in context.xml of tomcat works fine if I try to get it using :

source = (DataSource)          


        
2条回答
  •  不知归路
    2021-02-19 10:52

    Finally it worked today after i specified the properties below.. because just mentioning the datasource is not enough; we need to specify some properties like which dialect to use. If we specify datasource; we need not specify username , password url of the database ( as all are specified in the datasource configuration itself) .

    Most important point is the way you specify the datasource. It should be complete path: java:/comp/env/jdbc/kids . All this while I was missing the slash just before comp.

    
        java:/comp/env/jdbc/kids
        com.kids.domain.User
        
            
            
            
            
        
    
    

提交回复
热议问题