| Summary: | Cannot set the Jetty Port outside of Jetty.xml ( at all ) | ||
|---|---|---|---|
| Product: | [RT] Jetty | Reporter: | Quintin <qpaulson> |
| Component: | server | Assignee: | Greg Wilkins <gregw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | as.maps, gregw, jetty-inbox, joakim.erdfelt, mgorovoy, qpaulson, rocketraman, theo.c |
| Version: | unspecified | ||
| Target Milestone: | 7.1.x | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Quintin
I am seeing this in OSX but I presume this is happening on all platforms. This is also happening with 7.1.5. I just downloaded 7.1.5 to see if it has the same issue. Steps to re-produce: 1. Unarchive 7.1.5 2. edit start.ini 2.1 uncomment --exec 2.2 add -Djetty.port=9000 in start.ini 3. run jetty with java -jar start.jar from the jetty home directory. I also tried just running jetty with: java -Djetty.port=9000 -jar start.jar Both ways result in jetty starting on port 8080 ( the default port ) Jetty 7 has different startup options then compared to Jetty 6. You can learn about available options by executing the command 'java -jar start.jar --help' In Jetty 7, in order to start the server on a different port, you should use command 'java -jar start.jar jetty.port=9000'. However, I've confirmed that it does not work using release 7.1.6.v20100715. It is definitely not platform dependent as I've tested it on Ubuntu 10.04 workstation. Until this issue is fixed, you could modify jetty.xml configuration file to use SystemProperty instead of Property in the definition of the connector, and then use the command 'java -Djetty.port=9000 -jar start.jar' to start the server on the specified port. Regards, Michael Another work around is to revert the <Property ...> element in jetty.xml to a <SystemProperty ...> element. I'll investigate why the properties are not working. The handling of properties is still a bit confused since the refactor, as evidence by the dual handling of jetty.home in the start.config and in Main itself. Currently the properties set on the command line are not communicated to the XmlConfiguration execution. However, if a file ending with .properties is listed on the command line, it will be used as a property file and can affect the properties used by XmlConfiguration. I will try to clean up the current duopoly of jetty.home handling and then look to pass in the start.jar properties to XmlConfiguration with a temporary property file. Joakime, can you remind me why we switched all the config files from SystemProperties to Properties? There is no easy way to pass the start properties to the XmlConfiguration properties. Using SystemProperties is much simpler. Looking at the Properties stuff in start.jar and I've got myself really confused. I understand that we switched to using Properties in the context xml files, because they get their properties from the deployer, but I can't see why the start mechanism has switched to Properties from SystemProperties. (In reply to comment #3) > Jetty 7 has different startup options then compared to Jetty 6. You can learn > about available options by executing the command 'java -jar start.jar --help' > > In Jetty 7, in order to start the server on a different port, you should use > command 'java -jar start.jar jetty.port=9000'. However, I've confirmed that it > does not work using release 7.1.6.v20100715. It is definitely not platform > dependent as I've tested it on Ubuntu 10.04 workstation. > > Until this issue is fixed, you could modify jetty.xml configuration file to use > SystemProperty instead of Property in the definition of the connector, and then > use the command 'java -Djetty.port=9000 -jar start.jar' to start the server on > the specified port. > > Regards, > Michael Thank you Michael, the SystemProperty definition works great.. It is now setting the port appropriately. Alright. This is what we should do. a) Leave the jetty.xml alone, and use <Property> b) Fix jetty-start to take the entire System.getProperties() and set them as Properties within jetty-xml The rationale is that jetty.xml is used in many places, even embedded, and in many of those cases <SystemProperty> is inadequate or just plain wrong of choice when multiple servers are started within the same JVM. Note: I'm not proposing eliminating <SystemProperty> from jetty-xml, as it has a useful purpose for many individuals. We would instead strive to make the various jetty-distribution maintained etc/*.xml files not use <SystemProperty> while allowing users and implementors the option of using <SystemProperty> themselves. Hope that made sense. Joakim, part b is the problem. There is currently no way of communicating any properties from start to jetty-xml, because start cannot depend on jetty-xml. The only way I can see of doing this is to generate a temporary properties file and add it to the args passed to XmlConfiguration, and let it read those properties ( I think properties files are already supported ). I'd still like to find a way to do that property pass in memory rather than by a file (as that may get confused with other args), but it should at least work for a start. Good idea to copy all system properties to properties. *** Bug 322520 has been marked as a duplicate of this bug. *** I am thinking that we could make the _properties in Config in jetty-start into a static var and then in the static constructor call System.getProperties() and set them into the _properties hash map.. that would handle the short term goal of addressing the SystemProperty vs Property issue in our configuration xmls thoughts? I have resolved this by making the XmlConfiguration main method use reflection to look for the existence of org.eclipse.jetty.start.Config. If it exists, the it calls getProperties to initialize the property map used. This allows the start properties to be used by XmlConfiguration, but only if used as a main. setting jetty.port now works fine. Still present in 7.2.1. I just tried 7.2.1 and it worked fine: gregw@Brick: /tmp/jetty-distribution-7.2.1.v20101111 [507] java -jar start.jar jetty.port=8765 2010-11-24 11:03:19.321:INFO::jetty-7.2.1.v20101111 2010-11-24 11:03:19.333:INFO::Deployment monitor /tmp/jetty-distribution-7.2.1.v20101111/webapps at interval 1 2010-11-24 11:03:19.335:INFO::Deployment monitor /tmp/jetty-distribution-7.2.1.v20101111/contexts at interval 1 2010-11-24 11:03:19.336:INFO::Deployable added: /tmp/jetty-distribution-7.2.1.v20101111/contexts/test.xml 2010-11-24 11:03:19.378:INFO::Extract jar:file:/tmp/jetty-distribution-7.2.1.v20101111/webapps/test.war!/ to /tmp/jetty-0.0.0.0-8765-test.war-_-any-/webapp 2010-11-24 11:03:19.803:INFO:org.eclipse.jetty.servlets.TransparentProxy:TransparentProxy @ /javadoc to http://download.eclipse.org/jetty/stable-7/apidocs 2010-11-24 11:03:19.804:INFO::Deployable added: /tmp/jetty-distribution-7.2.1.v20101111/contexts/javadoc.xml 2010-11-24 11:03:19.830:INFO::Started SelectChannelConnector@0.0.0.0:8765 Verified. I was presuming setting Jetty's Port would work like java -Djetty.port=8765 -jar start.jar as shown in the docs. (In reply to comment #15) > I just tried 7.2.1 and it worked fine: > > gregw@Brick: /tmp/jetty-distribution-7.2.1.v20101111 > [507] java -jar start.jar jetty.port=8765 (In reply to comment #16) > Verified. I was presuming setting Jetty's Port would work like > > java -Djetty.port=8765 -jar start.jar > > as shown in the docs. > > (In reply to comment #15) > > I just tried 7.2.1 and it worked fine: > > > > gregw@Brick: /tmp/jetty-distribution-7.2.1.v20101111 > > [507] java -jar start.jar jetty.port=8765 Still doesn't work when using the --exec or --dry-run options. I just tried the staged 7.2.2 and I got: gregw@Brick: ~/Desktop/jetty-distribution-7.2.2.v20101203 [512] java -jar start.jar jetty.port=8765 --exec 2010-12-05 11:54:41.843:INFO::jetty-7.2.2.v20101203 2010-12-05 11:54:41.855:INFO::Deployment monitor /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/webapps at interval 1 2010-12-05 11:54:41.863:INFO::Deployment monitor /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts at interval 1 2010-12-05 11:54:41.864:INFO::Deployable added: /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts/test.xml 2010-12-05 11:54:41.903:INFO::Extract jar:file:/home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/webapps/test.war!/ to /tmp/jetty-0.0.0.0-8765-test.war-_-any-/webapp 2010-12-05 11:54:42.350:INFO:org.eclipse.jetty.servlets.TransparentProxy:TransparentProxy @ /javadoc to http://download.eclipse.org/jetty/stable-7/apidocs 2010-12-05 11:54:42.351:INFO::Deployable added: /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts/javadoc.xml 2010-12-05 11:54:42.375:INFO::Started SelectChannelConnector@0.0.0.0:8765 gregw@Brick: ~/Desktop/jetty-distribution-7.2.2.v20101203 [515] eval $(java -jar start.jar jetty.port=8765 --dry-run) 2010-12-05 11:55:38.339:INFO::jetty-7.2.2.v20101203 2010-12-05 11:55:38.352:INFO::Deployment monitor /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/webapps at interval 1 2010-12-05 11:55:38.355:INFO::Deployment monitor /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts at interval 1 2010-12-05 11:55:38.355:INFO::Deployable added: /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts/test.xml 2010-12-05 11:55:38.394:INFO::Extract jar:file:/home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/webapps/test.war!/ to /tmp/jetty-0.0.0.0-8765-test.war-_-any-/webapp 2010-12-05 11:55:38.848:INFO:org.eclipse.jetty.servlets.TransparentProxy:TransparentProxy @ /javadoc to http://download.eclipse.org/jetty/stable-7/apidocs 2010-12-05 11:55:38.849:INFO::Deployable added: /home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/contexts/javadoc.xml 2010-12-05 11:55:38.874:INFO::Started SelectChannelConnector@0.0.0.0:8765 ^C2010-12-05 11:55:42.148:INFO::Graceful shutdown SelectChannelConnector@0.0.0.0:8765 2010-12-05 11:55:42.152:INFO::Graceful shutdown o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8765-test.war-_-any-/webapp/},/home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/webapps/test.war 2010-12-05 11:55:42.153:INFO::Graceful shutdown o.e.j.s.h.ContextHandler{/javadoc,file:/home/gregw/Desktop/jetty-distribution-7.2.2.v20101203/javadoc} so looks to be working fine??? (In reply to comment #18) > I just tried the staged 7.2.2 and I got: > [...] Looks like it might be fixed in 7.2.2. Here is what I get with 7.2.1 on Windows: C:\tmp\jetty-distribution-7.2.1.v20101111>java -jar start.jar jetty.port=8081 --exec 2010-12-05 10:51:21.364:INFO::jetty-7.2.1.v20101111 2010-12-05 10:51:21.489:INFO::Deployment monitor C:\tmp\jetty-distribution-7.2.1.v20101111\webapps at interval 1 2010-12-05 10:51:21.489:INFO::Deployment monitor C:\tmp\jetty-distribution-7.2.1.v20101111\contexts at interval 1 2010-12-05 10:51:21.489:INFO::Deployable added: C:\tmp\jetty-distribution-7.2.1.v20101111\contexts\test.xml 2010-12-05 10:51:21.630:INFO::Extract jar:file:/C:/tmp/jetty-distribution-7.2.1.v20101111/webapps/test.war!/ to C:\Documents and Settings\Raman Gupta\Local Settings\Temp\jetty-0.0.0.0-8080-test.war-_- any-\webapp 2010-12-05 10:51:23.083:INFO:org.eclipse.jetty.servlets.TransparentProxy:TransparentProxy @ /javadoc to http://download.eclipse.org/jetty/stable-7/apidocs 2010-12-05 10:51:23.083:INFO::Deployable added: C:\tmp\jetty-distribution-7.2.1.v20101111\contexts\javadoc.xml 2010-12-05 10:51:23.192:INFO::Started SelectChannelConnector@0.0.0.0:8080 and on Linux: $ java -jar start.jar jetty.port=8081 --exec 2<&1 | grep Connector 2010-12-05 11:07:24.478:INFO::Started SelectChannelConnector@0.0.0.0:8080 Where can I download 7.2.2 to try it? (In reply to comment #19) > Looks like it might be fixed in 7.2.2. Here is what I get with 7.2.1 on > Windows: Found 7.2.2 at sonatype.org and confirmed it is now working. |