如何在grails run-war上指定端口

时间:2011-08-18 19:44:14

标签: deployment grails

我可以grails test run-war,一切正常,但grails test -Dserver.port=8099 run-war给了我这个错误:

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 个答案:

答案 0 :(得分:0)

要更改加载grails的端口,您可以执行以下操作之一...

1。通过使用以下命令行条目启动grails来更改端口:

grails -Dserver.port=8099 run-app

2. 如果您希望应用程序默认在8099上运行,请在BuildConfig.groovy文件中写下以下行。

grails.server.port.http=8099