cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up activity for standalone H2 Database.

mohit
Champ on-the-rise
Champ on-the-rise
Hi All,

I am following the book Activiti in action along with the official documentation of Activity.

So, far I have managed to run BookOrderTest & SimpleProcessTest successfully in InMemory DB settings.

But, whenever I update my code to use the standalone H2 DB, I start getting:

org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-191]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
   at org.h2.message.DbException.get(DbException.java:179)
   at org.h2.message.DbException.get(DbException.java:155)
   at org.h2.message.DbException.get(DbException.java:144)
   at org.h2.engine.Engine.validateUserAndPassword(Engine.java:333)
   at org.h2.engine.Engine.createSessionAndValidate(Engine.java:161)
   at org.h2.engine.Engine.createSession(Engine.java:136)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:745)

I have posted this on stackoverflow with complete details of my project + setup: http://stackoverflow.com/q/35558646/768894

Can someone please help as I have already wasted 6 hours now and this just won't work?
Is there some book/documentation intended for beginners which provide example and settings that actually work?

I was expecting activiti to be fun, but the Official documentation either assumes a lot or points to other sites instead of just sharing some standard settings and working examples. Smiley Sad


Thanks,
Mohit

7 REPLIES 7

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Mohit,

I would focus on the

org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-191]

Did you set correct user name/password?

Regards
Martin

Hi Martin,

Thanks for the reply.

I am not sure how to set username/password. I am using the default settings only.

I managed to log into H2 console using credentials sa/sa.

in my tomcat/webapps…./db.properties and activiti.cfg.xml I have:

jdbc.username=sa
jdbc.password=
&
property name="jdbcUsername" value="sa"
property name="jdbcPassword" value=""

respectively.

I had also tried by setting password value as "sa" in these two files. But in that case I get a different error:

01:36:27,467 [localhost-startStop-1] ERROR org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl  - Exception while closing the Database connection
org.h2.jdbc.JdbcSQLException: Connection is broken: "unexpected status 16777216" [90067-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
at org.h2.engine.SessionRemote.done(SessionRemote.java:621)
at org.h2.engine.SessionRemote.close(SessionRemote.java:552)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:383)
at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)
at …


      

mohit
Champ on-the-rise
Champ on-the-rise
Ok, I just replaced the JdbcUrl from jdbc:h2:tcp://localhost/~/test to jdbc:h2:tcp://localhost/~/activiti
and tomcat is now starting fine, without errors. Not sure what happened.
 
I can now execute my BookOrderTest successfully BUT I still can't see a new queued task being created due to this test run.
Any thoughts?

mohit
Champ on-the-rise
Champ on-the-rise
A little progress forward…
I had only updated my activiti.cfg.xml but db.properties file was still using in memory db, so it was running the test case but not updating the activiti-explorer UI, I guess.
As, soon as I updated db.properties file to point to my standalone H2 instance.. I started getting:

07:27:48,596 [localhost-startStop-1] ERROR org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl  - Exception while closing the Database connection
org.h2.jdbc.JdbcSQLException: Connection is broken: "unexpected status 16777216" [90067-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
at org.h2.engine.SessionRemote.done(SessionRemote.java:621)
at org.h2.engine.SessionRemote.close(SessionRemote.java:552)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:383)
at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Mohit.
Check h2 doc/forum what this error means.
(e.g. http://stackoverflow.com/questions/24803279/grails-accessing-h2-tcp-server-hangs)

Regards
Martin

Hi Martin,

I am aware that different client/server version causes this but I am not sure, this is the case here.

I am using H2 DB version: 1.4.191
And I also have it correctly mentioned in my POM:

<dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.4.191</version>
</dependency>

Thanks,
Mohit

jbarrez
Star Contributor
Star Contributor
Try to use version 1.3.x from H2. 1.4.x is still in beta.