Para Desenvolvedores

Caused by: java.sql.SQLException: Invalid object name 'lum_ContentVersion'.

Resolvido

Temos uma base de dados de associados no SQL Server, mas nosso LumisXP roda no MySQL, desejamos manipular os dados no SQL Server usando o nosso LumisXP.

Criamos um novo aquivo.cfg.xml para acessar o banco, está fazendo a conexão. 

Criamos um serviço do tipo lum_content, para acessar uma tabela que não tem relacionamento, quando instanciamos a interface do serviço, temos a seguinte exceção.

lumis.portal.UnexpectedException: STR_UNEXPECTED_EXCEPTION
	at lumis.util.query.hibernate.HibernateQueryStatement.list(HibernateQueryStatement.java:221)
	at lumis.doui.table.TableDaoJdbc.readData(TableDaoJdbc.java:93)
	at lumis.doui.table.TableDataProvider.loadData(TableDataProvider.java:34)
	at lumis.doui.table.TableDataProvider.loadData(TableDataProvider.java:23)
	at lumis.doui.source.Source.load(Source.java:677)
	at lumis.doui.source.SourceContainer.loadSourcesRecursively(SourceContainer.java:141)
	at lumis.doui.source.SourceContainer.loadSources(SourceContainer.java:118)
	at lumis.doui.service.DouiServiceInterface.loadSources(DouiServiceInterface.java:186)
	at lumis.doui.service.DouiServiceInterface.render(DouiServiceInterface.java:492)
	at lumis.content.service.ContentServiceInterface.render(ContentServiceInterface.java:151)
	at lumis.portal.servicecontainer.ServiceContainer.renderServiceInterfaceInstanceInternal(ServiceContainer.java:477)
	at lumis.portal.servicecontainer.ServiceContainer.lambda$renderServiceInterfaceInstance$0(ServiceContainer.java:258)
	at lumis.portal.util.PortalUtilInternal.execWithSilentThrow(PortalUtilInternal.java:533)
	at lumis.util.log.MDCUtil.execWithValues(MDCUtil.java:60)
	at lumis.util.log.MDCUtil.execWithValues(MDCUtil.java:45)
	at lumis.portal.servicecontainer.ServiceContainer.renderServiceInterfaceInstance(ServiceContainer.java:228)
	at lumis.portal.serviceinterfaceinstance.ServiceInterfaceInstanceControllerHtml.renderOutput(ServiceInterfaceInstanceControllerHtml.java:433)
	at lumis.portal.serviceinterfaceinstance.ServiceInterfaceInstanceControllerHtml.renderServiceInterfaceInstance(ServiceInterfaceInstanceControllerHtml.java:329)
	at lumis.portal.serviceinterfaceinstance.ServiceInterfaceInstanceControllerHtml.handleRequest(ServiceInterfaceInstanceControllerHtml.java:108)
	at org.apache.jsp.lumis.portal.controller.html.ServiceInterfaceInstanceControllerHtml_jsp._jspService(ServiceInterfaceInstanceControllerHtml_jsp.java:122)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.rest.RestRootFilter.doFilter(RestRootFilter.java:333)
	at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:462)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
	at sun.reflect.GeneratedMethodAccessor208.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:152)
	at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:294)
	at com.sun.proxy.$Proxy212.forward(Unknown Source)
	at lumis.portal.url.WebResourceForwardFilter.doFilter(WebResourceForwardFilter.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.security.csr.CrossSiteRequestFilter.doFilter(CrossSiteRequestFilter.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.url.WebResourceDiscoveryFilter.doFilter(WebResourceDiscoveryFilter.java:365)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.presentation.PortalModeDiscoveryFilter.doFilter(PortalModeDiscoveryFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:232)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:209)
	at lumis.service.portalmanagement.monitoring.JavaMelodyCustomMonitoringFilter.doFilter(JavaMelodyCustomMonitoringFilter.java:221)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.authentication.AuthenticationFilter.changeThreadNameAndProceed(AuthenticationFilter.java:490)
	at lumis.portal.authentication.AuthenticationFilter.lambda$doFilter$0(AuthenticationFilter.java:291)
	at lumis.portal.util.PortalUtilInternal.execWithSilentThrow(PortalUtilInternal.java:533)
	at lumis.util.log.MDCUtil.execWithValues(MDCUtil.java:60)
	at lumis.portal.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:282)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.monitor.impl.MonitorContextFilter.lambda$doFilter$1(MonitorContextFilter.java:424)
	at lumis.portal.util.PortalUtilInternal.execWithSilentThrow(PortalUtilInternal.java:533)
	at lumis.util.log.MDCUtil.execWithValues(MDCUtil.java:60)
	at lumis.portal.monitor.impl.MonitorContextFilter.doFilter(MonitorContextFilter.java:402)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.page.cache.PageCacheSSIFilter.doFilter(PageCacheSSIFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.PortalRequestContextFilter.doFilter(PortalRequestContextFilter.java:97)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.filter.EncodingUTF8Filter.doFilter(EncodingUTF8Filter.java:35)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.webserver.WebServerIntegrationInitFilter.doFilter(WebServerIntegrationInitFilter.java:367)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.website.WebsiteDiscoveryFilter.doFilter(WebsiteDiscoveryFilter.java:302)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at lumis.portal.PortalConfiguration$RequestInitializer.doFilter(PortalConfiguration.java:152)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.loader.Loader.scroll(Loader.java:2340)
	at org.hibernate.loader.custom.CustomLoader.scroll(CustomLoader.java:318)
	at org.hibernate.impl.SessionImpl.scrollCustomQuery(SessionImpl.java:1699)
	at org.hibernate.impl.AbstractSessionImpl.scroll(AbstractSessionImpl.java:170)
	at org.hibernate.impl.SQLQueryImpl.scroll(SQLQueryImpl.java:201)
	at org.hibernate.impl.SQLQueryImpl.scroll(SQLQueryImpl.java:209)
	at lumis.util.query.hibernate.HibernateQueryStatement.list(HibernateQueryStatement.java:190)
	... 109 more
Caused by: java.sql.SQLException: Invalid object name 'lum_ContentVersion'.
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
	at net.sourceforge.jtds.jdbc.MSCursorResultSet.processOutput(MSCursorResultSet.java:943)
	at net.sourceforge.jtds.jdbc.MSCursorResultSet.cursorCreate(MSCursorResultSet.java:541)
	at net.sourceforge.jtds.jdbc.MSCursorResultSet.<init>(MSCursorResultSet.java:154)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:452)
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:1029)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
	at org.hibernate.loader.Loader.scroll(Loader.java:2305)
	... 115 more

Nosso serviço abaixo

<?xml version="1.0" encoding="UTF-8"?>
<serviceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.lumis.com.br/lumisportal/xsd/servicedefinition.xsd">
	
	<service name="STR_SERVICE_NAME" type="lum_content">
		<description>STR_SERVICE_DESCRIPTION</description>		
		<workflow enabled="true" />
	</service>

	<interfaces>
		
		<interface id="listApcef" name="Lista de Apcef" type="lum_contentList"></interface>
		
		<!-- administration interfaces -->		
		<interface id="administrationApcef" name="Administração de Apcef" type="lum_contentAdministrationList"></interface>
		<interface id="addApcef" name="Adicionar" type="lum_contentAdministrationAddPropertyPage"></interface>
		<interface id="editApcef" name="Editar" type="lum_contentAdministrationEditPropertyPage"></interface>
		
	</interfaces>
</serviceDefinition>

<?xml version="1.0" encoding="UTF-8"?>
<doui:douiDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doui="http://www.lumis.com.br/lumisportal/xsd/doui" xmlns:control="http://www.lumis.com.br/douicontrols">
	<service>
		<sources>
			
			<source id="apcef" type="contentTable">
				<table>ass.apcef</table>
				<connectionId>nome.cfg.xml</connectionId>
				<fields>					
					<field id="id" name="Id" dataType="string" isPrimaryKey="true" />
					<field id="tipo" name="Tipo" dataType="string" />
					<field id="nome" name="Nome" dataType="string" />
					<field id="logradouro" name="Rua" dataType="string" />
					<field id="nome_logradouro" name="Logradouro" dataType="string" />
					<field id="bairro" name="Bairro" dataType="string" />
					<field id="cidade" name="Cidade" dataType="string" />
					<field id="uf" name="UF" dataType="string" />
					<field id="cep" name="CEP" dataType="string" />
					<field id="latitude" name="Latitude" dataType="string" />
					<field id="longitude" name="Longitude" dataType="string" />
					<field id="ddd_tel" name="DDD" dataType="string" />
					<field id="tel_contato" name="Telefone" dataType="string" />
					<field id="dt_cadastro" name="Data de cadastro" dataType="dateTime" />
					<field id="cod" name="Código" dataType="integer" />
					<field id="id_apcef_sede" name="Id Apcef sede" dataType="string" lookupRelationId="apcef" lookupFieldId="nome" includeAlways="true" />
					<field id="sede" name="Sede" dataType="string" />
				</fields>
				<metaData>
					<serviceInstanceIsolation/>
				</metaData>
				<relations>
					<relation id="apcef" cascadeOnDelete="true">
						<relationField fieldId="id_apcef_sede" foreignFieldId="id" />
					</relation>
				</relations>
			</source>
			
		</sources>
	</service>
	
	<interfaces>
		<interface id="listApcef">
			<sources>
				<source id="apcef">
					<fields inherit="all" />
				</source>
			</sources>
		</interface>
		
		<interface id="administrationApcef">
			<sources>
				<source id="apcef">
					<fields inherit="all"></fields>
				</source>
			</sources>
			<controls>
				<control:lum_form>
					<control:lum_interfaceHeader/>
					<control:lum_autoContentAdminListButtons  addInterfaceId="addApcef" editInterfaceId="editApcef"></control:lum_autoContentAdminListButtons>
					<control:lum_adminList id="adminList" dataId="id"/>					
				</control:lum_form>			
			</controls>
			<processActions>
				<processAction id="delete" type="contentTableDeleteData" sourceId="apcef">
					<response type="doui_standardEmbedded"/>
				</processAction>
			</processActions>
		</interface>
		
	</interfaces>
	
</doui:douiDefinition>

Por Rogerio Rodrigues

Em 02/04/20 14:40

Acompanhar pergunta

1 resposta(s):

Ordenar por:

Rogerio,

Esse feature de utilizar source em outra database não funciona para source do tipo contentTable. Quando o source é content, o lumis faz inner join com várias tabela nativas que não irão existir no outro database. E mesmo que essas outras tabelas sejam criadas na mão no outro database, o content é ligado a instância de serviço, que só é registrado no banco de dados principal. Por isso que é impossível!

Esse recurso sá funciona para source com type="table", que no caso todos os dados vem de uma tabela só.

Por Luiz Carlos Valenca

Em 20/04/20 13:20

Entrar

Interaja com a comunidade e tenha acesso a conteúdos exclusivos.

Houve algum erro ao acessar o banco de dados. Tente novamente mais tarde.