1. 程式人生 > >Mysql從Windows遷移到Linux,遇到的坑

Mysql從Windows遷移到Linux,遇到的坑

sso inject nod comm bean doc bst fine tin

最近有個項目從Windows上遷移到Linux上,數據庫在遷移成功,但是項目無法啟動

[BPM] 2018-09-23 17:04:52 ERROR [localhost-startStop-1] ContextLoader.initWebApplicationContext(307) | Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sysUserSyncService‘: Injection of resource dependencies failed; nested e
xception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sysUserService‘: Injection of resource dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘bpmNodeUserService‘: Injection of resource dependenc
ies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘bpmNodeUserCalculationSelector‘ defined
in class path resource [conf/app-beans.xml]: Cannot resolve reference to bean ‘sameNodeCalculationDepartment‘ while setting bean property ‘bpmNodeUserCalculatio
n‘ with key [TypedStringValue: value [sameNodeDepartment], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Err
or creating bean with name ‘sameNodeCalculationDepartment‘: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.Bea
nCreationException: Error creating bean with name ‘taskOpinionService‘: Injection of resource dependencies failed; nested exception is org.springframework.beans
.factory.BeanCreationException: Error creating bean with name ‘bpmService‘: Injection of resource dependencies failed; nested exception is org.springframework.b
eans.factory.BeanCreationException: Error creating bean with name ‘proce***unService‘: Injection of resource dependencies failed; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name ‘taskSignDataService‘: Injection of resource dependencies failed; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine‘: FactoryBean threw exception on object creation; neste
d exception is org.activiti.engine.ActivitiException: no activiti tables in db. set <property name="databaseSchemaUpdate" to value="true" or value="create-drop"
 (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation
        at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:307)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)

.....省略.....

但是該Linux上的項目連接Windows上的數據庫,並沒有這個錯誤,所以確定問題所在是Linux的數據庫有問題,經過幾番研究,發現問題所在!
Mysql在Windows下默認對大小寫不敏感,但在Linux下默認區分大小寫的!!
所以在配置文件上添加lower_case_table_names=1,重啟Mysql,再重啟項目,成功!

Mysql從Windows遷移到Linux,遇到的坑