mycontroller-v1-legacy icon indicating copy to clipboard operation
mycontroller-v1-legacy copied to clipboard

PostgreSQL 10

Open Avamander opened this issue 5 years ago • 3 comments

I'm trying to switch to PostgreSQL 10 on my RPi and it seems that MyController really doesn't like that:

2018-11-07 17:34:52,695 ERROR [Acme.Utils.ThreadPool(10)-PooledThread: Acme.Serve.Serve$ServeConnection@651f4d14] [org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl:450] unable to get count key:nodeId, data:[]
org.postgresql.util.PSQLException: ERROR: syntax error at or near ")"
  Position: 50
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:432)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:358)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:171)
        at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:119)
        at com.j256.ormlite.jdbc.JdbcCompiledStatement.runQuery(JdbcCompiledStatement.java:63)
        at com.j256.ormlite.stmt.StatementExecutor.queryForLong(StatementExecutor.java:151)
        at com.j256.ormlite.dao.BaseDaoImpl.countOf(BaseDaoImpl.java:808)
        at com.j256.ormlite.stmt.QueryBuilder.countOf(QueryBuilder.java:405)
        at com.j256.ormlite.stmt.Where.countOf(Where.java:508)
        at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.countOf(BaseAbstractDaoImpl.java:445)
        at org.mycontroller.standalone.model.ResourceCountModel.<init>(ResourceCountModel.java:45)
        at org.mycontroller.standalone.api.MetricApi.getResourceCount(MetricApi.java:61)
        at org.mycontroller.standalone.api.jaxrs.MetricsHandler.getResourceCount(MetricsHandler.java:109)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
        at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
        at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
        at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
        at java.base/java.lang.Thread.run(Thread.java:834)

Avamander avatar Nov 07 '18 15:11 Avamander

@Avamander I am unable to reproduce this issue. I do not have any backup in postgresql 9.x. Just I tried fresh installation with postgres 10.6 docker. all works as expected. I did not see a single error on the log file.

image

Application information: [Version:1.4.0-SNAPSHOT, Database(type:PostgreSQL, version:PostgreSQL 10.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.4.0) 6.4.0, 64-bit, schema version:1.04.05 - 2018 Sep 11), Built on:2018-11-29T10:22:36+0530, Git commit:45fc48776bfc2a1c38b31835dd6e737afbc4cc3f:development]

Docker command:

docker run --name mc-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres:10-alpine

Create mycontroller database:

create database mycontroller;
create user mycontroller with password 'mycontroller';
alter user mycontroller with superuser;

MyController configuration:

mcc.db.type=POSTGRESQL
mcc.db.url=jdbc:postgresql://localhost:5432/mycontroller
mcc.db.username=mycontroller
mcc.db.password=mycontroller

jkandasa avatar Nov 29 '18 06:11 jkandasa

Hmm, I guess it's the Java 11 https://github.com/mycontroller-org/mycontroller/issues/482 that causes the PostgreSQL library to break.

Avamander avatar Dec 02 '18 00:12 Avamander

@Avamander Maybe, ok I will keep this issue. and will check it in Java 11.

jkandasa avatar Dec 02 '18 02:12 jkandasa