cancel
Showing results for 
Search instead for 
Did you mean: 

Is it appropriate to replace the ACT_ID_* Tables with Views of the same names?

tchu_2000
Champ in-the-making
Champ in-the-making
The reason why we replace the user/group/membership/info tables with views is that we need to map relevant identity info from our business system into context of the Activiti engine without needless redundancy. Meanwhile, keep the modification to Activiti engine as little as possible so as to benefit from engine upgrade more easily.
I do figure out mapping the local identity tables into 4 views with exactly the same schema of the corresponding tables. However, according to the tomcat log, identityService cannot be instantiated.
————– tomcat log ————————————————————————————————–
<blockcode>
Oct 31, 2014 1:28:43 下午 org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Oct 31, 2014 1:28:45 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.activiti.explorer.servlet.WebConfigurer
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoDataConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.activiti.engine.IdentityService org.activiti.explorer.conf.DemoDataConfiguration.identityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'identityService' defined in class path resource [org/activiti/explorer/conf/ActivitiEngineConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.activiti.engine.IdentityService org.activiti.explorer.conf.ActivitiEngineConfiguration.identityService()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in class path resource [org/activiti/explorer/conf/ActivitiEngineConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.activiti.engine.ProcessEngine org.activiti.explorer.conf.ActivitiEngineConfiguration.processEngine()] threw exception; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.activiti.engine.ActivitiException: Activiti database problem: Tables missing for component(s) identity
   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
   at org.activiti.explorer.servlet.WebConfigurer.contextInitialized(WebConfigurer.java:40)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)
   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
   at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
</blockcode>
————————————————————————————————————————
It's said someone else had successfully "cheat" the engine with such hack, but I doubt if it's no longer applicable in the 5.16.4 version?
Especially, I cannot find activiti-standalone-context.xml under the webapps\activiti-explorer\WEB-INF\ anymore.. Where shall I modify the processEngineConfiguration in the new version?

An early reply would be greatly appreciated! Smiley Happy

Tiancheng Hu
4 REPLIES 4

tchu_2000
Champ in-the-making
Champ in-the-making
UPDATE:
* I've seen the error occurred is "Activiti database problem: Tables missing for component(s) identity", but I cannot locate which table cannot be properly loaded…
* I've search there is other methods to deal with our use case, such as customizing a SessionFactory. But we are originally .Net developing team (the business system was built in .Net), so we are obliged to know if it's theoretically possible to HACK the problem in an easier way.
* We have no needs to do Create/Update/Delete on identity tables from the Activiti engine.

jbarrez
Star Contributor
Star Contributor
Hmmm,  i dont think it has been done before … and it will depend on the fact whether your Driver knows it's a view or a table.
But looking at the exception, it doesn't seem like it does Smiley Sad

tchu_2000
Champ in-the-making
Champ in-the-making
Hi, jbarrez,
Thank you for your prompt reply~ (sorry for timezone gap between our worktime. btw, I really admire your SOHO lifeSmiley Happy )
In fact I've managed to "cheat" activiti-explorer's IdentityService at least on 5.16.3! (using the View mapping scheme)
My database environment: <code>db=mssql  jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver</code>

I decide to take a look at why 5.16.4 failed to autowire the IdentityService but I need some help:
Where can I configure <code>processEngineConfiguration.databaseSchemaUpdate</code> and <code>demoDataGenerator.createDemoUsersAndGroups</code> in the 5.16.4?
For 5.16.3, I can config the above properties in WEB-INF\activiti-standalone-context.xml however I failed to find out these flags in 5.16.4..

Wish good mood~

jbarrez
Star Contributor
Star Contributor
Yes, we did change from XML -> Java config in the latest release.
And we DO need to update our docs to reflect that…. which we will do soon.

The main idea now is that you make your own kind of config in that case, similar to https://github.com/Activiti/Activiti/tree/master/modules/activiti-webapp-explorer2/src/main/java/org....