jetty 9和intellij不会启动。

时间:2021-09-07 20:56:04

I'm playing around with intellij for a new project and am having a bit of a problem. When I try to run jetty 9 from intellij 12, I get this error

我正在为一个新项目玩弄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

This is with the base system. I have deleted the profile, recreated it, I've downloaded another copy of jetty, I've done everything I can think of. The curious thing is the only thing in the start.d folder is the default test ini file that came with the distribution. I opened the xml file that ini file references and there is nothing wrong with it. I'm completely stumped. Does anyone know what could be going on here?

这是基本系统。我删除了文件,重新创建了它,我下载了另一份jetty,我已经做了我能想到的所有事情。奇怪的是,一开始只有一件事。d文件夹是随发行版而来的默认测试ini文件。我打开了ini文件引用的xml文件,并没有什么问题。我完全一头雾水。有人知道这是怎么回事吗?

Update, jetty runs just fine from the command line, but not from Intellij

更新,jetty从命令行运行良好,但不是来自Intellij。

Update 2, It seems that the way IntelliJ does its deployments is thru the plugin, it creates a new jetty-contexts.xml file. That file seems to be what is not liked by jetty. here is the file

更新2,似乎IntelliJ的部署方式是通过插件,它创建了一个新的jetty上下文。xml文件。这个文件似乎是jetty不喜欢的。这是文件

<?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>

and a new dump, now that i've deleted the test wars and removed the start.d from the config.

还有一个新的转储,现在我已经删除了测试战争并删除了开始。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 个解决方案

#1


0  

The use of org.eclipse.jetty.start.Main is meant for use from a full and complete jetty distribution.

org.eclipse.jetty.start的使用。Main是用来从一个完整和完整的jetty分布中使用的。

It is just a bootstrap to establish the correct classpath and configuration xmls that will eventually start Jetty.

它只是一个引导程序,以确定最终将启动Jetty的正确的类路径和配置xmls。

Your command line could (I have not tested this) look like this instead ...

您的命令行(我没有测试过)看起来是这样的…

"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

Note that you will likely need the following ...

注意,您可能需要下列…

  • To define jetty.home property so that jetty knows where to look for its files
  • 定义jetty。所以jetty知道在哪里查找文件。
  • To have the extra IntelliJ jars defined via the -Dpath=${classpath} configurable that jetty will pass through into the running server
  • 通过-Dpath=${classpath}来定义额外的IntelliJ jar, jetty将通过它进入运行的服务器。
  • To have the IntelliJ properties defined in the ${jetty.home}/start.ini
  • 在${jetty.home}/start.ini中定义了IntelliJ属性。
  • To have the OPTIONS command line defined in the ${jetty.home/start.ini
  • 在${jetty.home/start.ini中定义选项命令行。
  • To have the various jmx properties defined in the ${jetty.home}/start.ini
  • 在${jetty.home}/start.ini中定义各种jmx属性。
  • Put your custom jetty-context.xml into the ${jetty.home}/webapps/ directory, or change the deployment directory (in the etc/jetty-deploy.xml) to where your jetty-context.xml file is located. Be sure that the reference to the war file make sense.
  • 把你的自定义jetty-context。xml到$ { jetty。home}/webapps/目录,或者将部署目录(etc/jetty-deploy.xml)更改为jetty-context。xml文件的位置。请确保对war文件的引用是有意义的。

Finally, know that you can ask jetty what the server classpath will look like easily enough with the command line option --version which will list the classpath the server will use (in the order that the server will use it) based on what you have configured for the start bootstrap process.

最后,知道你可以问jetty服务器类路径将是什么样子足够容易使用命令行选项-版本将列表服务器将所使用的类路径中,服务器将使用的顺序(它)基于你所配置的启动引导过程。

#1


0  

The use of org.eclipse.jetty.start.Main is meant for use from a full and complete jetty distribution.

org.eclipse.jetty.start的使用。Main是用来从一个完整和完整的jetty分布中使用的。

It is just a bootstrap to establish the correct classpath and configuration xmls that will eventually start Jetty.

它只是一个引导程序,以确定最终将启动Jetty的正确的类路径和配置xmls。

Your command line could (I have not tested this) look like this instead ...

您的命令行(我没有测试过)看起来是这样的…

"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

Note that you will likely need the following ...

注意,您可能需要下列…

  • To define jetty.home property so that jetty knows where to look for its files
  • 定义jetty。所以jetty知道在哪里查找文件。
  • To have the extra IntelliJ jars defined via the -Dpath=${classpath} configurable that jetty will pass through into the running server
  • 通过-Dpath=${classpath}来定义额外的IntelliJ jar, jetty将通过它进入运行的服务器。
  • To have the IntelliJ properties defined in the ${jetty.home}/start.ini
  • 在${jetty.home}/start.ini中定义了IntelliJ属性。
  • To have the OPTIONS command line defined in the ${jetty.home/start.ini
  • 在${jetty.home/start.ini中定义选项命令行。
  • To have the various jmx properties defined in the ${jetty.home}/start.ini
  • 在${jetty.home}/start.ini中定义各种jmx属性。
  • Put your custom jetty-context.xml into the ${jetty.home}/webapps/ directory, or change the deployment directory (in the etc/jetty-deploy.xml) to where your jetty-context.xml file is located. Be sure that the reference to the war file make sense.
  • 把你的自定义jetty-context。xml到$ { jetty。home}/webapps/目录,或者将部署目录(etc/jetty-deploy.xml)更改为jetty-context。xml文件的位置。请确保对war文件的引用是有意义的。

Finally, know that you can ask jetty what the server classpath will look like easily enough with the command line option --version which will list the classpath the server will use (in the order that the server will use it) based on what you have configured for the start bootstrap process.

最后,知道你可以问jetty服务器类路径将是什么样子足够容易使用命令行选项-版本将列表服务器将所使用的类路径中,服务器将使用的顺序(它)基于你所配置的启动引导过程。