Docker-compose camunda with sql server

Heloo Community

I’m a begginer in Camunda and I try to use camunda-bpm-platform:7.13.0 with Microsoft Artifact Registry.

my docker-compose look like this

version: '3.4'

services:    
  camunda-mssql:
    image: camunda/camunda-bpm-platform:7.13.0
    container_name: camunda-mssql        
    depends_on:
      - sqlserver      
    volumes:     
      - "D:/repos/Camunda_7/sqljdbc_4.2/enu/jre8/sqljdbc42.jar:/camunda/lib/sqljdbc42.jar"
      - "D:/repos/Camunda_7/server.xml:/camunda/conf/server.xml"
    environment:
      - SKIP_DB_CONFIG=true
      - DB_DRIVER=com.microsoft.sqlserver.jdbc.SQLServerDriver
      - DB_URL=jdbc:sqlserver://host.docker.internal:1433;databaseName=camunda;
      - DB_USERNAME=sa
      - DB_PASSWORD=yourStrong(!)Password
    links:
      - sqlserver         
    ports:
        - "8081:8080"
    
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2017-latest
    container_name: camunda-db
    command: /bin/bash ./entrypoint.sh    
    volumes:
      - dbdata:/var/opt/mssql/data
      - D:/repos/Camunda_7/CreateDatabase/docker-entrypoint.sh:/entrypoint.sh
      - D:/repos/Camunda_7/CreateDatabase/docker-db-init.sh:/db-init.sh
      - D:/repos/Camunda_7/CreateDatabase/camunda-db-init.sql:/camunda-db-init.sql
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=yourStrong(!)Password
      - MSSQL_AGENT_ENABLED=true
      - MSSQL_PID=Standard
    ports:
      - "1433:1433"
    restart: always    

volumes:
  dbdata:

The camunda-mssql service has the configuration for set de service.xml, the file look this

<Resource name="jdbc/ProcessEngine" 
    auth="Container" 
    type="javax.sql.DataSource" 
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
    uniqueResourceName="process-engine" 
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    url="jdbc:sqlserver://host.docker.internal:1433;DatabaseName=camunda;username=sa;password=yourStrong(!)Password" 
    defaultTransactionIsolation="READ_COMMITTED" 
    username="sa" 
    password="yourStrong(!)Password" 
    maxTotal="20" 
    minIdle="5" 
    maxIdle="20" 
    testOnBorrow="false"
    validationQuery="SELECT 1"
/>

Also attache the jar into camunda/lib

when execute the comand docker-compose up -d I have the next error

`01-Nov-2023 17:48:32.071 SEVERE [main] org.apache.catalina.startup.Catalina.start The required Server component failed to start so Tomcat is unable to start.`

`org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]`

`at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)`

`at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)`

`at org.apache.catalina.startup.Catalina.start(Catalina.java:633)`

`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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)`

`at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)`

`Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2874)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2361)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:44)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2347)`

`at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1794)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1405)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1069)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:905)`

`at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:452)`

`at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1014)`

`at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319)`

`at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)`

`at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744)`

`at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676)`

`at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483)`

`at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)`

`at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)`

`at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)`

`at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:560)`

`at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:244)`

`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:857)`

`at org.apache.naming.NamingContext.lookup(NamingContext.java:160)`

`at org.apache.naming.NamingContext.lookup(NamingContext.java:843)`

`at org.apache.naming.NamingContext.lookup(NamingContext.java:174)`

`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.StandardServer.startInternal(StandardServer.java:922)`

`at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)`

I try to solve my problem with the next post but I couldn’t resolve my problem

SQL Server configuration has been done but something else is wrong

[Solved]Configuring camunda with sql server

Error in connect Camunda to SqlServer - #7 by hassang

Thanks!

docker run -d --name camunda-mysql-env_swarm -p 9099:8080 --link -e DB_DRIVER=com.mysql.cj.jdbc.Driver -e DB_URL=jdbc:mysql:localhost//db:3306/mydb?autoReconnect=true -e DB_USERNAME=root -e DB_PASSWORD=mysqladmin -e camunda/camunda-bpm-platform:latest

I have local desktop docker … I have mysql container setup and on top it I used above command it worked for me

Hi, thanks for your answer. I resolved my problem yesterday. I used the wrong jar… the correct jar is mssql-jdbc-12.4.2.jre8.jar. Is ther any possibility that use database environment with sql server?

Is ther any possibility that use database environment with sql server? … can you please provide more details on it

Hi, rama_camunda. I try to explain:
This is my docker-compose

version: '3.4'

services:    
  camunda-mssql:
    image: camunda/camunda-bpm-platform:7.13.0
    container_name: camunda-mssql        
    depends_on:
      - sqlserver      
    volumes:      
      - "D:/repos/Camunda_7/mssql-jdbc-12.4.2.jre8.jar:/camunda/lib/mssql-jdbc-12.4.2.jre8.jar"
    environment:
      - SKIP_DB_CONFIG=true
      - DB_DRIVER=com.microsoft.sqlserver.jdbc.SQLServerDriver
      - DB_URL=jdbc:sqlserver://host.docker.internal:1433;databaseName=camunda;
      - DB_USERNAME=sa
      - DB_PASSWORD=yourStrong(!)Password
    links:
      - sqlserver         
    ports:
        - "8081:8080"
    
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2017-latest
    container_name: camunda-db
    command: /bin/bash ./entrypoint.sh    
    volumes:
      - dbdata:/var/opt/mssql/data
      - D:/repos/Camunda_7/CreateDatabase/docker-entrypoint.sh:/entrypoint.sh
      - D:/repos/Camunda_7/CreateDatabase/docker-db-init.sh:/db-init.sh
      - D:/repos/Camunda_7/CreateDatabase/camunda-db-init.sql:/camunda-db-init.sql
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=yourStrong(!)Password
      - MSSQL_AGENT_ENABLED=true
      - MSSQL_PID=Standard
    ports:
      - "1433:1433"
    restart: always    

volumes:
  dbdata:

my problem is that the environment variable related to database is setting in the conteiner

the jar is load perfect

but the database look like this

image

and the server.xml

Exists any solution for camunda take my database setting?

Thanks you

P.D.: Sorry for my english is not my native language

D:/repos/Camunda_7/CreateDatabase/docker-entrypoint.sh:/entrypoint.sh
- D:/repos/Camunda_7/CreateDatabase/docker-db-init.sh:/db-init.sh
- D:/repos/Camunda_7/CreateDatabase/camunda-db-init.sql:/camunda-db-init.sql

May is know the purpose of above statements

“…May is know the purpose of above statements”, yeap of course!
The official documentation explain that is necessary has camunda database up, so in my docker-compose I added these file to create the database Camunda inmmediately after the container mssql started.
I could start camunda server with mssql with the next setting:

docker-compose :rocket:

version: '3.4'

services:    
  camunda-mssql:
    image: camunda/camunda-bpm-platform:7.13.0
    container_name: camunda-mssql        
    depends_on:
      - sqlserver      
    volumes:      
      - "D:/repos/Camunda_7/mssql-jdbc-12.4.2.jre8.jar:/camunda/lib/mssql-jdbc-12.4.2.jre8.jar"
      - "D:/repos/Camunda_7/server.xml:/camunda/conf/server.xml"
    environment:
      - SKIP_DB_CONFIG=true      
      - WAIT_FOR=sqlserver:1433
      - DEBUG=true
    links:
      - sqlserver         
    ports:
        - "8081:8080"
    
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2017-latest
    container_name: camunda-db
    command: /bin/bash ./entrypoint.sh    
    volumes:
      - dbdata:/var/opt/mssql/data
      - D:/repos/Camunda_7/CreateDatabase/docker-entrypoint.sh:/entrypoint.sh
      - D:/repos/Camunda_7/CreateDatabase/docker-db-init.sh:/db-init.sh
      - D:/repos/Camunda_7/CreateDatabase/camunda-db-init.sql:/camunda-db-init.sql
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=yourStrong(!)Password
      - MSSQL_AGENT_ENABLED=true
      - MSSQL_PID=Standard
    ports:
      - "1433:1433"
    restart: always    

volumes:
  dbdata:

The docker-compose above has two volumnes:
- "D:/repos/Camunda_7/mssql-jdbc-12.4.2.jre8.jar:/camunda/lib/mssql-jdbc-12.4.2.jre8.jar
this jar is used for connect with sql server
- “D:/repos/Camunda_7/server.xml:/camunda/conf/server.xml” → this file is the configuration the comunda with sql server

**server.xml - the important pieco of code ** :man_technologist:t4:

<Resource name="jdbc/ProcessEngine" 
    auth="Container" 
    type="javax.sql.DataSource" 
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
    uniqueResourceName="process-engine" 
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    url="jdbc:sqlserver://host.docker.internal:1433;DatabaseName=camunda;username=sa;password=yourStrong(!)Password" 
    defaultTransactionIsolation="READ_COMMITTED" 
    username="sa" 
    password="yourStrong(!)Password" 
    maxTotal="20" 
    minIdle="5" 
    maxIdle="20" 
    testOnBorrow="false"
    validationQuery="SELECT 1"
/>

the configuration works but the problem is that environment database doesnt work with sql server, I mind doesn’t matter if you set or no the variables the camunda-bpm-platform only works with sql server if you mount a volume with server.xml. The problem with that is:

  • What about if a need different environment?
    I gonna to have different service.xml by environment :thinking:
  • What about with the database password? :thinking:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.