Exception Connection Camunda with MSSQL Server

my application is using Embedded Camunda BPMN in JBOSS EAP 5.2 .
void doSomething() {
processEngine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = .processEngine…getRuntimeService();
// do something mit RuntimeService
}

void doSomething2() {
processEngine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = .processEngine…getRuntimeService();
// do something mit RuntimeService
}

Application ran after an hour, the exception is throw
[org.camunda.bpm.engine.context] ENGINE-16004 Exception while closing command context:

Error querying database. Cause: org.jboss.util.NestedSQLException: Unable to get managed connection for bpmDS; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for bpmDS)

The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Task.xml

The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria

The error occurred while executing a query

What is wrong?

Dear @hung,

I think JBoss EAP 5.2 is not supported, please see list of supported environments here

https://docs.camunda.org/manual/7.5/introduction/supported-environments/

Would it be possible to upgrade environment for you?

Cheers,
Askar

Yes I know but I can’t upgrade to an another JBOSS. Mr Bernd said that I can use an embededed Camunda Engine in JBOSS 5.
I ve the same problem in Wildfly 8
What is wrong in my implementation? .

Hi @hung,

can you show me your configuration file? do you have bpmDS defined?

Cheers,
Askar

bpmDS false com.microsoft.sqlserver.jdbc.SQLServerXADataSource jdbc:sqlserver://xxxxx;DatabaseName=xxxxx
  <xa-datasource-property name="User">xxxxx</xa-datasource-property>
  <xa-datasource-property name="Password">xxxxx</xa-datasource-property>

  <!-- Datasource/connection factory type-mapping -->
  <metadata>
     <type-mapping>MS SQLSERVER2000</type-mapping>
  </metadata>
    <no-tx-separate-pools></no-tx-separate-pools>
</xa-datasource>   
////////////////////////////////////////////////////////////////////////////////////////// and camunda.cfg.xml
    <property name="dataSource" ref="dataSourceBPMNjee" />
    
     <property name="transactionManager" ref="transactionManagerJTA" /> 
</bean>

<bean id="transactionManagerJTA"
        class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManagerName" value="java:/TransactionManager" /> 
</bean>

Hi @hung,

could you may be attach files after deleting all passwords out of them? It’s a bit hard to read right now.
What is dataSourceBPMNjee?

Cheers,
Askar

camunda_config.txt (2.3 KB)

Hi @hung,

can it be that your datasource configuration is not defining jndi name properly?

https://access.redhat.com/documentation/en-US/JBoss_Enterprise_BRMS_Platform/5/html/BRMS_Administrator_Guide/Configuring_a_Datasource_for_JBoss_Enterprise_Application_Platform_6.html

should it be java:bpmDS?

Cheers,
Askar

I think the Datasource is O.K. it is running for an hour and after that the exception is throw.
I use it in JBOSS 5 not JBOSS 6.

@hung, so connection is getting dropped after one hour approximately?
have you tried adding check-valid-connection-sql element to your datasource configuration?

I would recommend to take a look at background-validation parameters too.

I use MSSQLValidConnectionChecker to check it.
My question is, wenn my connection lost, was should I do?
How can I do it?

Hi @hung,

when connection is lost you should reconnect. How to do it is a good question for a JBoss community.

http://www.jboss.org/forums/

I am not sure that it’s helpful, but here is what I’ve found

http://blogs.adobe.com/livecycle/2011/03/setting-up-jboss-to-auto-reconnect-after-database-outage.html

Hope that helps,
Askar