0

I have Configured the Spring web project with Java Configuration

Datasource with JNDI ( i have configured in context.xml and in web.xml) Spring JPA and Hibernate is configured.

and my pom as below

<properties>
        <hibernate.version>4.2.15.Final</hibernate.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
        </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
  <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- http://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.4.1208.jre7</version>
</dependency>

    </dependencies>

   <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>2.0.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
   </dependencyManagement>

When i request in the controller to get data from the DB the below error is coming

i though its because of the version mismatch with JDBC driver, can you please explain why this error is coming,

if any other details required please let me know.

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/user-hiberante-hana-spatial] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection] with root cause
org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
    at org.postgresql.Driver.notImplemented(Driver.java:753)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:102)
    at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
    at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
    at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:226)
chiranjeevigk
  • 1,636
  • 1
  • 23
  • 43
  • Possible duplicate of [Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented](http://stackoverflow.com/questions/25594279/method-org-postgresql-jdbc4-jdbc4connection-isvalidint-is-not-yet-implemented) – Alan Hay May 20 '16 at 09:54
  • No this is because i use the JNDI where Tomcat DBCP is not supporting.. i have removed JNDI data source and directly connecting its fine now ;) – chiranjeevigk May 20 '16 at 11:36

2 Answers2

0

No this is because i use the JNDI where Tomcat DBCP is not supporting.. i have removed JNDI data source and directly connecting its fine now ;)

chiranjeevigk
  • 1,636
  • 1
  • 23
  • 43
0

Try this solution : Set a validation query for parameter "validationQuery".

For example : dataSource.setValidationQuery("SELECT 1");