Support of spring boot configuration for camunda is great. I have interesting question
I am using camunda-spring-boot-starter in one of my Spring boot Micro service with embedded h2 database,However I deployed the Camunda Web Apps ( Admin, cockpit , Tasklist ) in a seperate server and access the process states from Engine deployed in the micro service.
But the problem here I’m unable to connect the remote h2 database which is running in Spring boot micro service from Camunda Web Apps.
In applicationContext.xml, I’m making the below changes
After making those changes im getting below errors
13-May-2020 18:18:50.798 SEVERE [main] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection is broken: “unexpected status 1213486160” [90067-190])
@SKS make sure that are you using correct jdbc driver version which is compatible with database version.
Other possible reasons maybe using of H2 database are,
This can be caused due to stale java processes holding the H2 database files and having an explicit lock on it. Normally stopping the TSSS service should release the lock on the H2 database files but there may be certain scenarios where the stale java processes still have a hold on those files. Stop the service and Delete the ‘db.lock.db’ file from the H2 folder.
You need to use a TCP connection for multiple users. Start the server in TCP mode. Honesetly, it is pretty straight forward in the documentation.
Thanks @aravindhrs for the quick response. h2 database is running in one of the Spring boot micro service and camunda webapps(camunda engine) is running in another tomcat server. In applicationcontext.xml i have updated jdbc url with the value “jdbc:h2:tcp://localhost:10090/testdb”.
Below is the snippet
No Luck. Just to understand better testdb is created and running in one of my Spring boot microservice.
I’ trying to connect to this h2 database from my camunda webapps server.
Below error occurs when I start my camunda webapps
13-May-2020 22:50:08.024 SEVERE [main] org.camunda.commons.logging.BaseLogger.logError ENGINE-12012 Exception on accessing the database connection: Cannot create PoolableConnectionFactory (Connection is broken: “unexpected status 1213486160” [90067-190])
13-May-2020 22:50:12.393 WARNING [main] org.springframework.context.support.AbstractApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection is broken: “unexpected status 1213486160” [90067-190])
13-May-2020 22:50:12.393 SEVERE [main] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection is broken: “unexpected status 1213486160” [90067-190])
Multiple Connections to the Same Database: Client/Server
If you want to access the same database at the same time from different processes or computers, you need to use the client / server mode. In this case, one process acts as the server, and the other processes (that could reside on other computers as well) connect to the server via TCP/IP (or TLS over TCP/IP for improved security).
Automatic Mixed Mode
Multiple processes can access the same database without having to start the server manually. To do that, append ;AUTO_SERVER=TRUE to the database URL. You can use the same database URL independent of whether the database is already open or not. This feature doesn’t work with in-memory databases.
here how will my webapps know on which URL is my h2 db is running?
After updating the URL below error is logging into console
Cannot create PoolableConnectionFactory (A file path that is implicitly relative to the current working directory is not allowed in the database URL “jdbc:h2:/data/testdb;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=10090”. Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-190])
I could run a microservice with embedded engine. My standalone cockpit could be configured to access the micro-service’s database and thus I have a remote cockpit.
Could you please provide me one working remote(same computer or different computer) h2 db configuration?
Hi, can you please share configuration you used in spring-boot micro-service for h2 and in tomcat webapps with tcp which worked for you ? I am also facing the same issue but not able to find any solution.
Hi, can you please share configuration you used in spring-boot micro-service for h2 and in tomcat webapps with tcp which worked for you ? I am also facing the same issue but not able to find any solution