Stardog Springboot Connect to Remote Server

(Gabriel Nogueira) #1

Hi,

I'm trying to do a Stardog Spring application to connect into my server. When running using the Embedded Provider, the application works fine. But when i add in the "applicationContext.xml" the beans to connect into Stardog Server (StardogAdmin and DataSourceFactoryBean, following yours github weblog examples) and run i receive the error above:

Someone can point where is the error?

The version of Stardog i'm using is 6.1.2.

com.complexible.stardog.StardogException: JsonObject
at com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:128) ~[stardog-api-4.2.4.jar:na]
at com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:115) ~[stardog-api-4.2.4.jar:na]
at com.complexible.stardog.ext.spring.DataSource.getConnection(DataSource.java:78) ~[stardog-spring-2.1.3.jar:na]
at com.complexible.stardog.ext.spring.SnarlTemplate.execute(SnarlTemplate.java:94) [stardog-spring-2.1.3.jar:na]
at com.complexible.stardog.ext.spring.DataImporter.afterPropertiesSet(DataImporter.java:133) [stardog-spring-2.1.3.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at br.ufes.inf.nemo.stardog.StardogApplication.main(StardogApplication.java:12) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.2.RELEASE.jar:2.1.2.RELEASE]     Caused by: com.complexible.stardog.StardogException: JsonObject 	at  com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:86) ~[stardog-protocols-spec-client-4.2.4.jar:na] 	at  com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:34) ~[stardog-protocols-spec-client-4.2.4.jar:na]	at com.complexible.stardog.protocols.http.client.HttpConnection.create(HttpConnection.java:54) ~[stardog-protocols-http-client-4.2.4.jar:na]	at com.complexible.stardog.protocols.http.client.HttpDriver.connect(HttpDriver.java:75) ~[stardog-protocols-http-client-4.2.4.jar:na]	at com.complexible.stardog.api.DriverManager.getConnection(DriverManager.java:74) ~[stardog-api-4.2.4.jar:na]	at com.complexible.stardog.api.ConnectionConfiguration.connect(ConnectionConfiguration.java:126) ~[stardog-api-4.2.4.jar:na]	 at com.complexible.stardog.api.ConnectionPoolableObjectFactory.makeObject(ConnectionPoolableObjectFactory.java:30) ~[stardog-api-4.2.4.jar:na] 	at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188) ~[commons-pool-1.6.jar:1.6] 	at com.complexible.common.pool.ApachePoolImpl.obtain(ApachePoolImpl.java:50) ~[stardog-utils-common-4.2.4.jar:na] 	at com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:125) ~[stardog-api-4.2.4.jar:na] 	... 27 common frames omitted
Caused by: com.complexible.common.protocols.client.ClientException: JsonObject 	at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:252) ~[stardog-protocols-http-client-4.2.4.jar:na] 	at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:93) ~[stardog-protocols-http-client-4.2.4.jar:na] 	at com.complexible.stardog.protocols.http.client.HttpConnection.create(HttpConnection.java:44) ~[stardog-protocols-http-client-4.2.4.jar:na] 	... 34 common frames omitted
Caused by: java.lang.UnsupportedOperationException: JsonObject 	at com.google.gson.JsonElement.getAsString(JsonElement.java:192) ~[gson-2.8.5.jar:na] 	at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:238) ~[stardog-protocols-http-client-4.2.4.jar:na] 	... 36 common frames omitted 2019-05-10 13:07:02.527  WARN 7472 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importer' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: com.complexible.stardog.StardogException: JsonObject
2019-05-10 13:07:02.531  INFO 7472 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat] 2019-05-10 13:07:02.543  INFO 7472 --- [  restartedMain] ConditionEvaluationReportLoggingListener :  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-05-10 13:07:02.545 ERROR 7472 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importer' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: com.complexible.stardog.StardogException: JsonObject at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE] at br.ufes.inf.nemo.stardog.StardogApplication.main(StardogApplication.java:12) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.2.RELEASE.jar:2.1.2.RELEASE] Caused by: java.lang.RuntimeException: com.complexible.stardog.StardogException: JsonObject at com.complexible.stardog.ext.spring.DataSource.getConnection(DataSource.java:81) ~[stardog-spring-2.1.3.jar:na] at com.complexible.stardog.ext.spring.SnarlTemplate.execute(SnarlTemplate.java:94) ~[stardog-spring-2.1.3.jar:na] at com.complexible.stardog.ext.spring.DataImporter.afterPropertiesSet(DataImporter.java:133) ~[stardog-spring-2.1.3.jar:na] at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE] ... 21 common frames omitted Caused by: com.complexible.stardog.StardogException: JsonObject at  com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:128) ~[stardog-api-4.2.4.jar:na] at com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:115) ~[stardog-api-4.2.4.jar:na] at com.complexible.stardog.ext.spring.DataSource.getConnection(DataSource.java:78) ~[stardog-spring-2.1.3.jar:na] ... 25 common frames omitted
Caused by: com.complexible.stardog.StardogException: JsonObject at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:86) ~[stardog-protocols-spec-client-4.2.4.jar:na] at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:34) ~[stardog-protocols-spec-client-4.2.4.jar:na] at com.complexible.stardog.protocols.http.client.HttpConnection.create(HttpConnection.java:54) ~[stardog-protocols-http-client-4.2.4.jar:na] at com.complexible.stardog.protocols.http.client.HttpDriver.connect(HttpDriver.java:75) ~[stardog-protocols-http-client-4.2.4.jar:na] at com.complexible.stardog.api.DriverManager.getConnection(DriverManager.java:74) ~[stardog-api-4.2.4.jar:na] at com.complexible.stardog.api.ConnectionConfiguration.connect(ConnectionConfiguration.java:126) ~[stardog-api-4.2.4.jar:na] at com.complexible.stardog.api.ConnectionPoolableObjectFactory.makeObject(ConnectionPoolableObjectFactory.java:30) ~[stardog-api-4.2.4.jar:na] at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188) ~[commons-pool-1.6.jar:1.6] at com.google.gson.JsonElement.getAsString(JsonElement.java:192) ~[gson-2.8.5.jar:na] at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:238) ~[stardog-protocols-http-client-4.2.4.jar:na] ... 36 common frames omittedcom.complexible.common.pool.ApachePoolImpl.obtain(ApachePoolImpl.java:50) ~[stardog-utils-common-4.2.4.jar:na] at com.complexible.stardog.api.ConnectionPoolConfig$ApacheConnectionPool.obtain(ConnectionPoolConfig.java:125) ~[stardog-api-4.2.4.jar:na] ... 27 common frames omitted Caused by: com.complexible.common.protocols.client.ClientException: JsonObject at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:252) ~[stardog-protocols-http-client-4.2.4.jar:na] at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:93) ~[stardog-protocols-http-client-4.2.4.jar:na] at com.complexible.stardog.protocols.http.client.HttpConnection.create(HttpConnection.java:44) ~ [stardog-protocols-http-client-4.2.4.jar:na] ... 34 common frames omitted
Caused by: java.lang.UnsupportedOperationException: JsonObject at com.google.gson.JsonElement.getAsString(JsonElement.java:192) ~[gson-2.8.5.jar:na] at com.complexible.stardog.protocols.http.client.HttpClientImpl.connect(HttpClientImpl.java:238) ~[stardog-protocols-http-client-4.2.4.jar:na] ... 36 common frames omitted

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importer' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: com.complexible.stardog.StardogException: JsonObject

Github link for the project: github.com/ggnogueira/goop

Ps: I'm using IntelliJ Community to run the application.