teiid / teiid-spring-boot

Teiid Spring Boot is fast way to get to your Data Virtualizations projects using Teiid and Spring Boot
https://teiid.io
Apache License 2.0
46 stars 63 forks source link

Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null #316

Open Gamezpedia opened 3 years ago

Gamezpedia commented 3 years ago

Hi,

I am trying out this starter for the first time using this example : rdbms

But i am getting the below exception: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null

2021-06-22 01:29:57.683  WARN 1204195 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null

I am not sure what is wrong with it, as you can see that it found the data source but still throwing exception am i missing something ?

2021-06-22 01:36:47.253  INFO 1205224 --- [           main] o.t.s.a.TeiidBeanDefinitionPostProcessor : Found data sources: [db]

Project Configurations :

# JPA
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.generate-ddl=false

# DATA SOURCES
spring.datasource.db.jdbc-url=jdbc:postgresql://localhost:15432/db
spring.datasource.db.username=postgres
spring.datasource.db.password=password
spring.datasource.db.driver-class-name=org.postgresql.Driver
spring.datasource.db.platform=db
spring.datasource.db.pool-size=10
#spring.datasource.db.maximumPoolSize=5
spring.datasource.db.minimumIdle=0

# TEIID
spring.datasource.db.importer.SchemaPattern=public
spring.teiid.model.package=com.test
#spring.teiid.file.parent-directory=src/main/resources

#teiid.jdbc-enable=true
#teiid.jdbc-port=15432
#teiid.pg-enable=true
#teiid.pg-port=15432

logging.level.org.teiid.spring=DEBUG

My DataSourceConfiguration File:

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class DataSources {

    @ConfigurationProperties(prefix = "spring.datasource.db")
    @Bean
    public HikariDataSource db() {
        return DataSourceBuilder.create().type(HikariDataSource.class).build();
    }

    //.. REST OF THE SOURCES DOWN BELOW

}

My POM.xml


<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.1</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<!--    DATA JPA    -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<!--    POSTGRES    -->
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <scope>runtime</scope>
</dependency>

<!--    TEIID   -->
<dependency>
    <groupId>org.teiid</groupId>
    <artifactId>teiid-spring-boot-starter</artifactId>
    <version>1.7.1</version>
</dependency>

Here is the complete Log

2021-06-22 01:36:46.168  INFO 1205224 --- [           main] c.v.s.Application            : Starting Application using Java 15.0.3 on test with PID 1205224 (/.../target/classes started by test in /.../)
2021-06-22 01:36:46.172  INFO 1205224 --- [           main] c.v.s.Application            : The following profiles are active: dev
2021-06-22 01:36:47.124  INFO 1205224 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-22 01:36:47.183  INFO 1205224 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 51 ms. Found 1 JPA repository interfaces.
2021-06-22 01:36:47.253  INFO 1205224 --- [           main] o.t.s.a.TeiidBeanDefinitionPostProcessor : Found data sources: [db]
2021-06-22 01:36:47.372  INFO 1205224 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.teiid.spring.autoconfigure.TransactionManagerConfiguration' of type [org.teiid.spring.autoconfigure.TransactionManagerConfiguration$$EnhancerBySpringCGLIB$$e85c9080] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 01:36:47.381  INFO 1205224 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'platformTransactionManagerAdapter' of type [org.teiid.spring.autoconfigure.PlatformTransactionManagerAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 01:36:47.591  INFO 1205224 --- [           main] o.t.s.a.TeiidAutoConfiguration           : Starting Teiid Server.
2021-06-22 01:36:48.240  INFO 1205224 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 01:36:48.243  INFO 1205224 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 01:36:48.259  WARN 1205224 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/sourcereader/application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
2021-06-22 01:36:48.284  INFO 1205224 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-22 01:36:48.307 ERROR 1205224 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.1.jar:2.5.1]
    at com.test.Application.main(Application.java:12) ~[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:610) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.8.jar:5.3.8]
    ... 21 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.teiid.spring.autoconfigure.TeiidServer.buildModelFromDataSource(TeiidServer.java:409) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.teiid.spring.autoconfigure.TeiidServer.addDataSource(TeiidServer.java:155) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.teiid.spring.autoconfigure.TeiidPostProcessor.postProcessAfterInitialization(TeiidPostProcessor.java:114) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.8.jar:5.3.8]
    ... 33 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:53737', transport: 'socket'

Process finished with exit code 1

Any help is very much appreciated thanks

rareddy commented 3 years ago

is there any reason to use HikariDataSource? Based on the data source configured the code tries to find the driver name like postgres jdbc driver class, then it maps that to the translator it needs to use. This is all fine, but for some reason, it seems to not find the translator with the given driverName by HikariDataSource. If you run in debug you will see the driver name, it should match up to https://github.com/teiid/teiid-spring-boot/blob/master/data/postgresql/src/main/java/org/teiid/spring/data/postgresql/PostgresqlDataSourceConfiguration.java#L23 may be you can verify that?

rareddy commented 3 years ago

try adding

<dependency>
   <groupId>org.teiid</groupId>
   <artifactId>spring-data-postgresql</artifactId>
</dependency>
Gamezpedia commented 3 years ago

Oh i forgot to revert it back to normal, basically i tried to find some clues but :D.

I just ran it again in debug mode with normal DataSource configs. but the same results.

@ConfigurationProperties(prefix = "spring.datasource.db")
    @Bean
    public DataSource db() {
        return DataSourceBuilder.create().build();
    }

with :

<dependency>
   <groupId>org.teiid</groupId>
   <artifactId>spring-data-postgresql</artifactId>
</dependency>

Maven Error:

Dependency 'org.teiid:spring-data-postgresql:' not found

Edit:

i couldn't find the driver name in the logs.

Gamezpedia commented 3 years ago

Logs with Debug Mode:


:: SERVICE :: Running Spring Boot 2.5.1 :: \ö/

2021-06-22 20:53:38.510  INFO 837544 --- [           main] c.v.s. Application            : Starting Application using Java 15.0.3 on test with PID 837544 (/.../target/classes started by test in /.../)
2021-06-22 20:53:38.513  INFO 837544 --- [           main] c.v.s. Application            : The following profiles are active: dev
2021-06-22 20:53:38.513 DEBUG 837544 --- [           main] o.s.boot.SpringApplication               : Loading source class com.test.Application
2021-06-22 20:53:38.558 DEBUG 837544 --- [           main] onfigReactiveWebServerApplicationContext : Refreshing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@43b9fd5
2021-06-22 20:53:39.366  INFO 837544 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-22 20:53:39.379 DEBUG 837544 --- [           main] o.s.b.a.AutoConfigurationPackages        : @EnableAutoConfiguration was declared on a class in the package 'com.test'. Automatic @Repository and @Entity scanning is enabled.
2021-06-22 20:53:39.444  INFO 837544 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 69 ms. Found 1 JPA repository interfaces.
2021-06-22 20:53:39.510  INFO 837544 --- [           main] o.t.s.a.TeiidBeanDefinitionPostProcessor : Found data sources: [db]
2021-06-22 20:53:39.642  INFO 837544 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.teiid.spring.autoconfigure.TransactionManagerConfiguration' of type [org.teiid.spring.autoconfigure.TransactionManagerConfiguration$$EnhancerBySpringCGLIB$$b4a087e0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 20:53:39.652  INFO 837544 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'platformTransactionManagerAdapter' of type [org.teiid.spring.autoconfigure.PlatformTransactionManagerAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 20:53:39.877  INFO 837544 --- [           main] o.t.s.a.TeiidAutoConfiguration           : Starting Teiid Server.
DEBUG StatusLogger org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!
2021-06-22 20:53:40.516  INFO 837544 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 20:53:40.518  INFO 837544 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 20:53:40.536  WARN 837544 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/ /application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
2021-06-22 20:53:40.611 DEBUG 837544 --- [           main] ConditionEvaluationReportLoggingListener : 

============================
CONDITIONS EVALUATION REPORT
============================

Positive matches:
-----------------

Exclusions:
-----------

    None

Unconditional classes:
----------------------

    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.availability.AvailabilityHealthContributorAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoConfiguration

    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration

    org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.metrics.integration.IntegrationMetricsAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration

    org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration

    org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration

    org.teiid.spring.autoconfigure.TeiidBeanDefinitionPostProcessor

    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration

2021-06-22 20:53:40.633 ERROR 837544 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/ /application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.1.jar:2.5.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.1.jar:2.5.1]
    at com.test.Application.main(Application.java:12) ~[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'db' defined in class path resource [com/test/application/DataSources.class]: Initialization of bean failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:610) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.8.jar:5.3.8]
    ... 21 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "org.teiid.spring.common.ExternalSource.getTranslatorName()" because "es" is null
    at org.teiid.spring.autoconfigure.TeiidServer.buildModelFromDataSource(TeiidServer.java:409) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.teiid.spring.autoconfigure.TeiidServer.addDataSource(TeiidServer.java:155) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.teiid.spring.autoconfigure.TeiidPostProcessor.postProcessAfterInitialization(TeiidPostProcessor.java:114) ~[teiid-spring-boot-starter-1.7.1.jar:1.7.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ~[spring-beans-5.3.8.jar:5.3.8]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.8.jar:5.3.8]
    ... 33 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:38721', transport: 'socket'

Process finished with exit code 1
rareddy commented 3 years ago

for Maven dependency here are maven co-ordinates https://search.maven.org/artifact/org.teiid/spring-data-postgresql that should resolve without that there is no translator configured

Gamezpedia commented 3 years ago

the above solution worked and the application started successfully but with some exceptions :

The application must supply JDBC connections

2021-06-22 21:18:59.180  INFO 842086 --- [           main] o.s.j.d.e.EmbeddedDatabaseFactory        : Starting embedded database: url='jdbc:teiid:spring;PassthroughAuthentication=true;useCallingThread=true;autoFailover=true;waitForLoad=5000;autoCommitTxn=OFF;disableLocalTxn=true', username='null'

If i guess correctly it looks like it is not getting user name and the password .

the Logs

2021-06-22 21:18:57.725  INFO 842086 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-22 21:18:57.794  INFO 842086 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 61 ms. Found 1 JPA repository interfaces.
2021-06-22 21:18:57.866  INFO 842086 --- [           main] o.t.s.a.TeiidBeanDefinitionPostProcessor : Found data sources: [db]
2021-06-22 21:18:57.995  INFO 842086 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.teiid.spring.autoconfigure.TransactionManagerConfiguration' of type [org.teiid.spring.autoconfigure.TransactionManagerConfiguration$$EnhancerBySpringCGLIB$$59279b6f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 21:18:58.005  INFO 842086 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'platformTransactionManagerAdapter' of type [org.teiid.spring.autoconfigure.PlatformTransactionManagerAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-06-22 21:18:58.240  INFO 842086 --- [           main] o.t.s.a.TeiidAutoConfiguration           : Starting Teiid Server.
2021-06-22 21:18:58.851  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 21:18:58.854  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 21:18:59.000  INFO 842086 --- [           main] o.t.spring.autoconfigure.TeiidServer     : Added db to the Teiid Database
2021-06-22 21:18:59.000  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40120 VDB spring.1.0.0 will be removed from the repository
2021-06-22 21:18:59.001  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40119 VDB spring.1.0.0 removed from the repository
2021-06-22 21:18:59.011  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 21:18:59.013  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "db" metadata is currently being loaded. Start Time: 6/22/21, 9:18 PM
2021-06-22 21:18:59.035  INFO 842086 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-06-22 21:18:59.107  INFO 842086 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-06-22 21:18:59.120  INFO 842086 --- [           main] org.teiid.CONNECTOR                      : PostgreSQLExecutionFactory Commit=true;DatabaseProductName=PostgreSQL;DatabaseProductVersion=13.3 (Debian 13.3-1.pgdg100+1);DriverMajorVersion=42;DriverMajorVersion=2;DriverName=PostgreSQL JDBC Driver;DriverVersion=42.2.20;IsolationLevel=2
2021-06-22 21:18:59.173  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "db" metadata loaded. End Time: 6/22/21, 9:18 PM
2021-06-22 21:18:59.174  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 21:18:59.174  INFO 842086 --- [           main] o.t.s.autoconfigure.TeiidPostProcessor   : Datasource added to Teiid = db
2021-06-22 21:18:59.180  INFO 842086 --- [           main] o.s.j.d.e.EmbeddedDatabaseFactory        : Starting embedded database: url='jdbc:teiid:spring;PassthroughAuthentication=true;useCallingThread=true;autoFailover=true;waitForLoad=5000;autoCommitTxn=OFF;disableLocalTxn=true', username='null'
2021-06-22 21:18:59.259  INFO 842086 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-06-22 21:18:59.277  INFO 842086 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-06-22 21:18:59.379  INFO 842086 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-06-22 21:18:59.459  INFO 842086 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2021-06-22 21:18:59.580  WARN 842086 --- [           main] org.teiid.PROCESSOR                      : TEIID30020 Processing exception for request 242jnPGG9nlm.1 'Group does not exist: information_schema.sequences'. Originally QueryResolverException ResolverUtil.java:929. Enable more detailed logging to see the entire stacktrace.
2021-06-22 21:18:59.585 ERROR 842086 --- [           main] o.h.e.j.e.internal.JdbcEnvironmentImpl   : Could not fetch the SequenceInformation from the database

org.teiid.jdbc.TeiidSQLException: Group does not exist: information_schema.sequences
    at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:131) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:67) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl.postReceiveResults(StatementImpl.java:786) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:62) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:584) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.client.util.ResultsFuture.addCompletionListener(ResultsFuture.java:144) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:580) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:423) ~[teiid-client-16.0.0.jar:16.0.0]
    at org.teiid.jdbc.StatementImpl.executeQuery(StatementImpl.java:354) ~[teiid-client-16.0.0.jar:16.0.0]
    ....
    at com.test.main(Application.java:12) ~[classes/:na]
Caused by: org.teiid.api.exception.query.QueryResolverException: Group does not exist: information_schema.sequences
    ...
    ... 42 common frames omitted

2021-06-22 21:18:59.973  INFO 842086 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-06-22 21:18:59.980  INFO 842086 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-06-22 21:19:00.598  INFO 842086 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'
2021-06-22 21:19:00.713  INFO 842086 --- [           main] o.t.spring.autoconfigure.TeiidServer     : Added file to the Teiid Database
2021-06-22 21:19:00.713  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40120 VDB spring.1.0.0 will be removed from the repository
2021-06-22 21:19:00.713  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40119 VDB spring.1.0.0 removed from the repository
2021-06-22 21:19:00.717  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 21:19:00.717  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "db" metadata is currently being loaded. Start Time: 6/22/21, 9:19 PM
2021-06-22 21:19:00.719  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "db" metadata loaded. End Time: 6/22/21, 9:19 PM
2021-06-22 21:19:00.719  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "file" metadata is currently being loaded. Start Time: 6/22/21, 9:19 PM
2021-06-22 21:19:00.719  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "file" metadata loaded. End Time: 6/22/21, 9:19 PM
2021-06-22 21:19:00.720  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 21:19:00.720  INFO 842086 --- [           main] o.t.s.autoconfigure.TeiidPostProcessor   : Non JDBC Datasource added to Teiid = file
2021-06-22 21:19:00.833  INFO 842086 --- [           main] ctiveUserDetailsServiceAutoConfiguration : 

Using generated security password: 9ac125d5-7e8c-494d-a606-b5dcb336f5ee

2021-06-22 21:19:00.958  INFO 842086 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 7009
2021-06-22 21:19:00.970  WARN 842086 --- [           main] o.h.e.j.c.i.ConnectionProviderInitiator  : HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
2021-06-22 21:19:00.971  WARN 842086 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata

java.lang.UnsupportedOperationException: The application must supply JDBC connections
    at org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:44) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
    ...

2021-06-22 21:19:00.971  INFO 842086 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.teiid.dialect.TeiidDialect
2021-06-22 21:19:00.984  INFO 842086 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.teiid.dialect.TeiidDialect
2021-06-22 21:19:00.986  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40120 VDB spring.1 will be removed from the repository
2021-06-22 21:19:00.987  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40119 VDB spring.1 removed from the repository
2021-06-22 21:19:01.081 DEBUG 842086 --- [           main] o.t.spring.autoconfigure.TeiidServer     : XML Form of VDB:
<?xml version="1.0" encoding="UTF-8"?>
<vdb name="spring" version="1.0.0">
   <connection-type>BY_VERSION</connection-type>
   <property name="implicit" value="true"/>
   <model name="db" type="PHYSICAL" visible="false">
      <property name="importer.useQualifiedName" value="false"/>
      <property name="importer.tableTypes" value="TABLE,VIEW"/>
      <property name="dialect" value="org.hibernate.dialect.PostgreSQL9Dialect"/>
      <property name="importer.SchemaPattern" value="public"/>
      <source connection-jndi-name="db" name="db" translator-name="postgresql"/>
      <metadata type="DDL">CREATE FOREIGN TABLE material (
    id long NOT NULL OPTIONS (NAMEINSOURCE '"id"', NATIVE_TYPE 'int8'),
    code string(255) OPTIONS (NAMEINSOURCE '"code"', NATIVE_TYPE 'varchar'),
    descrip string(255) OPTIONS (NAMEINSOURCE '"descrip"', NATIVE_TYPE 'varchar'),
    name string(255) OPTIONS (NAMEINSOURCE '"name"', NATIVE_TYPE 'varchar'),
    status string(255) OPTIONS (NAMEINSOURCE '"status"', NATIVE_TYPE 'varchar'),
    type string(255) OPTIONS (NAMEINSOURCE '"type"', NATIVE_TYPE 'varchar'),
    CONSTRAINT material_pkey PRIMARY KEY(id)
) OPTIONS (NAMEINSOURCE '"material"', UPDATABLE TRUE, "teiid_rel:fqn" 'schema=public/table=material', "teiid_rel:source_type" 'TABLE');</metadata>
   </model>
   <model name="file" type="PHYSICAL" visible="false">
      <source connection-jndi-name="file" name="file" translator-name="file"/>
   </model>
   <model name="teiid" type="VIRTUAL" visible="true">
      <metadata type="DDL">CREATE VIEW material (
    id long NOT NULL AUTO_INCREMENT,
    code string(255),
    descrip string(255),
    name string(255),
    status string(255),
    type string(255),
    PRIMARY KEY(id)
) OPTIONS (UPDATABLE TRUE)
AS
SELECT id, code, descrip, name, status, type FROM db.material;</metadata>
   </model>
</vdb>

2021-06-22 21:19:01.081  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40118 VDB spring.1.0.0 added to the repository
2021-06-22 21:19:01.082  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "db" metadata is currently being loaded. Start Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.083  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "db" metadata loaded. End Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.083  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "file" metadata is currently being loaded. Start Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.083  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "file" metadata loaded. End Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.084  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50029 VDB spring.1.0.0 model "teiid" metadata is currently being loaded. Start Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.085  INFO 842086 --- [           main] org.teiid.RUNTIME                        : TEIID50030 VDB spring.1.0.0 model "teiid" metadata loaded. End Time: 6/22/21, 9:19 PM
2021-06-22 21:19:01.087  INFO 842086 --- [           main] org.teiid.RUNTIME.VDBLifeCycleListener   : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2021-06-22 21:19:01.102  INFO 842086 --- [           main] c.v.s.Application            : Started Application in 4.684 seconds (JVM running for 5.419)
rareddy commented 3 years ago

what is your current application.properties look like? The property spring.datasource.db.importer.SchemaPattern=public should limit the reach of the Teiid to the public schemas only. can you try spring.datasource.db.importer.schemaPattern with no capital S, may that is documented wrong?

Gamezpedia commented 3 years ago

i tried it with small schemaPattern too: but same error.

Here is the screen shot of Properties image

rareddy commented 3 years ago

try setting spring.datasource.db.importer.importSequences=true in application.properties

Gamezpedia commented 3 years ago

No luck with that either :(

same exception org.teiid.jdbc.TeiidSQLException: Group does not exist: information_schema.sequences

Generated DDL shows that it is taking the properties correctly

      <property name="dialect" value="org.hibernate.dialect.PostgreSQL9Dialect"/>
      <property name="importer.SchemaPattern" value="public"/>
      <property name="importer.ImportSequences" value="true"/>
      <source connection-jndi-name="db" name="db" translator-name="postgresql"/>
rareddy commented 3 years ago

do you have any other classes in the source that are used for Id generation or entities with @SequenceGenerator? The error is self is not harmful but what it is looking for native ID generation.

Gamezpedia commented 3 years ago

No i don't have anything in there, It is just a sample project :

Project is here: https://github.com/Gamezpedia/teiid-sample

Properties File https://github.com/Gamezpedia/teiid-sample/blob/master/src/main/resources/application.properties

Entity Class https://github.com/Gamezpedia/teiid-sample/blob/master/src/main/java/com/gamez/teiid/Material.java

thanks

rareddy commented 3 years ago

do you a schema u used with postgres instance? exactly with any sequences you may have in there.

Gamezpedia commented 3 years ago

Yes the database has two sequences in there :

one is seq and the other is hibernate_sequence

SELECT * FROM information_schema.sequences;
+----------------+---------------+------------------+---------+-----------------+-----------------------+-------------+-----------+-------------+-------------------+---------+------------+
|sequence_catalog|sequence_schema|sequence_name     |data_type|numeric_precision|numeric_precision_radix|numeric_scale|start_value|minimum_value|maximum_value      |increment|cycle_option|
+----------------+---------------+------------------+---------+-----------------+-----------------------+-------------+-----------+-------------+-------------------+---------+------------+
|db              |public         |hibernate_sequence|bigint   |64               |2                      |0            |1          |1            |9223372036854775807|1        |NO          |
|db              |public         |seq               |bigint   |64               |2                      |0            |1          |1            |9223372036854775807|50       |NO          |
+----------------+---------------+------------------+---------+-----------------+-----------------------+-------------+-----------+-------------+-------------------+---------+------------+
rareddy commented 3 years ago

can you give me a sample DDL script to create what you have?

Gamezpedia commented 3 years ago

Sure.

So there is a separate service which i used to generate and save test records only.

And then i am trying to read those records from the Teiid service and that is where i am getting all the troubles. i want to query the test data using Teiid and then save it in other data source.

Here are the files from the source service.

schema.sql file

CREATE TABLE IF NOT EXISTS material
(
    id   SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    type VARCHAR(255),
    descrip varchar(255),
    code   varchar(255),
    status varchar(255)
);

and the Entity file used in the test source service.


@Entity
@Builder
@Table(name = "material")
public class Material {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "seqGen")
    @SequenceGenerator(name = "seqGen", sequenceName = "seq", initialValue = 1)
    @Column(name = "id")
    private Long id;

    @Column(name = "name")
    String name;

    @Column(name = "type")
    String type;

    @Column(name = "descrip")
    String descrip;

    @Column(name = "code")
    String code;

    @Column(name = "status")
    String status;

}

thank you :+1: