jetty 9和intellij将无法启动

时间:2013-02-17 07:00:37

标签: intellij-idea jetty

我正在玩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文件,它没有任何问题。我完全难过了。有谁知道这里会发生什么?

更新, jetty从命令行运行得很好,但不是来自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

1 个答案:

答案 0 :(得分:0)

使用org.eclipse.jetty.start.Main意味着可以使用完整且完整的码头分发。

它只是一个建立正确的类路径和配置xmls的引导程序,最终将启动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属性,以便jetty知道在哪里查找其文件
  • 通过-Dpath=${classpath}可配置的jetty定义额外的IntelliJ jar将传递到正在运行的服务器
  • 要在${jetty.home}/start.ini
  • 中定义IntelliJ属性
  • 要在OPTIONS
  • 中定义${jetty.home/start.ini命令行
  • 要在${jetty.home}/start.ini
  • 中定义各种jmx属性
  • 将自定义jetty-context.xml放入${jetty.home}/webapps/目录,或将部署目录(在etc/jetty-deploy.xml中)更改为jetty-context.xml文件所在的位置。确保对war文件的引用有意义。

最后,要知道你可以使用命令行选项--version轻松地询问jetty服务器类路径是什么样的,它将列出服务器将使用的类路径(按照服务器将使用它的顺序)基于您为启动引导过程配置的内容。