source

메서드 org.postgresql.jdbc.PgConnection.createClob()은 아직 구현되지 않았습니다.

nicesource 2023. 1. 28. 09:30
반응형

메서드 org.postgresql.jdbc.PgConnection.createClob()은 아직 구현되지 않았습니다.

이 오류를 해결하려면 어떻게 해야 합니까?

java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
    at org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl.useContextualLobCreation(LobCreatorBuilderImpl.java:113) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl.makeLobCreatorBuilder(LobCreatorBuilderImpl.java:54) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.<init>(JdbcEnvironmentImpl.java:271) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:114) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:861) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:888) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:388) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1085) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:858) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at com.divergent.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na]



Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
    at org.postgresql.Driver.notImplemented(Driver.java:683) ~[postgresql-42.2.1.jar:42.2.1]
    at org.postgresql.jdbc.PgConnection.createClob(PgConnection.java:1252) ~[postgresql-42.2.1.jar:42.2.1]
    ... 44 common frames omitted

application.properties에 다음 속성을 추가합니다.

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

레퍼런스:

이것은 의 문제입니다.Hibernate회피책으로 다음 플래그를 사용할 수 있습니다.그런 다음 속성에서 다음 구성을 설정합니다.

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

스프링 부트 2.x.x의 경우 이 플래그는 단순히 컨텍스트 LOB 생성을 사용하지 않도록 설정하기만 하면 되지만 올바른 답변을 알고 싶다면 UPDATE V1을 확인하십시오.

V1 갱신

이것은 휴지 상태의 문제.Spring Boot의 최신 버전을 사용하는 경우2.0.x까지2.1.x포함한다Hibernate 5.3.10.final여기서 보실 수 있지만 이 문제는 에서 수정되었습니다.Hibernate version 5.4.0.CR1에 의존관계를 추가하거나 가능한 경우 최신 버전을 추가해야 합니다.

Gradle의 경우:

compile('org.hibernate:hibernate-core:5.4.2.Final')

Maven의 경우:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.4.2.Final</version>
</dependency>

V2 "Spring Boot 2.2.0 업데이트"M(1~4)"

게다가.Spring boot v2.2.0.Mx지금 바로 포함Hibernate v5.4.x이 문제는 이 버전에서 수정되었습니다.

저도 비슷한 문제가 있었어요.나는 이 솔루션을 따라 했고, 그것은 나에게 효과가 있었다.

http://vkuzel.blogspot.com/2016/03/spring-boot-jpa-hibernate-atomikos.html

# Disable feature detection by this undocumented parameter. Check the org.hibernate.engine.jdbc.internal.JdbcServiceImpl.configure method for more details.
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false

# Because detection is disabled you have to set correct dialect by hand.
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect

다음 Yaml 구성을 사용하여 해결:

spring:
  jpa:
    properties:
      hibernate:
        jdbc:
          lob:
            non_contextual_creation: true
    database-platform: org.hibernate.dialect.PostgreSQL9Dialect

hibernate.properties를 추가하여 해결합니다.

hibernate.jdbc.lob.non_contextual_creation=true

기타 솔루션:application.properties효과가 없었습니다.이것은 XML hibernate.cfg.xml을 통해서도 실행할 수 있습니다.

스프링 부트 버전: 2.0.2풀어주다

spring:      
  jpa:
    properties:
      hibernate:
        temp:
          use_jdbc_metadata_defaults: false
        jdbc:
          lob:
            non_contextual_creation: true

와 함께

use_jdbc_metadata_defaults: false

또는

non_contextual_creation: true

2개의 아이템은 정상적으로 동작합니다.

스프링 부트 버전 2.1.x에서도 같은 문제가 발생.릴리즈도.다음과 같이 동작합니다.

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 

하루 종일 이것과 씨름했어요.

  • 스프링 부트 버전2.2.5

  • 포스트그레스:42.2.10

  • 서버의 Postgres 버전:PostgreSQL 11.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.9.3, 64-bit

Spring JPA 데이터를 하이버네이트 설정으로 사용하고 있었습니다.session Factory 사용.

휴지 상태 구성:

@Bean(name = "sessionFactory")
@Primary
public LocalSessionFactoryBean sessionFactory(){
    LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
    sessionFactoryBean.setDataSource(assetHealthDataSource);
    sessionFactoryBean.setMappingDirectoryLocations(new Resource[]{new ClassPathResource("mappings")});
    sessionFactoryBean.setHibernateProperties(hibernateProperties());

    return sessionFactoryBean;
}

휴지 상태 속성:

private final Properties hibernateProperties() {
    Properties hibernateProperties = new Properties();
    hibernateProperties.setProperty(
            "hibernate.dialect", "org.hibernate.dialect.PostgreSQL9Dialect");
    hibernateProperties.setProperty(
            "hibernate.jdbc.lob.non_contextual_creation", "true");
    hibernateProperties.setProperty(
            "hibernate.temp.use_jdbc_metadata_defaults", "false");
    hibernateProperties.setProperty(
            "hibernate.show_sql", environment.getProperty("assetHealthDataSource.hibernate.showSQL"));
    hibernateProperties.setProperty(
            "hibernate.format_sql", environment.getProperty("assetHealthDataSource.hibernate.formatSQL"));
    hibernateProperties.setProperty(
            "hibernate.transaction.auto_close_session", "false");
    hibernateProperties.setProperty(
            "hibernate.hibernate.connection.release_mode", "auto");
    hibernateProperties.setProperty(
            "hibernate.hikari.maximumPoolSize", "3");
    hibernateProperties.setProperty(
            "hibernate.default_schema", "MY_SCHEMA");

    return hibernateProperties;
}

하지만 모든 것이 제대로 작동하지 않았다.이 문제를 해결하는 데 도움이 될 만한 제안이 있으면 언제든지 확인해 주십시오.정말 감사합니다.

Grails의 답변(3.3 이상)을 찾고 있는 사람에게는 @Ashutosh의 답변이 나에게 효과가 있었지만 나를 사로잡은 것은 당신의 application.yml 파일에 있습니다.spring.jpa.properties프레픽스[ hibernate ]섹션에 추가합니다.여기서는 사투리를 지정할 수 있습니다.

hibernate:
    dialect: <your dialect>
    jdbc:
        lob:
            non_contextual_creation: true
    temp:
        use_jdbc_metadata_defaults: false

언급URL : https://stackoverflow.com/questions/49110818/method-org-postgresql-jdbc-pgconnection-createclob-is-not-yet-implemented

반응형