Hi,
I try to install the newest version of Bonita. Previously i worked with version 7.8.0 and i have two separate database schema.
In /setup/database.properties, in field (bdm).database.name=DATABASE_NAME?currentSchema=SCHEMA_NAME
When i start server i get error:
Caused by: javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: database "DATABASE_NAME?currentSchema=SCHEMA_NAME" does not exist)]
at org.apache.naming.NamingContext.lookup(NamingContext.java:856)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
at org.springframework.jndi.JndiTemplate.lambda$lookup$0(JndiTemplate.java:157)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:92)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:157)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:96)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:114)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:239)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:225)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
... 46 more
Caused by: java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: database "DATABASE_NAME?currentSchema=SCHEMA_NAME" does not exist)
at org.jboss.narayana.tomcat.jta.internal.PoolingDataSourceFactory.createPoolingDataSource(PoolingDataSourceFactory.java:153)
at org.jboss.narayana.tomcat.jta.TransactionalDataSourceFactory.getObjectInstance(TransactionalDataSourceFactory.java:72)
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96)
at java.naming/javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:330)
at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
... 63 more
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: database "DATABASE_NAME?currentSchema=SCHEMA_NAME" does not exist)
at org.apache.tomcat.dbcp.dbcp2.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:252)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:533)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getLogWriter(BasicDataSource.java:1047)
at org.jboss.narayana.tomcat.jta.internal.PoolingDataSourceFactory.createPoolingDataSource(PoolingDataSourceFactory.java:149)
... 67 more
The weirdest thing is that in bonita engine database, setup created table structure but exception was raised while try to start Bonita server.
This approach work fine with 7.8.0 and postgres 9 but don't work with 2021.1 and postgres 11.
Do you have any suggestion for this - how to define separate schema for Bonita ?
Hi,
My feeling is that there is a type somewhere...
Could you post you database.properties file pls? (feel free to make it annonymous) and any other modified file (internal.properties... conf/setenv...)
You speak about BDM (bdm).database.name=DATABASE_NAME?currentSchema=SCHEMA_NAME and then about table structure.
Which connection is failing? can you add your logs as well?
Thanks
Hi Pablo, thank you for interesting of my problem.
There was from my side too big shortcut, bellow i describe my problem with more details.
In database i created one dabatase and 2 schema (BDM and Engine). In databse.properties i defined: bonita_business (BDM) and bonita_engine schema. When i run .start-bonita.sh there script start init and table structure in bonita_engine was created successfully (i log in by diabase client). Then when server try to start it shows log as above. Off course users bonita_engine have full access to corresponding schemas and database.
Here is sample of database.properties file:
#########################################
# Bonita database properties
#########################################
db.vendor=postgres
db.server.name=DATABASE_SERVER.postgres.database.azure.com
db.server.port=5432
db.database.name=DATABASE_NAME?currentSchema=bonita_engine
db.user=bonita_engine@DATABASE_SERVER
db.password=bonita_engine_password
###################################
# Business Data database properties
###################################
# valid values are (h2, postgres, sqlserver, oracle, mysql)
bdm.db.vendor=postgres
bdm.db.server.name=DATABASE_SERVER.postgres.database.azure.com
bdm.db.server.port=5432
bdm.db.database.name=DATABASE_NAME?currentSchema=bonita_business
bdm.db.user=bonita_business@DATABASE_SERVER
bdm.db.password=bonita_business_password
When i create two separate databases (BDM and Engine) with default schema (public) it works fine.
Exceptions are for bonita_business schema and for bonita_engine with the simmilar structurue.
2021-02-17 16:49:47.425 +0000 INFO (main) com.arjuna.ats.arjuna ARJUNA012170: TransactionStatusManager started on port 33575 and host 127.0.0.1 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
2021-02-17 16:49:47.519 +0000 INFO (main) org.apache.catalina.core.StandardService Starting service [Catalina]
2021-02-17 16:49:47.519 +0000 INFO (main) org.apache.catalina.core.StandardEngine Starting Servlet Engine: Apache Tomcat/8.5.59
2021-02-17 16:49:47.533 +0000 INFO (localhost-startStop-1) org.apache.catalina.startup.HostConfig Deploying deployment descriptor [/data/Bonita/server/conf/Catalina/localhost/bonita.xml]
2021-02-17 16:49:49.953 +0000 WARNING (localhost-startStop-1) org.apache.naming.NamingContext Unexpected exception resolving reference
java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: database "DATABASE_NAME?currentSchema=bonita_business" does not exist)
at org.jboss.narayana.tomcat.jta.internal.PoolingDataSourceFactory.createPoolingDataSource(PoolingDataSourceFactory.java:153)
at org.jboss.narayana.tomcat.jta.TransactionalDataSourceFactory.getObjectInstance(TransactionalDataSourceFactory.java:72)
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96)
at java.naming/javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:330)
at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1017)
at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:557)
at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:253)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:614)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1822)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: database "DATABASE_NAME?currentSchema=bonita_business" does not exist)
at org.apache.tomcat.dbcp.dbcp2.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:252)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:533)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getLogWriter(BasicDataSource.java:1047)
at org.jboss.narayana.tomcat.jta.internal.PoolingDataSourceFactory.createPoolingDataSource(PoolingDataSourceFactory.java:149)
... 21 more
Caused by: org.postgresql.util.PSQLException: FATAL: database "DATABASE_NAME?currentSchema=bonita_business" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2559)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:133)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:250)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
Hi krzysztof,
It could be related with the change from Bitronix to Arjuna.
https://stackoverflow.com/questions/4168689/is-it-possible-to-specify-the-schema-when-connecting-to-postgres-with-jdbc
https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH
Could you please test the following?
Remove from database.properties the ?currentSchema=...
On postgresql side, do a
SET search_path TO myschema,public;
to the bonita and bdm user each one to its defaul schema
If this does not work, Edit the file setup\tomcat-templates\bonita.xml and add a property currentSchema to all Resources (datasource) declared