access to process Engine from customize application by Java API

232 views
Skip to first unread message

ced.b...@gmail.com

unread,
May 27, 2014, 4:22:28 PM5/27/14
to camunda-...@googlegroups.com
Hi,

I would like to execute a process which is in Camunda from an external program by using Java API with ProcessEngine. I have seen in the documentation that with ProcessEngine I can use "jdbc:h2:tcp://localhost/camunda" like indicate in url: http://docs.camunda.org/latest/guides/user-guide/

I show my exemple:
public static void main( String[] args )
{
....
ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setJdbcDriver("org.h2.Driver")
.setJdbcUrl("jdbc:h2:tcp://localhost:16000/camunda")
.setJdbcUsername("demo")
.setJdbcPassword("demo")
.buildProcessEngine();
....
}

When I execute the program, I have this error after a few seconds:

org.h2.jdbc.JdbcSQLException: Connection is broken: "java.io.EOFException: localhost:16000" [90067-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:434)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:311)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
at org.h2.Driver.connect(Driver.java:74)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:190)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:181)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:176)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:80)
at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:371)
at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:80)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:660)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:622)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:409)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:380)
at com.test.mavenproject4.App.main(App.java:76)
Caused by: java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.h2.value.Transfer.readInt(Transfer.java:157)
at org.h2.engine.SessionRemote.done(SessionRemote.java:599)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:119)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:430)
... 16 more

is something wrong in JdbcUrl???

OR are there another way to indicate the url in ProcessEngine for using the good camunda plaform where are all process?

Thank you for your help

Sebastian Menski

unread,
May 28, 2014, 9:16:11 AM5/28/14
to camunda-...@googlegroups.com, ced.b...@gmail.com
Hi Cedric,

I'm not sure what you want to achieve with your code.

ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration
Is used to bootstrap a new process engine as described here. You cannot use it to communicate with
an existing process engine.

And sorry but I don't understand what you mean with:

OR are there another way to indicate the url in ProcessEngine for using the good camunda plaform where are all process?


What is your use case? What do you want to achieve?

Cheers,
Sebastian

ced.b...@gmail.com

unread,
May 29, 2014, 4:40:42 AM5/29/14
to camunda-...@googlegroups.com, ced.b...@gmail.com
Hi Sebastian,

in fact, I have a custom application where I would like to connect it to a remote process Engine (Standalone (Remote) Process Engine Server). I have seen in the schema (http://docs.camunda.org/latest/guides/user-guide/), that there two way which are by REST / Java API. I prefer to uise Java API and I would like to know how I can connect an object of Java API to a standalone Process Engine Serve. Is it possible?

Thank you for your help

Cédric

Christian Lipphardt

unread,
May 30, 2014, 7:39:49 AM5/30/14
to camunda-...@googlegroups.com, ced.b...@gmail.com
Hi Cedric,

Did you start the H2 database on the command line with the settings: localhost:16000 ?
Make sure H2 is running either by using "netstat -ntap | grep 16000" (unix) or "netstat -a | find "LISTENING" (windows).
You should find something, when H2 is up.

Be aware that the process you are describing as "connecting to a remote process engine" is just accessing the database of the other process engine.
I think there can be some limitations when accessing h2 through multiple application at the same time. It has to be configured accordingly. Either have a look at the h2 documentation or use something like PostgreSQL.

Cheers,
Christian
Reply all
Reply to author
Forward
0 new messages