2011-08-18 48 views
2

我可以做grails test run-war,一切工作正常,但grails test -Dserver.port=8099 run-war給了我這個錯誤:如何指定運行戰爭的Grails端口

Running Grails application.. 
    [delete] Deleting: C:\nsl\target\tomcat-out.txt 
    [delete] Deleting: C:\nsl\target\tomcat-err.txt 
    [java] Java Result: 1 
java.lang.RuntimeException: tomcat exited prematurely with code '1' (error output: 'Aug  18, 2011 12:44:10 PM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8099 
Aug 18, 2011 12:44:10 PM org.apache.catalina.core.StandardService start 
INFO: Starting service Tomcat 
Aug 18, 2011 12:44:10 PM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0-snapshot 
Aug 18, 2011 12:44:10 PM org.apache.catalina.startup.ContextConfig defaultWebConfig 
INFO: No default web.xml 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined 
Aug 18, 2011 12:44:12 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring root WebApplicationContext 
LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed: java.lang.NullPointerException 
at org.apache.catalina.connector.Connector.start(Connector.java:1137) 
at org.apache.catalina.core.StandardService.start(StandardService.java:530) 
at org.apache.catalina.core.StandardServer.start(StandardServer.java:708) 
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:286) 
at org.grails.tomcat.IsolatedTomcat.main(IsolatedTomcat.java:101) 
Error loading Tomcat: service.getName(): "Tomcat"; Protocol handler start failed: java.lang.NullPointerException 
') 
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:183) 
at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158) 
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) 
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) 
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149) 
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
at _GrailsRun_groovy.runWar(_GrailsRun_groovy:125) 
at _GrailsRun_groovy.this$4$runWar(_GrailsRun_groovy) 
at _GrailsRun_groovy$_run_closure3.doCall(_GrailsRun_groovy:73) 
at RunWar$_run_closure1.doCall(RunWar:49) 
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) 
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) 
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) 
at gant.Gant.withBuildListeners(Gant.groovy:427) 
at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
at gant.Gant.dispatch(Gant.groovy:415) 
at gant.Gant.this$2$dispatch(Gant.groovy) 
at gant.Gant.invokeMethod(Gant.groovy) 
at gant.Gant.executeTargets(Gant.groovy:590) 
at gant.Gant.executeTargets(Gant.groovy:589) 
Server failed to start: java.lang.RuntimeException: tomcat exited prematurely with code '1' (error output: 'Aug 18, 2011 12:44:10 PM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8099 
Aug 18, 2011 12:44:10 PM org.apache.catalina.core.StandardService start 
INFO: Starting service Tomcat 
Aug 18, 2011 12:44:10 PM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0-snapshot 
Aug 18, 2011 12:44:10 PM org.apache.catalina.startup.ContextConfig defaultWebConfig 
INFO: No default web.xml 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined 
Aug 18, 2011 12:44:11 PM org.apache.catalina.startup.TaglibUriRule body 
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined 
Aug 18, 2011 12:44:12 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring root WebApplicationContext 
LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed: java.lang.NullPointerException 
at org.apache.catalina.connector.Connector.start(Connector.java:1137) 
at org.apache.catalina.core.StandardService.start(StandardService.java:530) 
at org.apache.catalina.core.StandardServer.start(StandardServer.java:708) 
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:286) 
at org.grails.tomcat.IsolatedTomcat.main(IsolatedTomcat.java:101) 
Error loading Tomcat: service.getName(): "Tomcat"; Protocol handler start failed: java.lang.NullPointerException 
') 
+1

嘗試的Grails -Dserver.port = 8099試運轉戰 –

+0

同樣的錯誤,當我嘗試的Grails -Dserver.port = 8099試運行戰爭 – Mikey

+0

什麼的Grails的版本? –

回答

0

要更改其Grails的負載端口,您可以執行下列操作之一...

更改端口用下面的命令行輸入啓動的Grails:

grails -Dserver.port=8099 run-app 

2.如果您希望默認情況下應用程序在8099上運行,請將以下行寫入BuildConfig.groovy文件中。

grails.server.port.http=8099