gpt4 book ai didi

grails - Grails运行应用程序:任务 ':bootRun'的执行失败。错误:无法启动服务器

转载 作者:行者123 更新时间:2023-12-02 14:30:09 27 4
gpt4 key购买 nike

试图用Gradle进行bootRun,但是我无法摆脱这个错误:

| Running application...
objc[1566]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
INFO 5/9/16 4:10 PM: liquibase: Successfully acquired change log lock
INFO 5/9/16 4:10 PM: liquibase: Reading from PUBLIC.DATABASECHANGELOG
SEVERE 5/9/16 4:10 PM: liquibase: changelog.groovy: week-5A.groovy::1462469938896-1::Marco (generated): Change Set week-5A.groovy::1462469938896-1::Marco (generated) failed. Error: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191] [Failed SQL: CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id))]
liquibase.exception.DatabaseException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191] [Failed SQL: CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:301)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1251)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1234)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:554)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
at liquibase.Liquibase.update(Liquibase.java:212)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434)
at org.grails.plugins.databasemigration.liquibase.GrailsLiquibase.performUpdate(GrailsLiquibase.groovy:80)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
at grails.boot.GrailsApp.run(GrailsApp.groovy:365)
at grails.boot.GrailsApp.run(GrailsApp.groovy:354)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at qotd.Application.main(Application.groovy:8)
Caused by: org.h2.jdbc.JdbcSQLException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.command.ddl.CreateTable.update(CreateTable.java:115)
at org.h2.command.CommandContainer.update(CommandContainer.java:98)
at org.h2.command.Command.executeUpdate(Command.java:258)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:184)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:299)
... 35 more
INFO 5/9/16 4:10 PM: liquibase: week-5A.groovy::1462469938896-1::Marco (generated): Successfully released change log lock
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springLiquibase_dataSource': Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set week-5A.groovy::1462469938896-1::Marco (generated):
Reason: liquibase.exception.DatabaseException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191] [Failed SQL: CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id))]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
at grails.boot.GrailsApp.run(GrailsApp.groovy:365)
at grails.boot.GrailsApp.run(GrailsApp.groovy:354)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at qotd.Application.main(Application.groovy:8)
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set week-5A.groovy::1462469938896-1::Marco (generated):
Reason: liquibase.exception.DatabaseException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191] [Failed SQL: CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id))]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:590)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
at liquibase.Liquibase.update(Liquibase.java:212)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434)
at org.grails.plugins.databasemigration.liquibase.GrailsLiquibase.performUpdate(GrailsLiquibase.groovy:80)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 21 common frames omitted
Caused by: liquibase.exception.DatabaseException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191] [Failed SQL: CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:301)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1251)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1234)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:554)
... 30 common frames omitted
Caused by: org.h2.jdbc.JdbcSQLException: Table "QUOTE" already exists; SQL statement:
CREATE TABLE PUBLIC.quote (id BIGINT AUTO_INCREMENT NOT NULL, version BIGINT NOT NULL, text VARCHAR(255) NOT NULL, CONSTRAINT quotePK PRIMARY KEY (id)) [42101-191]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.command.ddl.CreateTable.update(CreateTable.java:115)
at org.h2.command.CommandContainer.update(CommandContainer.java:98)
at org.h2.command.Command.executeUpdate(Command.java:258)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:184)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:299)
... 35 common frames omitted

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
| Error Failed to start server (Use --stacktrace to see the full trace)

这是我的build.gradle文件:
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "http://localhost:8081/nexus/content/groups/public/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.7.4"
classpath "org.grails.plugins:hibernate4:5.0.2"
classpath "org.grails.plugins:database-migration:2.0.0.RC4"
}
}

version "1.0.0-SNAPSHOT"
group "qotd"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"asset-pipeline"
apply plugin:"base"
apply plugin:"java"
apply plugin:"maven"

ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}

repositories {
mavenLocal()
maven { url "http://localhost:8081/nexus/content/groups/public/" }
}

dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.4"
runtime "org.grails.plugins:asset-pipeline"
runtime "com.h2database:h2"
runtime "org.grails.plugins:database-migration:2.0.0.RC4"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}
uploadArchives{
repositories{
mavenDeployer{
repository(
url: "${nexusUrl}/content/repositories/releases"){
authentication(userName: nexusUsername,
password: nexusPassword)
}
snapshotRepository(
url: "${nexusUrl}/content/repositories/snapshots"){
authentication(userName: nexusUsername,
password: nexusPassword)
}
}
}
}

task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

assets {
minifyJs = true
minifyCss = true
}

sourceSets{
main{
resources{
srcDir 'grails-app/migrations'
}
}
}

这是一个针对类的项目,每周都会逐步增加。本周,我们将更新域对象模型并执行数据库迁移。

这是应用程序文件:
---
hibernate:
cache:
queries: false
use_second_level_cache: true
use_query_cache: false
region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'

dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:

environments:
development:
dataSource:
dbCreate: ""
url: jdbc:h2:./quoteDB;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=TRUE
grails:
plugin:
databasemigration:
updateOnStart: true
updateOnStartFileNames: [changelog.groovy]
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: update
url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

---
---
grails:
profile: web
codegen:
defaultPackage: qotd
spring:
transactionManagement:
proxies: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:

groovy:
template:
check-template-location: false

---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none
endpoints:
jmx:
unique-names: true

我尝试过的事情:
  • gradle clean assemble
  • 重新启动计算机
  • 确保正确设置了我的$ JAVA_HOME变量
  • 删除数据库文件(由教授记录)
  • 尚未使用地址的情况(手动使用pid检查)

  • 谢谢参观!

    最佳答案

    问题是我的变更日志和Week-5a脚本都在做相同的事情,即创建数据库。在changelog内部,有一行代码表示include file: 'week-5A.groovy'。因此,当执行changelog时,它将创建数据库,然后执行-5A周,该周开始做相同的事情,因此引发了异常。

    关于grails - Grails运行应用程序:任务 ':bootRun'的执行失败。错误:无法启动服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37125794/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com