TEIID40095 TEIID31079 View materialized.testViewCache is not defined by a query expression.
huangyun Jul 12, 2018 5:54 AMWhen I tried external materialized view .I encountered a problem :
2018-07-12 16:32:31 ERROR [main] (SpringApplication.java:833) - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oneEmberdedServer': Invocation of init method failed; nested exception is org.teiid.deployers.VirtualDatabaseException: TEIID40095 TEIID31079 View materialized.testViewCache is not defined by a query expression.
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:138)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
at com.hiocs.daas.vdb.Application.main(Application.java:29)
Caused by: org.teiid.deployers.VirtualDatabaseException: TEIID40095 TEIID31079 View materialized.testViewCache is not defined by a query expression.
at org.teiid.runtime.EmbeddedServer.deployVDB(EmbeddedServer.java:830)
at org.teiid.runtime.EmbeddedServer.deployVDB(EmbeddedServer.java:748)
at org.teiid.runtime.EmbeddedServer.deployVDB(EmbeddedServer.java:713)
at com.hiocs.daas.vdb.dbsourcemodel.OneEmberdedServer.initDeploy(OneEmberdedServer.java:150)
at com.hiocs.daas.vdb.dbsourcemodel.OneEmberdedServer.startOnlyServer(OneEmberdedServer.java:95)
at com.hiocs.daas.vdb.dbsourcemodel.OneEmberdedServer.init(OneEmberdedServer.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:369)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:312)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135)
... 18 more
This is my VDB xml file
<vdb name="matworkspace" version="1.0"> <model name="tableModel_mysql_1"> <source name="Model_23d0ba8f6d5f430891cb40653ea9139c" translator-name="translator-mysql" connection-jndi-name="Connector_bb9278d3190f4342b240a3241c38762e" /> <metadata type="DDL" > <![CDATA[ CREATE foreign TABLE vdb_folder( folderId INTEGER, folderName VARCHAR, folderType VARCHAR, creatorId VARCHAR, creator VARCHAR, datasourceType VARCHAR, createTime TIMESTAMP, updateTime TIMESTAMP, folderDesc VARCHAR)OPTIONS(UPDATABLE 'TRUE'); CREATE foreign TABLE vbd_data_source( dataSourceId INTEGER, dataSourceName VARCHAR, dataSourceInfo VARCHAR, creatorId VARCHAR, dataSourceType VARCHAR, connector VARCHAR, creator VARCHAR, createTime TIMESTAMP, updateTime TIMESTAMP, removed INTEGER, dataSourceDesc VARCHAR, folderId INTEGER, origin VARCHAR)OPTIONS(UPDATABLE 'TRUE'); ]]> </metadata> </model> <model name="viewModel" type="VIRTUAL"> <metadata type="DDL"> <![CDATA[ create view testtab ( folderName VARCHAR , dataSourceName VARCHAR )OPTIONS ( materialized 'true', UPDATABLE 'true', MATERIALIZED_TABLE 'materialized.testViewCache', "teiid_rel:MATVIEW_TTL" 2000, "teiid_rel:ALLOW_MATVIEW_MANAGEMENT" 'true', "teiid_rel:MATVIEW_LOADNUMBER_COLUMN" 'LoadNumber', "teiid_rel:MATVIEW_STATUS_TABLE" 'materialized.status') as select vdb_folder.folderName as folderName ,vbd_data_source.dataSourceName as dataSourceName from vbd_data_source vbd_data_source left join vdb_folder vdb_folder on vbd_data_source.folderId = vdb_folder.folderId where 1=1 ; ]]></metadata> </model> <model name="materialized" type="PHYSICAL"> <source name="matview" translator-name="translator-mysql" connection-jndi-name="Connector_14d0f340db46433b8698d00e56e83055"/> <metadata type="DDL"> <![CDATA[ create view testViewCache ( folderName VARCHAR , dataSourceName VARCHAR ,LoadNumber long); CREATE foreign TABLE status ( VDBName varchar(50) not null, VDBVersion varchar(50) not null, SchemaName varchar(50) not null, Name varchar(256) not null, TargetSchemaName varchar(50), TargetName varchar(256) not null, Valid boolean not null, LoadState varchar(25) not null, Cardinality long, Updated timestamp not null, LoadNumber long not null, NodeName varchar(25) not null, StaleCount long, PRIMARY KEY (VDBName, VDBVersion, SchemaName, Name) ) OPTIONS (UPDATABLE true); ]]> </metadata> </model> </vdb>
and I had create physical table on my database