[ https://issues.apache.org/jira/browse/AMQ-9505 ]
Justin Bertram deleted comment on AMQ-9505: ------------------------------------- was (Author: JIRAUSER305550): Tried both of the below configs but same error <bean id="postgres-ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="dataSourceClassName" value="org.postgresql.ds.PGSimpleDataSource" /> <property name="maximumPoolSize" value="20" /> <property name="dataSourceProperties" > <props> <prop key="portNumber">5432</prop> <prop key="databaseName">activemq</prop> <prop key="serverName">xxxxx.database.azure.com</prop> <prop key="user">xxxxx</prop> <prop key="password">xxxxx</prop> <prop key="logUnclosedConnections">true</prop> </props> </property> </bean> <bean id="postgres-dsOLD" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="org.postgresql.Driver"/> <property name="url" value="jdbc:postgresql://xxxx.database.azure.com:5432/activemq"/> <property name="username" value="xxxxx"/> <property name="password" value="xxxxx"/> </bean> > ActiveMQ classic with postgres data source gives errors on start > ---------------------------------------------------------------- > > Key: AMQ-9505 > URL: https://issues.apache.org/jira/browse/AMQ-9505 > Project: ActiveMQ Classic > Issue Type: Bug > Affects Versions: 6.1.1 > Environment: Fresh 6.1.1 installation on Ubuntu + java 17 > > > Reporter: Susinda Perera > Priority: Major > > I get this error when I start ActiveMQ > {noformat} > 2024-05-21 23:59:32,959 | INFO | Using Persistence Adapter: > JDBCPersistenceAdapter(HikariDataSource (null)) | > org.apache.activemq.broker.BrokerService | main > 2024-05-21 23:59:32,968 | INFO | Starting Persistence Adapter: > JDBCPersistenceAdapter(HikariDataSource (null)) | > org.apache.activemq.broker.BrokerService | main > 2024-05-21 23:59:32,969 | INFO | HikariPool-1 - Starting... | > com.zaxxer.hikari.HikariDataSource | main > 2024-05-21 23:59:35,211 | INFO | HikariPool-1 - Added connection > org.postgresql.jdbc.PgConnection@70101687 | com.zaxxer.hikari.pool.HikariPool > | main > 2024-05-21 23:59:35,214 | INFO | HikariPool-1 - Start completed. | > com.zaxxer.hikari.HikariDataSource | main > 2024-05-21 23:59:35,433 | INFO | Database adapter driver override recognized > for : [postgresql_jdbc_driver] - adapter: class > org.apache.activemq.store.jdbc.adapter.PostgresqlJDBCAdapter | > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main > 2024-05-21 23:59:38,423 | WARN | Could not create JDBC tables; they could > already exist. Failure was: ALTER TABLE ACTIVEMQ_ACKS DROP CONSTRAINT > "activemq_acks_pkey" Message: ERROR: constraint "activemq_acks_pkey" of > relation "activemq_acks" does not exist SQLState: 42704 Vendor code: 0 | > org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter | main > 2024-05-21 23:59:38,423 | WARN | Failure details: ERROR: constraint > "activemq_acks_pkey" of relation "activemq_acks" does not exist | > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main > org.postgresql.util.PSQLException: ERROR: constraint "activemq_acks_pkey" of > relation "activemq_acks" does not exist > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412) > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371) > at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419) > at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:341) > at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:326) > at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:302) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:297) > at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) > at > com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) > at > org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.executeStatement(DefaultJDBCAdapter.java:112) > at > org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doCreateTables(DefaultJDBCAdapter.java:90) > at > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:318) > at > org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:99) > at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54) > at > org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:681) > at > org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:663) > at org.apache.activemq.broker.BrokerService.start(BrokerService.java:627) > at > org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:568) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1890) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1843) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) > at > org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) > at > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) > at > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) > at > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) > at > org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63) > at > org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63) > at > org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:568) > at org.apache.activemq.console.Main.runTaskClass(Main.java:262) > at org.apache.activemq.console.Main.main(Main.java:115) > 2024-05-21 23:59:38,637 | WARN | Could not create JDBC tables; they could > already exist. Failure was: ALTER TABLE ACTIVEMQ_ACKS ADD PRIMARY KEY > (CONTAINER, CLIENT_ID, SUB_NAME, PRIORITY) Message: ERROR: multiple primary > keys for table "activemq_acks" are not allowed SQLState: 42P16 Vendor code: 0 > | org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter | main > 2024-05-21 23:59:38,638 | WARN | Failure details: ERROR: multiple primary > keys for table "activemq_acks" are not allowed | > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main > org.postgresql.util.PSQLException: ERROR: multiple primary keys for table > "activemq_acks" are not allowed > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412) > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371) > at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419) > at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:341) > at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:326) > at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:302) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:297) > at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) > at > com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) > at > org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.executeStatement(DefaultJDBCAdapter.java:112) > at > org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doCreateTables(DefaultJDBCAdapter.java:90) > at > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:318) > at > org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:99) > at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54) > at > org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:681) > at > org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:663) > at org.apache.activemq.broker.BrokerService.start(BrokerService.java:627) > at > org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:568) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1890) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1843) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) > at > org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) > at > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) > at > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) > at > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) > at > org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104) > at > org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) > at > org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) > at > org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63) > at > org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154) > at > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63) > at > org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:568) > at org.apache.activemq.console.Main.runTaskClass(Main.java:262) > at org.apache.activemq.console.Main.main(Main.java:115){noformat} > I tried both of the below configs, but I received the same error. > {code:xml} > <bean id="postgres-ds" class="com.zaxxer.hikari.HikariDataSource" > destroy-method="close"> > <property name="dataSourceClassName" > value="org.postgresql.ds.PGSimpleDataSource" /> > <property name="maximumPoolSize" value="20" /> > <property name="dataSourceProperties" > > <props> > <prop key="portNumber">5432</prop> > <prop key="databaseName">activemq</prop> > <prop key="serverName">xxxxx.database.azure.com</prop> > <prop key="user">xxxxx</prop> > <prop key="password">xxxxx</prop> > <prop key="logUnclosedConnections">true</prop> > </props> > </property> > </bean>{code} > {code:xml} > <bean id="postgres-dsOLD" class="org.apache.commons.dbcp2.BasicDataSource" > destroy-method="close"> > <property name="driverClassName" value="org.postgresql.Driver"/> > <property name="url" > value="jdbc:postgresql://xxxx.database.azure.com:5432/activemq"/> > <property name="username" value="xxxxx"/> > <property name="password" value="xxxxx"/> > </bean>{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)