我使用jetty嵌入gradle项目中的jetty进行服务器配置。 jetty具有XML配置以使用jettyRunWar(gradle插件)。
这是build.gradle中的jettyRunWar:
jettyRunWar{
contextPath = "/"
httpPort = 8080
jettyConfig = file("./jetty.xml")
reload = "automatic"
scanIntervalSeconds = 10
webApp = file("./build/libs/relevanteme.war")
}
这是jetty.xml(配置)。
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<New id="webApp" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>./build/libs/relevanteme.war</Set>
<Call name="addServlet">
<Arg>vjsantojaca.relevante.background.servlets.IdentifyServlet</Arg>
</Call>
</New>
<New id="Relevante" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/Relevante</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost:3306/mail_classmachine</Set>
<Set name="User">classmach</Set>
<Set name="Password">lTk54ifRd</Set>
</New>
</Arg>
</New>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<Ref refid="webApp" />
</Item>
<Item>
<New class="org.eclipse.jetty.server.handler.DefaultHandler" />
</Item>
</Array>
</Set>
</New>
</Set>
</Configure>
当我在gradle中运行命令jettyRunWar并且gradle下载dtd以获取jetty xml配置时,它会给我以下信息......
[org.mortbay.log] parsing: sid=file:/home/vjsantojaca/Developer/Relevante/relevanteme-web-2.0/jetty.xml,pid=null
[org.mortbay.log] resolveEntity(-//Jetty//Configure//EN, http://www.eclipse.org/jetty/configure_9_0.dtd)
[org.mortbay.log] Can't exact match entity in redirect map, trying configure_9_0.dtd
[sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@5df6163a5 pairs: {GET /jetty/configure_9_0.dtd HTTP/1.1: null}{User-Agent: Java/1.8.0_31}{Host: www.eclipse.org}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
[sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@2d313c8c14 pairs: {null: HTTP/1.1 200 OK}{Date: Tue, 14 Apr 2015 15:49:05 GMT}{Server: Apache}{Last-Modified: Tue, 11 Mar 2014 16:28:22 GMT}{ETag: "4e2795-239e-4f45735653580"}{Accept-Ranges: bytes}{Content-Length: 9118}{Vary: Accept-Encoding}{Access-Control-Allow-Origin: http://eclipse.org ; https://eclipse.org ; http://www.eclipse.org ; https://www.eclipse.org}{Access-Control-Allow-Methods: GET}{X-NodeID: (null)}{Keep-Alive: timeout=3, max=200}{Connection: Keep-Alive}{Content-Type: text/x-dtd}
为什么会这样?
谢谢!
答案 0 :(得分:0)
对org.mortbay.log
的引用意味着您正在使用古老的前码头-7版Jetty(可能是Jetty 6)。
这是你沮丧的原因。
你的jettyRunWar没有使用Jetty 9,它使用的是Jetty 6(?)