NullPointerException in TypeInfoCache.getSQLType - Mailing list pgsql-jdbc

From Zachary Marshall
Subject NullPointerException in TypeInfoCache.getSQLType
Date
Msg-id 1455717036452.5353@sas.com
Whole thread Raw
Responses Re: NullPointerException in TypeInfoCache.getSQLType  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List pgsql-jdbc

Hello,


I am running into a NullPointerException in the Postgres JDBC driver. I am running driver version postgresql-9.4.1208.jre7-SNAPSHOT.jar​. I am running against Postgres server version "PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit". The error occurs when I am starting up my Spring Boot application. Typically this is concurrent with the startup of several dozen other Spring Boot apps, all which use the same Postgres server, but each in an entirely different JVM. These concurrent startups all are typically creating new schemas (then tables and other things in those schemas). If the error occurs, restarting the Spring Boot app resolves it. I have searched google and the mailing list but didn't see any obvious hits (other than the mention of this revert from the 9.4-1205 changelog: https://github.com/pgjdbc/pgjdbc/pull/406). The relevant part of the stack trace is at the end of the email. One possible cause I can imagine is that org.postgresql.jdbc.TypeInfoCache.getPGType(int) returns null (because oid == Oid.UNSPECIFIED)(https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L387) and then org.postgresql.jdbc.TypeInfoCache.getSQLType(String) doesn't correctly handle this null (https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L182).


Has anyone seen this before? Thanks in advance for any help.​


Caused by: java.lang.NullPointerException
at org.postgresql.jdbc.TypeInfoCache.getSQLType(TypeInfoCache.java:182)
at org.postgresql.jdbc.TypeInfoCache.getSQLType(TypeInfoCache.java:178)
at org.postgresql.jdbc.TypeInfoCache.requiresQuoting(TypeInfoCache.java:851)
at org.postgresql.jdbc.PgDatabaseMetaData.getTypeInfo(PgDatabaseMetaData.java:2785)
at org.hibernate.engine.jdbc.spi.TypeInfo.extractTypeInfo(TypeInfo.java:101)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:163)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 22 more


pgsql-jdbc by date:

Previous
From: Pavel Raiskup
Date:
Subject: Re: [HACKERS] Packaging of postgresql-jdbc
Next
From: Vladimir Sitnikov
Date:
Subject: Re: NullPointerException in TypeInfoCache.getSQLType