在 Spring Tool Suite 中执行 Grails 应用程序时出错

Error when executing Grails application in Spring Tool Suite

在 Spring Tool Suite 中执行我的 Grails 应用程序时出现以下错误:

| Error 2015-06-12 18:19:18,357 [localhost-startStop-1] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table meta_data_master_template add index FK6FD57D1CFA081AA2 (protocol_id), add constraint FK6FD57D1CFA081AA2 foreign key (protocol_id) references protocol (protocol_id)

| Error 2015-06-12 18:19:18,357 [localhost-startStop-1] ERROR hbm2ddl.SchemaUpdate - Cannot add or update a child row: a foreign key constraint fails (datumrite.#sql-1204_4, CONSTRAINT FK6FD57D1CFA081AA2 FOREIGN KEY (protocol_id) REFERENCES protocol (protocol_id))

| Error 2015-06-12 18:19:21,887 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'org.grails.activiti.springsecurity.SetAuthenticatedUserIdFilters': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Lorg/apache/ibatis/session/SqlSessionFactory;

Message: Error creating bean with name 'org.grails.activiti.springsecurity.SetAuthenticatedUserIdFilters': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Lorg/apache/ibatis/session/SqlSessionFactory;

Caused by BeanCreationException: Error creating bean with name 'processEngine': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Lorg/apache/ibatis/session/SqlSessionFactory;

如消息所示,从您的数据库中删除 CONSTRAINT FK6FD57D1CFA081AA2,然后重试。或者,您可以从 DataSource

中删除 dbCreate = "update"