2016-12-27 78 views
1

我想在grails 3.1.11中运行一个项目,但是我有一个错误。Grails 3.x失败bootRun

失败:生成失败,出现异常。

  • 出错: 任务':bootRun'的执行失败。

    进程 '命令“C:\ Program Files文件\的Java \ jdk1.8.0_111 \ BIN \ java.exe的' 非零退出值1

  • 尝试完成: 与运行--stacktrace选项来获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。在 sun.nio.ch.Net.bind绑定在 sun.nio.ch.Net.bind0(本机方法):

造成的:java.net.BindException:地址已在使用(Net.java:433)在 sun.nio.ch.Net.bind(Net.java:425)

这是我的build.gradle

buildscript { 
    ext { 
     grailsVersion = project.grailsVersion 
    } 
    repositories { 
     mavenLocal() 
     maven { url "https://repo.grails.org/grails/core" } 
    } 
    dependencies { 
     classpath "org.grails:grails-gradle-plugin:$grailsVersion" 
     classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.8.2" 
     classpath "org.grails.plugins:hibernate4:5.0.10" 
    } 
} 

version "0.1" 
group "sias" 

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" 

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

repositories { 
    mavenLocal() 
    maven { url "https://repo.grails.org/grails/core" } 
} 

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" 
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2" 
    runtime "com.h2database:h2" 
    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" 
} 

assets { 
    minifyJs = true 
    minifyCss = true 
} 

任何人帮我吗?谢谢。

+1

您需要杀死旧的服务器实例或任何正在端口8080上侦听的服务。杀死活动的java进程并重试。 –

回答

1

我最近在GRAILS 3.x版本中遇到过这样的问题。遵循这些步骤可以解决这个问题。

步骤1

通过stop-app命令CMD停止应用程序或通过 '编辑配置' 窗口由stop-app命令替换run-app命令

步骤2

然后,更改GRAILS默认http'8080'港口到任何海关港口,如'8090'。要更改默认的端口,你应该去

的grails-app [主] - > CONF - > application.yml

application.yml文件只需保持这下该文件的所有代码。

server: 
    port: 8090 

步骤3

然后通过run-app命令,通过“编辑配置”窗口更换stop-app命令来运行你的应用程序或在cmd

这里,需要stop-app命令,因为应用程序缓存与先前命令默认环境。当你改变一些东西时,它在应用中没有任何意义。所以,通过“停止应用程序”命令它会杀死所有先前的进程,擦除缓存。