让我们看看发生了什么...
一、我的环境
C:\>ver
Microsoft Windows [Version 6.1.7601]
C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 7 Home Premium
OS Version: 6.1.7601 Service Pack 1 Build 7601
C:\jetty-6.1.21>java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)
C:\jetty-6.1.21>dir
Volume in drive C has no label.
Volume Serial Number is C8CF-820B
Directory of C:\jetty-6.1.21
04/19/2013 11:51 AM <DIR> .
04/19/2013 11:51 AM <DIR> ..
04/19/2013 11:51 AM <DIR> bin
04/19/2013 11:50 AM <DIR> contexts
04/19/2013 11:51 AM <DIR> contrib
04/19/2013 11:50 AM <DIR> distribution
04/19/2013 11:51 AM <DIR> etc
04/19/2013 11:51 AM <DIR> examples
04/19/2013 11:50 AM <DIR> extras
04/19/2013 11:51 AM <DIR> javadoc
04/19/2013 11:51 AM <DIR> jxr
04/19/2013 11:51 AM <DIR> lib
04/19/2013 11:51 AM <DIR> LICENSES
09/21/2009 11:07 PM <DIR> logs
04/19/2013 11:51 AM <DIR> modules
09/21/2009 11:07 PM 1,621 NOTICE.txt
04/19/2013 11:51 AM <DIR> patches
09/22/2009 12:17 AM 9,170 pom.xml
04/19/2013 11:51 AM <DIR> project-website
09/21/2009 11:07 PM 4,253 README.txt
04/19/2013 11:51 AM <DIR> resources
09/22/2009 04:44 PM 17,239 start.jar
09/21/2009 11:07 PM 161,333 VERSION.txt
04/19/2013 11:50 AM <DIR> webapps
5 File(s) 193,616 bytes
19 Dir(s) 315,649,884,160 bytes free
接下来,让我们正常尝试一下...
C:\jetty-6.1.21>java -jar start.jar
2013-04-19 11:54:10.334::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2013-04-19 11:54:11.019::INFO: jetty-6.1.21
2013-04-19 11:54:11.133::INFO: Deploy C:\jetty-6.1.21\contexts\test.xml -> org.
mortbay.jetty.webapp.WebAppContext@19616c7{/,C:\jetty-6.1.21/webapps/test}
2013-04-19 11:54:11.171::INFO: Deploy C:\jetty-6.1.21\contexts\javadoc.xml -> o
rg.mortbay.jetty.handler.ContextHandler@3bb2b8{/javadoc,file:/C:/jetty-6.1.21/ja
vadoc/}
2013-04-19 11:54:11.287::INFO: Deploy C:\jetty-6.1.21\contexts\test-jndi.xml ->
org.mortbay.jetty.webapp.WebAppContext@1df38fd{/test-jndi,C:\jetty-6.1.21/conte
xts/test-jndi.d}
它按预期工作。
让我们来介绍一下皱纹的存在C:\start.jar
C:\>dir *.jar
Volume in drive C has no label.
Volume Serial Number is C8CF-820B
Directory of C:\
04/19/2013 12:15 PM 1 start.jar
1 File(s) 1 bytes
0 Dir(s) 315,647,086,592 bytes free
C:\jetty-6.1.21>java -jar start.jar
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at org.mortbay.start.Main.init(Main.java:465)
at org.mortbay.start.Main.start(Main.java:439)
at org.mortbay.start.Main.main(Main.java:119)
是的,这不是正确的行为。让我们看看码头是怎么想的……
C:\jetty-6.1.21>java -DDEBUG -jar start.jar
config=org/mortbay/start/start.config
T $(jetty.class.path).path always
F $(jetty.lib)/** exists $(jetty.lib)
F jetty.home=. ! exists $(jetty.home)/start.jar
F jetty.home=.. ! exists $(jetty.home)/start.jar
F jetty.home=/home/jetty ! exists $(jetty.home)/start.jar
F jetty.home=/C:/jetty ! exists $(jetty.home)/start.jar
F jetty.home=. ! exists $(jetty.home)/start.jar
T org.mortbay.xml.XmlConfiguration.class
CLASS=org.mortbay.xml.XmlConfiguration
T $(start.class).class
T $(jetty.home)/etc/jetty.xml nargs == 0
ARGS+=\etc\jetty.xml
T $(jetty.home)/lib/* always
T $(jetty.home)/lib/jsp-2.1/* java >= 1.5
T $(jetty.home)/lib/jsp-2.0/* ! available org.apache.jasper.servlet.JspServlet
T $(jetty.home)/lib/management/*
F $(jetty.home)/lib/management/mx4j/* java < 1.5
T $(jetty.home)/lib/naming/*
T $(jetty.home)/lib/plus/*
T $(jetty.home)/lib/xbean/*
T $(jetty.home)/lib/wadi/*
T $(jetty.home)/lib/grizzly/*
T $(jetty.home)/lib/annotations/* java >= 1.5
T $(jetty.home)/lib/jre1.5/** java >= 1.5
T $(jetty.home)/lib/ext/** always
T /usr/share/java/ant.jar ! available org.apache.tools.ant.Main
T $(jetty.home)/resources/
!C:\resources
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at org.mortbay.start.Main.init(Main.java:465)
at org.mortbay.start.Main.start(Main.java:439)
at org.mortbay.start.Main.main(Main.java:119)
是的,每个$(jetty.home)
回报测试F
(假)
您似乎在org.mortbay.start.Main
(不是start.config
)中发现了一个错误。
不幸的是,这个 Jetty 6 错误不会被修复,因为 Jetty 6 已经在几年前结束了生命。
让我们看看这个错误是否存在于 Jetty 7、8 或 9 中?
C:\jetty-distribution-7.6.10.v20130312>java -jar start.jar
2013-04-19 12:21:33.910:INFO:oejs.Server:jetty-7.6.10.v20130312
2013-04-19 12:21:33.947:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\jet
ty-distribution-7.6.10.v20130312\webapps at interval 1
2013-04-19 12:21:33.956:INFO:oejd.DeploymentManager:Deployable added: C:\jetty-d
istribution-7.6.10.v20130312\webapps\spdy.war
2013-04-19 12:21:34.078:INFO:oejw.WebInfConfiguration:Extract jar:file:/C:/jetty
-distribution-7.6.10.v20130312/webapps/spdy.war!/ to C:\Users\joakim\AppData\Loc
al\Temp\jetty-0.0.0.0-8080-spdy.war-_spdy-any-\webapp
C:\jetty-distribution-8.1.10.v20130312>java -jar start.jar
2013-04-19 12:21:46.946:INFO:oejs.Server:jetty-8.1.10.v20130312
2013-04-19 12:21:46.984:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\jet
ty-distribution-8.1.10.v20130312\webapps at interval 1
2013-04-19 12:21:46.995:INFO:oejd.DeploymentManager:Deployable added: C:\jetty-d
istribution-8.1.10.v20130312\webapps\spdy.war
2013-04-19 12:21:47.115:INFO:oejw.WebInfConfiguration:Extract jar:file:/C:/jetty
-distribution-8.1.10.v20130312/webapps/spdy.war!/ to C:\Users\joakim\AppData\Loc
al\Temp\jetty-0.0.0.0-8080-spdy.war-_spdy-any-\webapp
C:\jetty-distribution-9.0.2.v20130417>java -jar start.jar
2013-04-19 12:22:19.127:WARN::main: test-realm is deployed. DO NOT USE IN PRODUC
TION!
2013-04-19 12:22:19.132:INFO:oejs.Server:main: jetty-9.0.2.v20130417
2013-04-19 12:22:19.214:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\jetty-d
istribution-9.0.2.v20130417\logs\2013_04_19.request.log
2013-04-19 12:22:19.251:INFO:oejdp.ScanningAppProvider:main: Deployment monitor
[file:/C:/jetty-distribution-9.0.2.v20130417/webapps/] at interval 1
2013-04-19 12:22:19.669:INFO:oejsh.ContextHandler:main: started o.e.j.w.WebAppCo
ntext@3e125554{/,file:/C:/jetty-distribution-9.0.2.v20130417/webapps/ROOT/,AVAIL
ABLE}{C:\jetty-distribution-9.0.2.v20130417\webapps\ROOT}
2013-04-19 12:22:19.703:INFO:oejsh.ContextHandler:main: started o.e.j.s.h.Contex
tHandler@7ffa129b{/javadoc,file:/C:/jetty-distribution-9.0.2.v20130417/javadoc,A
VAILABLE}
在 Jetty 7、8 或 9 中不存在。
即使测试 Jetty 7.0.0 里程碑的早期版本也表明,自 Jetty 6.1.26 以来,124 个 Jetty 版本中的任何一个版本中都不存在此错误。
考虑升级。