2013-11-24 90 views
1

当我尝试从命令行码头启动它的失败:错误无法访问jarfile start.jar。我已经添加到$ path环境变量jetty bun没有发生任何事情的路径。 之前,我想我跑码头上的应用程序,但在的IntelliJ的输出控制台与此相撞:从命令行不能启动码头

"C:\Program Files\Java\jdk1.7.0_25\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:16231,suspend=y,server=n -DSTOP.PORT=0 -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DOPTIONS=jmx -Dfile.encoding=windows-1251 -classpath "start.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\lib\idea_rt.jar" org.eclipse.jetty.start.Main etc/jetty-jmx.xml C:\Users\Grigoriy\AppData\Local\Temp\context4870587588634592162config\jetty-contexts.xml 
[2013-11-25 03:17:23,756] Artifact sandbox:war exploded: Server is not connected. Press 'Deploy' to start deployment. 
Connected to the target VM, address: '127.0.0.1:16231', transport: 'socket' 
2013-11-25 03:17:25.237:WARN:oejx.XmlConfiguration:main: Config error at <Call name="addBean"><Arg>|  <New class="org.eclipse.jetty.monitor.ThreadMonitor"><Set name="scanInterval">2000</Set><Set name="busyThreshold">90</Set><Set name="stackDepth">3</Set><Set name="trailLength">2</Set></New>| </Arg></Call> java.lang.ClassNotFoundException: org.eclipse.jetty.monitor.ThreadMonitor in file:/D:/servers/jetty907/jetty-distribution-9.0.7.v20131107/etc/jetty-monitor.xml 
java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:509) 
    at org.eclipse.jetty.start.Main.start(Main.java:651) 
    at org.eclipse.jetty.start.Main.main(Main.java:99) 
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.monitor.ThreadMonitor 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClass(XmlConfiguration.java:364) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:754) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:721) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:417) 
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354) 
    at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262) 
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1238) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174) 
    ... 7 more 

Usage: java -jar start.jar [options] [properties] [configs] 
     java -jar start.jar --help # for more information 
Disconnected from the target VM, address: '127.0.0.1:16231', transport: 'socket' 
Disconnected from server 

Process finished with exit code -2 

更新。 这是我的码头,deploy.xml`

<Call id="webappprovider" name="addAppProvider"> 
      <Arg> 
      <New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> 
       <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set> 
       <Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set> 
       <Set name="scanInterval">1</Set> 
       <Set name="extractWars">true</Set> 
       <Set name="configurationManager"> 
       <New class="org.eclipse.jetty.deploy.PropertiesConfigurationManager"> 
       </New> 
       </Set> 
      </New> 
      </Arg> 
     </Call>` 

所以,我不明白在什么时间以及为什么ContextProvider更换WebAppProvider。

回答

0

从你的错误消息...

2013-11-25 03:17:25.237:WARN:oejx.XmlConfiguration:main: Config error at 
<Call name="addBean"> 
    <Arg> 
     <New class="org.eclipse.jetty.monitor.ThreadMonitor"> 
      <Set name="scanInterval">2000</Set> 
      <Set name="busyThreshold">90</Set> 
      <Set name="stackDepth">3</Set> 
      <Set name="trailLength">2</Set> 
     </New> 
    </Arg> 
</Call> 

java.lang.ClassNotFoundException: org.eclipse.jetty.monitor.ThreadMonitor 
    in file:/D:/servers/jetty907/jetty-distribution-9.0.7.v20131107/etc/jetty-monitor.xml 

我们可以快速查看您正在运行的码头分布9.0.7.v20131107,而且可能没有在类路径中jetty-monitor罐子。

(注:这些指令用于码头9.1不同,较新的)

要测试服务器类路径,运行此命令行。

D:\servers\jetty907\jetty-distribution-9.0.7.v20131107> java -jar start.jar --version 
Active Options: [Server, annotations, client, ext, jaas, jmx, jndi, jndi.demo, jsp, plus, resources, rewrite, websocket] 
Version Information on 37 entries in the classpath. 
Note: order presented here is how they would appear on the classpath. 
     changes to the OPTIONS=[option,option,...] command line option will be reflected here. 
0:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-xml-9.0.7.v20131107.jar 
1: 3.0.0.v201112011016 | ${jetty.home}/lib/servlet-api-3.0.jar 
2:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-http-9.0.7.v20131107.jar 
3:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-continuation-9.0.7.v20131107.jar 
4:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-server-9.0.7.v20131107.jar 
5:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-security-9.0.7.v20131107.jar 
6:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-servlet-9.0.7.v20131107.jar 
7:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-webapp-9.0.7.v20131107.jar 
8:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-deploy-9.0.7.v20131107.jar 
9:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-annotations-9.0.7.v20131107.jar 
10: 1.1.0.v201108011116 | ${jetty.home}/lib/annotations/javax.annotation-1.1.0.v201108011116.jar 
11: 3.1.0.v200803061910 | ${jetty.home}/lib/annotations/org.objectweb.asm-3.1.0.v200803061910.jar 
12:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-client-9.0.7.v20131107.jar 
13:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-jaas-9.0.7.v20131107.jar 
14:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-jmx-9.0.7.v20131107.jar 
15:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-jndi-9.0.7.v20131107.jar 
16:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-plus-9.0.7.v20131107.jar 
17: 1.1.0.v201105071233 | ${jetty.home}/lib/jndi/javax.activation-1.1.0.v201105071233.jar 
18: 1.4.1.v201005082020 | ${jetty.home}/lib/jndi/javax.mail.glassfish-1.4.1.v201005082020.jar 
19:    1.1.1 | ${jetty.home}/lib/jndi/javax.transaction-1.1.1.v201105210645.jar 
20:  9.0.7.v20131107 | ${jetty.home}/lib/jndi.demo/test-mock-resources-9.0.7.v20131107.jar 
21: 2.2.0.v201303151357 | ${jetty.home}/lib/jsp/com.sun.el-2.2.0.v201303151357.jar 
22: 2.2.0.v201303151357 | ${jetty.home}/lib/jsp/javax.el-2.2.0.v201303151357.jar 
23: 1.2.0.v201105211821 | ${jetty.home}/lib/jsp/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar 
24: 2.2.0.v201112011158 | ${jetty.home}/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar 
25: 2.2.2.v201112011158 | ${jetty.home}/lib/jsp/org.apache.jasper.glassfish-2.2.2.v201112011158.jar 
26: 1.2.0.v201112081803 | ${jetty.home}/lib/jsp/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar 
27: 3.8.2.v20130121-145325 | ${jetty.home}/lib/jsp/org.eclipse.jdt.core-3.8.2.v20130121.jar 
28:    (dir) | ${jetty.home}/resources 
29:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-rewrite-9.0.7.v20131107.jar 
30:  9.0.7.v20131107 | ${jetty.home}/lib/websocket/websocket-api-9.0.7.v20131107.jar 
31:  9.0.7.v20131107 | ${jetty.home}/lib/websocket/websocket-client-9.0.7.v20131107.jar 
32:  9.0.7.v20131107 | ${jetty.home}/lib/websocket/websocket-common-9.0.7.v20131107.jar 
33:  9.0.7.v20131107 | ${jetty.home}/lib/websocket/websocket-server-9.0.7.v20131107.jar 
34:  9.0.7.v20131107 | ${jetty.home}/lib/websocket/websocket-servlet-9.0.7.v20131107.jar 
35:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-util-9.0.7.v20131107.jar 
36:  9.0.7.v20131107 | ${jetty.home}/lib/jetty-io-9.0.7.v20131107.jar 

的两件事情来寻找:

  1. “工作选项”行应该有“监督”上市
  2. 在classpath jar的列表中应提及“码头显示器”的地方。

在上面的例子中,你可以看到这些都不存在。

所以我们将它们添加到启动。 (请确保以下两行出现在你的start.ini

OPTIONS=monitor 
etc/jetty-monitor.xml 

然后重新运行你的类路径java -jar start.jar --version的测试,看看你现在有${jetty.home}/lib/monitor/jetty-monitor-9.0.7.v20131107.jar

+0

我决定排除从码头码头监视器intellij中的配置。现在,当我启动我的应用程序时,它会在类ContextProvider的jetty-contexts.xml中抛出ClassNotFoundException异常。当我尝试在具有相同服务器的另一台计算机上启动我的应用程序时,它成功完成并在码头环境中完成。XML我发现WebAppProvider而不是ContextProvider。 –

+0

当我尝试在命令行中验证码头版本时,我看到“D:\ servers \ jetty907 \ jetty-distribution-9.0.7.v20131107未被识别为内部或外部命令,可操作程序或批处理文件” –

+0

'java -jar start.jar --version'命令必须从'cmd'(命令行)运行,并且你必须首先转换到你的分发目录才能工作。 –

0

的类路径条目,我不知道我们是否有错误的原因完全一样,但是我会留下这个以防止任何人遇到同样的问题。对我来说,解决方案是指定端口号。

java -Djetty.port=8081 -jar start.jar etc/jetty.xml

更好的解决方案是在这里,它可能是一个进程已占用的端口。 Jetty Startup Fails - Address in Use

像在其他答案中建议的一样添加监视器导致出现classNotFoundException。

这是一个很大的无赖,因为我曾经跑了关于码头的第一个命令给了我这样的错误,我不得不花了良好的半小时图了这一点:)