cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti REST after restart

hbacanak
Champ in-the-making
Champ in-the-making
Hi,

I am deploying activiti-rest(5.17.0) war on tomcat (8.0.9) and postgresql(9.3.5). However it only works for the first time. After i restart tomcat i get 404.

What i changed:

activiti-rest\WEB-INF\classes\db.properties
db=pgsql
jdbc.driver=org.postgresql.Driver
jdbc.url=jdbcSmiley Tongueostgresql://localhost:5432/Activiti
jdbc.username=xxxx
jdbc.password=xxxx

activiti-rest\WEB-INF\classes\engine.properties(first run)
# demo data properties
create.demo.users=true
create.demo.definitions=true
create.demo.models=true

# engine properties
engine.schema.update=true
engine.activate.jobexecutor=false
engine.asyncexecutor.enabled=true
engine.asyncexecutor.activate=true
engine.history.level=full

activiti-rest\WEB-INF\classes\engine.properties(other runs)
# demo data properties
create.demo.users=false
create.demo.definitions=false
create.demo.models=false

# engine properties
engine.schema.update=false
engine.activate.jobexecutor=false
engine.asyncexecutor.enabled=true
engine.asyncexecutor.activate=true
engine.history.level=full

What i expect?
After database initialization and demo data is set, i shouldn't recreate the data again.

What is happening
At first deployment everything is working as expected
http://localhost:8080/activiti-rest/service/identity/users returns
{"data":[{"id":"fozzie","firstName":"Fozzie","lastName":"Bear","url":"http://localhost:8080/activiti-rest/service/identity/users/fozzie','email':'fozzie@activiti.org','pi...}, .. etc

When i restart tomcat and access  http://localhost:8080/activiti-rest/service/identity/users returns 404.
it is this way unless drop Activiti database, recreate and deploy activiti rest. Again this only works for the first time.

Any ideas why is this happening?
13 REPLIES 13

jbarrez
Star Contributor
Star Contributor
So basically you say you've got two ways of uppercasing the same character? First time in my life I heard that Smiley Tongue

But I don't see how this could be solved for everything: if the JDK and Tomcat are both on the same locale, shouldn't it do what the locale says? So you also say that the JDK is wrong?

hbacanak
Champ in-the-making
Champ in-the-making
> So basically you say you've got two ways of uppercasing the same character? First time in my life I heard that smiley
Hehe, we are accustomed to it, problematic at every platform smiley. Just to be clear we don’t have two ways of uppercasing the same letter, we have 2 different letters for english letter ‘i’ (approximately). When you lowercase ‘I’, in english you have ‘i’, in turkish you have ‘ı’.

> But I don't see how this could be solved for everything: if the JDK and Tomcat are both on the same locale, shouldn't it do what the locale says? So you also say that the JDK is wrong?

No JDK is not wrong and handles this correctly. If you run the problem example, it will fail only toLowercaseTestWithTrLocale() if you have english locale; both toLowercaseTestWithTrLocale and toLowercaseTest() will fail if you have turkish locale.So when i run tomcat, it defaults to turkish locale and behaves as expected, which breaks your assumption about lower cased table name.
That being said, it will not be problem for us i guess. We plan to use a customized standalone activiti engine which can live in an english locale happily ever after.

The net impact of this problem:
1- Activiti modules will not work out of the box, if you are using a locale with incompatible character mapping, the error is hard to track down
2- You can not run multiple applications in the same tomcat instance with activiti if you need your default locale.

Optimal solution would be changing

if ("postgres".equals(databaseType)) {
        tableName = tableName.toLowerCase();
}

To
if ("postgres".equals(databaseType)) {
        tableName = tableName.toLowerCase(englishLocale);
}
At
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...

This way assumptions about lowercased table names will hold regardless of default locales.

trademak
Star Contributor
Star Contributor
Interesting, would you be willing to provide a pull request for this, since you can make sure it works in your environment?

Best regards,

hbacanak
Champ in-the-making
Champ in-the-making
ok, i will look into it. have a nice day.