Can't connet to SQLServer

I am trying to change the RDBMS from the H2 to work with SQLServer, I am able to use a connector and use the SQLServer instance so the problem does not seem to be with the SQLServer configuration.


I am encountering a problem the moment I execute "start-bonita.bat" I think the problem comes from the host name, because it contains a backslash "/" and in the error message it is not shown.

my host name (I added a double backlash where the backlash is):

bdm.db.server.name=PLX300000000541\\SQLEXPRESS


the error line (ignores the double backlash):


Caused by: java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".)

I am working on Bonita 2021 with SQLServer2019; but I have tried to do this on different computers and versions of Bonita and SQLServer and the same error occurs.


The following error is shown repeatedly:

Related cause:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bonitaDataSource' defined in class path resource [bonita-platform-community.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Excepción inesperada resolviendo referencia [Root exception is java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".)]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1653)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:894)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:619)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:536)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:503)
        at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:265)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1473)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1270)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
        at org.bonitasoft.engine.service.impl.SpringBeanAccessor.initializeContext(SpringBeanAccessor.java:67)
        at org.bonitasoft.engine.service.impl.SpringBeanAccessor.getContext(SpringBeanAccessor.java:55)
        at org.bonitasoft.engine.service.impl.SpringBeanAccessor.getService(SpringBeanAccessor.java:42)
        at org.bonitasoft.engine.service.impl.SpringPlatformServiceAccessor.getPlatformSessionService(SpringPlatformServiceAccessor.java:97)
        at org.bonitasoft.engine.EngineInitializer.getPlatformSessionService(EngineInitializer.java:96)
        at org.bonitasoft.engine.EngineInitializer.unloadEngine(EngineInitializer.java:131)
        at org.bonitasoft.engine.api.internal.servlet.EngineInitializerListener.contextDestroyed(EngineInitializerListener.java:41)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4735)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5399)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
        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.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: javax.naming.NamingException: Excepción inesperada resolviendo referencia [Root exception is java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".)]
        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 javax.naming.InitialContext.lookup(InitialContext.java:417)
        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 (No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".)
        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 javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
        ... 63 more
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".)
        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
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: No se pudo realizar la conexión TCP/IP al host PLX300000000541SQLEXPRESS, puerto 49652. Error: "PLX300000000541SQLEXPRESS. Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
        at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:242)
        at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2369)
        at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:551)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1963)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
        at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:704)
        at com.microsoft.sqlserver.jdbc.SQLServerPooledConnection.createNewConnection(SQLServerPooledConnection.java:59)
        at com.microsoft.sqlserver.jdbc.SQLServerPooledConnection.<init>(SQLServerPooledConnection.java:41)
        at com.microsoft.sqlserver.jdbc.SQLServerXAConnection.<init>(SQLServerXAConnection.java:30)
        at com.microsoft.sqlserver.jdbc.SQLServerXADataSource.getXAConnection(SQLServerXADataSource.java:50)
        at com.microsoft.sqlserver.jdbc.SQLServerXADataSource.getXAConnection(SQLServerXADataSource.java:83)
        at org.apache.tomcat.dbcp.dbcp2.managed.DataSourceXAConnectionFactory.createConnection(DataSourceXAConnectionFactory.java:145)
        at org.apache.tomcat.dbcp.dbcp2.managed.PoolableManagedConnectionFactory.makeObject(PoolableManagedConnectionFactory.java:75)
        at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:102)
        at org.apache.tomcat.dbcp.dbcp2.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:248)
        ... 70 more

2021-05-13 08:29:22.438 +0200 INFORMACIÓN: org.apache.catalina.startup.HostConfig Deployment of deployment descriptor [C:\BonitaCommunity\server\conf\Catalina\localhost\bonita.xml] has finished in [258.906] ms
2021-05-13 08:29:22.438 +0200 INFORMACIÓN: org.apache.catalina.startup.HostConfig Desplegando el directorio [C:\BonitaCommunity\server\webapps\ROOT] de la aplicación web
2021-05-13 08:29:22.499 +0200 INFORMACIÓN: org.apache.catalina.startup.HostConfig Deployment of web application directory [C:\BonitaCommunity\server\webapps\ROOT] has finished in [61] ms
2021-05-13 08:29:22.509 +0200 INFORMACIÓN: org.apache.coyote.http11.Http11NioProtocol Starting ProtocolHandler ["http-nio-8080"]
2021-05-13 08:29:22.532 +0200 INFORMACIÓN: org.apache.catalina.startup.Catalina Server startup in 259279 ms

My database.properties file looks like this:

####################################################################################
#
# Modify the following values to suit your database needs.
# Fore more information, see file ../HOW_TO_CONFIGURE_AND_RUN.txt
#
####################################################################################


#########################################
# Bonita database properties
#########################################

# valid values are (h2, postgres, sqlserver, oracle, mysql)
db.vendor=sqlserver
# when using h2, no server or port setting is needed since connexion is made using file protocol mode using relative directory:
db.server.name=PLX300000000541\\SQLEXPRESS
db.server.port=49652
# if your database name contains a backslash (\) character, you must double it (\\):
db.database.name=
db.user=bonitadev
# if your database password contains a backslash (\) character, you must double it (\\):
db.password=secret_password123

###################################
# Business Data database properties
###################################
# valid values are (h2, postgres, sqlserver, oracle, mysql)
bdm.db.vendor=sqlserver
bdm.db.server.name=PLX300000000541\\SQLEXPRESS
bdm.db.server.port=49652
bdm.db.database.name=BONITA
bdm.db.user=bonitadev
bdm.db.password=secret_password123


# IMPORTANT NOTE regarding H2 database:
# in case you move whole setup folder to another directory, you must change property below
# to point to original folder containing h2 database folder
# new value can be relative or absolute since it still points to the right folder
# WARNING for Windows users: keep forward slashes like below (instead of backslashes):
#h2.database.dir=../h2_database

Hi Carlos,

just check you don't try to change this connection in your studio, and ensure you put the required Jdbc driver jar in the proper folder as detailed in documentation https://documentation.bonitasoft.com/bonita/2021.1/list-of-database-connectors#mssql