liquibase cannot be created when using mysql

cancel
Showing results for 
Search instead for 
Did you mean: 
ycl
Member II

liquibase cannot be created when using mysql

With Activiti 6, I've tried activiti-app with H2 database and it works fine. But when I try to switch to mysql, tomcat failed to start with errors below:

12-Jan-2018 10:55:13.063 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
12-Jan-2018 10:55:13.063 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
12-Jan-2018 10:55:26.521 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.activiti.app.servlet.WebConfigurer]
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/activiti/app/conf/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.Liquibase]: Factory method 'liquibase' threw exception; nested exception is org.activiti.engine.ActivitiException: Error creating liquibase database
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.activiti.app.servlet.WebConfigurer.contextInitialized(WebConfigurer.java:62)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.Liquibase]: Factory method 'liquibase' threw exception; nested exception is org.activiti.engine.ActivitiException: Error creating liquibase database
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 25 more
Caused by: org.activiti.engine.ActivitiException: Error creating liquibase database
    at org.activiti.app.conf.DatabaseConfiguration.liquibase(DatabaseConfiguration.java:214)
    at org.activiti.app.conf.DatabaseConfiguration$$EnhancerBySpringCGLIB$$c514db18.CGLIB$liquibase$5(<generated>)
    at org.activiti.app.conf.DatabaseConfiguration$$EnhancerBySpringCGLIB$$c514db18$$FastClassBySpringCGLIB$$51b2c390.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at org.activiti.app.conf.DatabaseConfiguration$$EnhancerBySpringCGLIB$$c514db18.liquibase(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 26 more

12-Jan-2018 10:55:26.549 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class [org.activiti.app.servlet.WebConfigurer]
 java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:83)
    at org.activiti.app.servlet.WebConfigurer.contextDestroyed(WebConfigurer.java:125)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4792)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5429)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

12-Jan-2018 10:55:26.977 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
12-Jan-2018 10:55:26.977 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

basically, it says liquibase cannot be created.

I am using Tomcat-8, mysql-5.6, oracle jdk8 on ubuntu14.04.

And I config the connection in

tomcat/webapps/activiti-app/WEB-INF/classes/META-INF/activiti-app/activiti-app.properties

as below:

#datasource.driver=org.h2.Driver
#datasource.url=jdbc:h2:mem:activiti;DB_CLOSE_DELAY=-1

datasource.driver=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://127.0.0.1:3306/activitiapp?characterEncoding=UTF-8

datasource.username=activitiadmin
datasource.password=******

#hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.dialect=org.hibernate.dialect.MySQLDialect

What could be wrong with my settings? Any comments would be appreciated. Thanks in advance.

(I update the exception stack log which is from tomcat log file. It's the full content.)

2 Replies
ryandawson
Alfresco Employee

Re: liquibase cannot be created when using mysql

Are you sure there isn't more to that stacktrace if you go further down? I'd expect there to be something on why the liquibase can't be instantiated.

ycl
Member II

Re: liquibase cannot be created when using mysql

I solved this problem.

The exception stack log is not the real problem, actually it's a result.

Because the database user I gave activit-app does not have full access to mysql database, on startup creation of acitivit-app database did not finish correctly. These exception stack log is from the second start of tomcat.

After I gave full access to database, delete all the tables and restart tomcat, activiti-app works fine.