how to specify port on grails run-war
I can do grails test run-war
and everything works fine, but grails test -Dserver.port=8099 run-war
gives me this error:
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
')
To change the port on which grails loads you can do one of the following...
1. Change the port by launching grails with the following command line entry:
grails -Dserver.port=8099 run-app
2. If you want the application to run on 8099 by default, write the following line in you BuildConfig.groovy file.
grails.server.port.http=8099
精彩评论