4

我正在与 intellij 一起玩一个新项目,但遇到了一些问题。当我尝试从 intellij 12 运行 jetty 9 时,出现此错误

"C:\Program Files\Java\jdk1.7.0_13\bin\java" -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 -Didea.launcher.port=7553 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\bin" -Dfile.encoding=windows-1252 -classpath "start.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.eclipse.jetty.start.Main etc/jetty-jmx.xml C:\Users\willie\AppData\Local\Temp\context9038140457899104277config\jetty-contexts.xml
[2013-02-17 01:49:18,784] Artifact Armor:war exploded: Server is not connected. Press 'Deploy' to start deployment.
2013-02-17 01:49:20.055:WARN:oejx.XmlParser:main: FATAL@file:/C:/Code/jetty-9.0.0.RC0/start.d/ line:1 col:1 : org.xml.sax.SAXParseException; systemId: file:/C:/Code/jetty-9.0.0.RC0/start.d/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
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:601)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:453)
    at org.eclipse.jetty.start.Main.start(Main.java:595)
    at org.eclipse.jetty.start.Main.main(Main.java:96)
    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:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.xml.sax.SAXParseException; systemId: file:/C:/Code/jetty-9.0.0.RC0/start.d/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1388)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:998)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:302)
    at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:204)
    at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:220)
    at org.eclipse.jetty.xml.XmlConfiguration.<init>(XmlConfiguration.java:138)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1209)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1160)
    ... 12 more

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information

Process finished with exit code -2
Disconnected from server

这是基本系统。我已经删除了配置文件,重新创建了它,我已经下载了另一个码头副本,我已经做了我能想到的一切。奇怪的是 start.d 文件夹中唯一的东西是发行版附带的默认测试 ini 文件。我打开了ini文件引用的xml文件,没有任何问题。我完全被难住了。有谁知道这里会发生什么?

更新,码头从命令行运行得很好,但不是从 Intellij

更新 2,似乎 IntelliJ 进行部署的方式是通过插件,它创建了一个新的 jetty-contexts.xml 文件。该文件似乎是码头不喜欢的。这是文件

<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.server.Server" id="Server">
    <Ref id="DeploymentManager">
        <Call name="addAppProvider">
            <Arg>
                <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
                    <Set name="monitoredDir">C:\Users\willie\AppData\Local\Temp\context7950837742823871110deploy</Set>
                    <Set name="scanInterval">1</Set>
                </New>
            </Arg>
        </Call>
    </Ref>
</Configure>

和一个新的转储,现在我已经删除了测试战争并从配置中删除了 start.d。

"C:\Program Files\Java\jdk1.7.0_13\bin\java" -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 -Didea.launcher.port=7538 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\bin" -Dfile.encoding=windows-1252 -classpath "start.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.eclipse.jetty.start.Main etc/jetty-jmx.xml C:\Users\willie\AppData\Local\Temp\context826007528789372946config\jetty-contexts.xml
[2013-02-17 05:38:31,987] Artifact Armor:war exploded: Server is not connected. Press 'Deploy' to start deployment.
2013-02-17 05:38:33.509:WARN:oejx.XmlConfiguration:main: Config error at <Call name="addAppProvider"><Arg>|????<New class="org.eclipse.jetty.deploy.providers.ContextProvider"><Set name="monitoredDir">C:\Users\willie\AppData\Local\Temp\context7950837742823871110deploy</Set><Set name="scanInterval">1</Set></New>|???</Arg></Call> java.lang.ClassNotFoundException: org.eclipse.jetty.deploy.providers.ContextProvider in file:/C:/Users/willie/AppData/Local/Temp/context826007528789372946config/jetty-contexts.xml
2013-02-17 05:38:33.510:WARN:oejx.XmlConfiguration:main: Config error at <Ref id="DeploymentManager"><Call name="addAppProvider"><Arg>|????<New class="org.eclipse.jetty.deploy.providers.ContextProvider"><Set name="monitoredDir">C:\Users\willie\AppData\Local\Temp\context7950837742823871110deploy</Set><Set name="scanInterval">1</Set></New>|???</Arg></Call></Ref> java.lang.ClassNotFoundException: org.eclipse.jetty.deploy.providers.ContextProvider in file:/C:/Users/willie/AppData/Local/Temp/context826007528789372946config/jetty-contexts.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:601)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:453)
    at org.eclipse.jetty.start.Main.start(Main.java:595)
    at org.eclipse.jetty.start.Main.main(Main.java:96)
    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:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.deploy.providers.ContextProvider
    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:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClass(XmlConfiguration.java:354)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:743)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1111)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1016)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:710)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:407)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.refObj(XmlConfiguration.java:819)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:419)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:344)
    at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1221)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1160)
    ... 12 more

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information
4

1 回答 1

0

的使用org.eclipse.jetty.start.Main意味着从完整的码头分布中使用。

它只是建立正确的类路径和配置 xml 的引导程序,最终将启动 Jetty。

你的命令行可能(我没有测试过)看起来像这样......

"C:\Program Files\Java\jdk1.7.0_13\bin\java" 
  -Djetty.home=C:\path\to\jetty\distribution
  -DSTOP.PORT=0 
  -Didea.launcher.port=7553 
  "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\bin"
  -Dfile.encoding=windows-1252
  -jar start.jar
  "-Dpath=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.4\lib\idea_rt.jar"
  org.eclipse.jetty.start.Main

请注意,您可能需要以下...

  • 定义jetty.home属性,以便码头知道在哪里寻找它的文件
  • 通过可-Dpath=${classpath}配置的方式定义额外的 IntelliJ jar,jetty 将传递到正在运行的服务器中
  • 要在中定义 IntelliJ 属性${jetty.home}/start.ini
  • OPTIONS${jetty.home/start.ini
  • 要在${jetty.home}/start.ini
  • 将您的自定义jetty-context.xml放入${jetty.home}/webapps/目录中,或将部署目录(在 中etc/jetty-deploy.xml)更改为您的 jetty-context.xml 文件所在的位置。确保对战争文件的引用有意义。

最后,知道您可以使用命令行选项轻松地询问码头服务器类路径的外观,该选项--version将根据您配置的内容列出服务器将使用的类路径(按照服务器使用它的顺序)启动引导过程。

于 2013-02-17T13:44:28.387 回答