jetty war 解压路径spdy.war 干什么用

Oops, something went wrong...
Oops, something went wrong and we're completely broken down.
Someone or something has likely already alerted us about this, so sit back while we fix the site.
Thank you for your patience.Jetty 9.0 SPDY embedded config - Stack Overflow
to customize your list.
Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
I need help with debugging Jetty SPDY configuration issue.
Jetty: org.eclipse.jetty.aggregate:jetty-all:9.0.6.v (Maven dependency)
Jetty-SPDY: org.eclipse.jetty.spdy:spdy-http-server:9.0.6.v (Maven dependency)
NPN-API: org.eclipse.jetty.npn:npn-api:8.1.2.v (Maven dependency, tried w/ and w/o it)
NPN-BOOT: org.mortbay.jetty.npn:npn-boot:8.1.2.v (used as -Xbootclasspath/p:/home/martin/.m2/repository/org/mortbay/jetty/npn/npn-boot/8.1.2.v/npn-boot-8.1.2.v.jar)
Google Chrome: 30
Firefox: 24
Embedded Jetty (Scala code):
package com.example.test
import org.apache.wicket.util.time.Duration
import org.eclipse.jetty.server.{HttpConnectionFactory, SslConnectionFactory, ServerConnector, SecureRequestCustomizer, HttpConfiguration, Server}
import org.eclipse.jetty.util.resource.Resource
import org.eclipse.jetty.util.ssl.SslContextFactory
import org.eclipse.jetty.spdy.server.http.{HTTPSPDYServerConnectionFactory, ReferrerPushStrategy, HTTPSPDYServerConnector}
import org.eclipse.jetty.webapp.WebAppContext
import org.eclipse.jetty.spdy.server.{SPDYServerConnectionFactory, NPNServerConnectionFactory}
import org.eclipse.jetty.npn.NextProtoNego
object JettyStart {
def main(args: Array[String]) {
val startTime = System.currentTimeMillis()
val tlsHttpConfiguration = new HttpConfiguration()
tlsHttpConfiguration.setSecureScheme("https")
tlsHttpConfiguration.setSecurePort(8443)
tlsHttpConfiguration.setOutputBufferSize(32768)
tlsHttpConfiguration.setRequestHeaderSize(8192)
tlsHttpConfiguration.setResponseHeaderSize(8192)
tlsHttpConfiguration.addCustomizer(new SecureRequestCustomizer)
tlsHttpConfiguration.setSendServerVersion(true)
val server = new Server()
val http = new HttpConnectionFactory(tlsHttpConfiguration)
val connector = new ServerConnector(server, http)
connector.setIdleTimeout(Duration.ONE_MINUTE.getMilliseconds)
connector.setSoLingerTime(-1)
connector.setPort(8080)
server.addConnector(connector)
val keystore: Resource = Resource.newClassPathResource("/keystore")
if (keystore != null && keystore.exists) {
SPDYServerConnectionFactory.checkNPNAvailable()
val pushStrategy = new ReferrerPushStrategy
pushStrategy.setReferrerPushPeriod(5000)
pushStrategy.setMaxAssociatedResources(32)
val factory: SslContextFactory = new SslContextFactory
factory.setKeyStoreResource(keystore)
factory.setKeyStorePassword("wicket")
factory.setTrustStoreResource(keystore)
factory.setKeyManagerPassword("wicket")
factory.setProtocol("TLSv1")
factory.setIncludeProtocols("TLSv1")
NextProtoNego.debug = true
val sslConnectionFactory = new SslConnectionFactory(factory, "npn")
val npnConnectionFactory = new NPNServerConnectionFactory("spdy/3", "spdy/2", "http/1.1")
npnConnectionFactory.setDefaultProtocol("http/1.1")
val spdy3ConnectionFactory = new HTTPSPDYServerConnectionFactory(3, tlsHttpConfiguration, pushStrategy)
val spdy2ConnectionFactory = new HTTPSPDYServerConnectionFactory(2, tlsHttpConfiguration)
val httpConnectionFactory = new HttpConnectionFactory(tlsHttpConfiguration)
val spdyConnector = new ServerConnector(server, sslConnectionFactory, npnConnectionFactory, spdy3ConnectionFactory,
spdy2ConnectionFactory, httpConnectionFactory)
spdyConnector.setPort(8443)
server.addConnector(spdyConnector)
val context = new WebAppContext()
context.setServer(server)
context.setContextPath("/")
context.setWar("src/main/webapp")
server.setHandler(context)
server.setDumpAfterStart(false)
server.start()
println("Start took: " + Duration.valueOf(System.currentTimeMillis() - startTime))
System.in.read()
System.out.println("&&& STOPPING EMBEDDED JETTY SERVER")
server.stop()
server.join()
The code above is inspired from .
Requesting port 8080 works fine.
Requesting port 8443 attempts to establish secure connection and times out.
NPN debugging produces such logs:
[S] NPN received for 13ef0ffb[SSLEngine[hostname=127.0.0.1 port=43086] SSL_NULL_WITH_NULL_NULL]
[S] NPN protocols [spdy/3, spdy/2, http/1.1] sent to client for 13ef0ffb[SSLEngine[hostname=127.0.0.1 port=43086] SSL_NULL_WITH_NULL_NULL]
[S] NPN selected 'spdy/3' for 13ef0ffb[SSLEngine[hostname=127.0.0.1 port=43086] SSL_NULL_WITH_NULL_NULL]
Looks like your NPN versions are off.
Here's the versions of the npn artifacts you will need to use, depending on your chosen version of Java.
Stated in Maven terms.
&dependency&
&groupId&org.mortbay.jetty.npn&/groupId&
&artifactId&npn-boot&/artifactId&
&version&${npn-version}&/version&
&/dependency&
&dependency&
&groupId&org.mortbay.jetty.npn&/groupId&
&artifactId&npn-api&/artifactId&
&version&${npn-version}&/version&
&/dependency&
The Java to NPN version mapping (as of Oct 23, 2013)
${npn-version}
-----------+--------------------------
1.7.0_11 |
1.7.0_13 |
1.7.0_15 |
1.7.0_17 |
1.7.0_21 |
1.7.0_25 |
1.7.0_40 |
1.7.0_45 |
The different versions are for handling the changes done in the JVM for creating TLS extensions.
Note: Java 9 is promising better APIs for managing the entire TLS/NPN/ALPN extension setup, so this kind of strict mapping of bootjars to specific versions of Java should eventually go away.
21.2k33461
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledosx - Run Jetty service at startup Mac OS X - Stack Overflow
to customize your list.
Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
I am trying to launch a Jetty webserver whenever the iMac boots. I have written the following plist to start the service:
&?xml version="1.0" encoding="UTF-8"?&
&!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "/DTDs/PropertyList-1.0.dtd"&
&plist version="1.0"&
&key&KeepAlive&/key&
&key&Label&/key&
&string&com.posios.jetty&/string&
&key&ProgramArguments&/key&
&string&/Users/cvv/Documents/Jetty7/bin/jetty.sh&/string&
&string&start&/string&
&key&RunAtLoad&/key&
However, it seems the service starts but somehow ends in a loop. I am guessing this because every couple of seconds a new log file is generated in the logs folder of Jetty. In the logs I can see that the service is starting and the different WAR files are being deployed but then I see contexthandler stopped.
12:53:23.643:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/Registration,file:/private/tmp/jetty-0.0.0.0-8080-Registration.war-_Registration-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/Registration.war
12:53:23.649:INFO:oejd.DeploymentManager:Deployable added: /Users/cvv/Documents/Jetty7/webapps/management1.war
12:53:23.652:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/cvv/Documents/Jetty7/webapps/management1.war!/ to /private/tmp/jetty-0.0.0.0-8080-management1.war-_management1-any-/webapp
12:53:25.267:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/management1,file:/private/tmp/jetty-0.0.0.0-8080-management1.war-_management1-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/management1.war
12:53:25.299:INFO:oejd.DeploymentManager:Deployable added: /Users/cvv/Documents/Jetty7/webapps/spdy.war
12:53:25.307:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/cvv/Documents/Jetty7/webapps/spdy.war!/ to /private/tmp/jetty-0.0.0.0-8080-spdy.war-_spdy-any-/webapp
12:53:25.630:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/spdy,file:/private/tmp/jetty-0.0.0.0-8080-spdy.war-_spdy-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/spdy.war
12:53:25.635:INFO:oejdp.ScanningAppProvider:Deployment monitor /Users/cvv/Documents/Jetty7/contexts at interval 1
12:53:25.637:INFO:oejd.DeploymentManager:Deployable added: /Users/cvv/Documents/Jetty7/contexts/posimages.xml
12:53:25.647:INFO:oejsh.ContextHandler:started o.e.j.s.h.ContextHandler{/posimages,file:/Users/cvv/posios/users/}
12:53:25.648:INFO:oejd.DeploymentManager:Deployable added: /Users/cvv/Documents/Jetty7/contexts/javadoc.xml
12:53:25.675:INFO:oejsh.ContextHandler:started o.e.j.s.h.ContextHandler{/javadoc,file:/Users/cvv/Documents/Jetty7/javadoc/}
12:53:25.680:INFO:oejd.DeploymentManager:Deployable added: /Users/cvv/Documents/Jetty7/contexts/test.xml
12:53:25.729:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/cvv/Documents/Jetty7/webapps/test.war!/ to /private/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp
12:53:26.390:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/private/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/test.war
12:53:26.601:INFO:oejs.TransparentProxy:TransparentProxy @ /javadoc-proxy to http://download.eclipse.org/jetty/stable-7/apidocs
12:53:26.630:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
12:53:28.866:INFO:oejs.Server:Graceful shutdown SelectChannelConnector@0.0.0.0:8080
12:53:28.867:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/partner,file:/private/tmp/jetty-0.0.0.0-8080-partner.war-_partner-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/partner.war
12:53:28.868:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/PosServer,file:/private/tmp/jetty-0.0.0.0-8080-PosServer.war-_PosServer-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/PosServer.war
12:53:28.869:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/Registration,file:/private/tmp/jetty-0.0.0.0-8080-Registration.war-_Registration-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/Registration.war
12:53:28.871:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/management1,file:/private/tmp/jetty-0.0.0.0-8080-management1.war-_management1-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/management1.war
12:53:28.872:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/spdy,file:/private/tmp/jetty-0.0.0.0-8080-spdy.war-_spdy-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/spdy.war
12:53:28.874:INFO:oejs.Server:Graceful shutdown o.e.j.s.h.ContextHandler{/posimages,file:/Users/cvv/posios/users/}
12:53:28.874:INFO:oejs.Server:Graceful shutdown o.e.j.s.h.ContextHandler{/javadoc,file:/Users/cvv/Documents/Jetty7/javadoc/}
12:53:28.874:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/,file:/private/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/test.war
12:53:29.977:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver purged
12:53:29.977:INFO:oejsh.ContextHandler:stopped o.e.j.w.WebAppContext{/,file:/private/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/test.war
12:53:29.988:INFO:oejsh.ContextHandler:stopped o.e.j.s.h.ContextHandler{/javadoc,file:/Users/cvv/Documents/Jetty7/javadoc/}
12:53:29.988:INFO:oejsh.ContextHandler:stopped o.e.j.s.h.ContextHandler{/posimages,file:/Users/cvv/posios/users/}
12:53:29.999:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver purged
12:53:29.999:INFO:oejsh.ContextHandler:stopped o.e.j.w.WebAppContext{/spdy,file:/private/tmp/jetty-0.0.0.0-8080-spdy.war-_spdy-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/spdy.war
12:53:30.009:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver purged
12:53:30.009:INFO:oejsh.ContextHandler:stopped o.e.j.w.WebAppContext{/management1,file:/private/tmp/jetty-0.0.0.0-8080-management1.war-_management1-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/management1.war
12:53:30.103:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver purged
12:53:30.103:INFO:oejsh.ContextHandler:stopped o.e.j.w.WebAppContext{/Registration,file:/private/tmp/jetty-0.0.0.0-8080-Registration.war-_Registration-any-/webapp/},/Users/cvv/Documents/Jetty7/webapps/Registration.war
Does anyone have experience with this, or am I starting the service the wrong way? If I start the service manually by executing the same command "/Users/cvv/Documents/Jetty7/bin/jetty.sh start" everything starts up. In the log I can clearly see the beginning of the code is being executed, however all of the sudden it is being killed.
I am running Mac OS X 10.9.1 with Jetty 7.6.14.
Any help would be greatly appreciated.
---Edit---
I got working by changing it form a LaunchDaemon to a LaunchAgent making sure it is launched later than the other services. What the precise reason is, I don't know, but I thought I'd share the information. Thanks anyway.
Know someone who can answer?
Share a link to this
via , , , or .
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Browse other questions tagged
Stack Overflow works best with JavaScript enabled二.配置简单的嵌入式jetty
修改类文件,类加载器就能重新加载修改过的类,测试就方便了,在开发web应用的时候,这样做似乎不是件容易事.tomcat maven组件会把应用打成war包,再上传到tomcat,重新部署再测试,虽然看起来一切都是自动化过程,当jar包又多又大时,你会感觉到这组件很忙,或许因为如此,有些人选择了jetty maven组件,jetty不用打成war包,直接从输出目录重新加载类,看起来要优雅点.当我们用gradle,jetty组件稳定但不支持servlet3,gretty不稳定...以后gradle会好的,相信总有一天!
maven和gradle的项目标准目录结构是相似的,如下:
src/main/java Application/Library sources
src/main/resources Application/Library resources
src/main/filters Resource filter files
src/main/config Configuration files
src/main/scripts Application/Library scripts
src/main/webapp Web application sources
src/test/java Test sources
src/test/resources Test resources
src/test/filters Test resource filter files
src/it Integration Tests (primarily for plugins)
src/assembly Assembly descriptors
src/site Site
LICENSE.txt Project's license
NOTICE.txt Notices and attributions required by libraries that the project depends on
README.txt Project's readme
而两者编译输出目录有差别,但基本不存在不便.
和前篇文件一样,选用了&&gradle的war插件&&简单开发的web应用来测试.没有找到tomcat方便的API设置额外的类路径.下文主要以jetty来实现这个嵌入式jetty
1.再新建一个gradle项目,build.gradle如下:
apply plugin: 'java'
sourceCompatibility = 1.7
version = '1.0'
repositories {
mavenCentral()
dependencies {
compile(&org.eclipse.jetty:jetty-util-ajax:9.2.1.v&)
compile(&org.eclipse.jetty:jetty-deploy:9.2.1.v&)
compile(&org.eclipse.jetty:jetty-jmx:9.2.1.v&)
compile(&org.eclipse.jetty.websocket:javax-websocket-server-impl:9.2.1.v&)
compile(&org.eclipse.jetty.spdy:spdy-http-server:9.2.1.v&)
compile(&org.eclipse.jetty:jetty-proxy:9.2.1.v&)
compile(&org.eclipse.jetty:jetty-jsp:9.2.1.v&)
task jarWithoutResources(type: Jar,dependsOn:compileJava) {
attributes 'Main-Class':'Start'
from(&$buildDir/classes/main&)
archiveName(&start.jar&)
2.新建一个含有main方法的可执行类(此类的编写主要参考jetty官方文档:http://www.eclipse.org/jetty/documentation/current/using-annotations-embedded.html).
Start.java:
import org.eclipse.jetty.server.S
import org.eclipse.jetty.webapp.WebAppC
public class Start {
public static void main(String[] args) throws Exception {
//Get parameters
String resourceBase=PropertyUtil.getProperty(&resourceBase&);
if (resourceBase==null) throw new Exception(&resourceBase can not be null&);
String portTmp=PropertyUtil.getProperty(&port&);
int port=portTmp==null?8080:Integer.valueOf(portTmp);
String contextPath=PropertyUtil.getProperty(&contextPath&);
contextPath=contextPath==null?&/&:contextP
String extraClasspath=PropertyUtil.getProperty(&extraClasspath&);
extraClasspath=extraClasspath==null?&&:extraC
Server server = new Server(port);
//Enable parsing of jndi-related parts of web.xml and jetty-env.xml
org.eclipse.jetty.webapp.Configuration.ClassList classList = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classList.addAfter(&org.eclipse.jetty.webapp.FragmentConfiguration&, &org.eclipse.jetty.plus.webapp.EnvConfiguration&, &org.eclipse.jetty.plus.webapp.PlusConfiguration&);
classList.addBefore(&org.eclipse.jetty.webapp.JettyWebXmlConfiguration&, &org.eclipse.jetty.annotations.AnnotationConfiguration&);
//Create a WebAppContext
WebAppContext webapp = new WebAppContext();
webapp.setContextPath(contextPath);
webapp.setResourceBase(resourceBase);
webapp.setExtraClasspath(extraClasspath);
server.setHandler(webapp);
server.start();
server.join();
和上篇文章的war包配置的嵌入式jetty例子很相似,将setWar改成了setResourceBase和setExtraClasspath,另外上面利用PropertyUtil从.properties文件获取属性配置.
server.properties文件如下:
#默认为'8080'
#默认为'/'
contextPath=/test
resourceBase=E:/idea/test/src/main/webapp
extraClasspath=E:/idea/test/build/classes/main/;E:/idea/test/build/resources/main/;E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-webmvc/3.2.8.RELEASE/bfee7fa658c3e0a28aa90/spring-webmvc-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/1.5.2.RELEASE/6eda638a0bf/spring-data-jpa-1.5.2.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-orm/3.2.8.RELEASE/b1f3ef4edfdc361e17bbdf3251c49/spring-orm-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-tx/3.2.8.RELEASE/af44bdd6dd21a7d2721bbf1708ec1/spring-tx-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.hibernate/hibernate-entitymanager/4.3.1.Final/c27f31f1ecf6a5b6f6c490b4bcbb9/hibernate-entitymanager-4.3.1.Final. E:/gradlerepo/caches/modules-2/files-2.1/c3p0/c3p0/0.9.1.2/4eab90d22195bbdbb6/c3p0-0.9.1.2. E:/gradlerepo/caches/modules-2/files-2.1/mysql/mysql-connector-java/5.1.26/f1697bef73e70ebac8ef/mysql-connector-java-5.1.26. E:/gradlerepo/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.3.1/cbbbcbeda072e3def123a9b/jackson-databind-2.3.1. E:/gradlerepo/caches/modules-2/files-2.1/commons-fileupload/commons-fileupload/1.3.1/c621bd99db27e1052c/commons-fileupload-1.3.1. E:/gradlerepo/caches/modules-2/files-2.1/org.slf4j/slf4j-nop/1.7.6/3d219ee4edff6ef2a6/slf4j-nop-1.7.6. E:/gradlerepo/caches/modules-2/files-2.1/org.apache.taglibs/taglibs-standard-impl/1.2.1/ac6cc1b6beff4cfa3a6b0/taglibs-standard-impl-1.2.1. E:/gradlerepo/caches/modules-2/files-2.1/javax.servlet/javax.servlet-api/3.1.0/3cd63db2fa84bebf7c/javax.servlet-api-3.1.0. E:/gradlerepo/caches/modules-2/files-2.1/javax.servlet.jsp/jsp-api/2.2.1-b03/cceb4bf31f76ae01b74/jsp-api-2.2.1-b03. E:/gradlerepo/caches/modules-2/files-2.1/javax.servlet.jsp.jstl/javax.servlet.jsp.jstl-api/1.2.1/f072f63abc221df3e6bb3e64a84a/javax.servlet.jsp.jstl-api-1.2.1. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-beans/3.2.8.RELEASE/7aa7d1192ad7acc4b5ced07d44a1cdc4e3a377b9/spring-beans-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-context/3.2.8.RELEASE/7edfc6e93682cab1f8c37d9f1890/spring-context-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-core/3.2.8.RELEASE/64b9b731decc7584/spring-core-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-expression/3.2.8.RELEASE/becdd45da9b6c237a1/spring-expression-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-web/3.2.8.RELEASE/799aef980fecd38c9e6b23a71a406c8/spring-web-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework.data/spring-data-commons/1.7.2.RELEASE/ccaf8f785382bdef27a0c287d2d75af7e5c8dccf/spring-data-commons-1.7.2.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-aop/3.2.8.RELEASE/90ea4c07ca11d41789/spring-aop-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.aspectj/aspectjrt/1.7.4/e49a5c0acee8fd6692df/aspectjrt-1.7.4. E:/gradlerepo/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.6/df3d1a76027fca17d54ea/slf4j-api-1.7.6. E:/gradlerepo/caches/modules-2/files-2.1/org.slf4j/jcl-over-slf4j/1.7.6/abf1e5c2ec6d12fc1036a/jcl-over-slf4j-1.7.6. E:/gradlerepo/caches/modules-2/files-2.1/org.springframework/spring-jdbc/3.2.8.RELEASE/8fc09a51ca267726ffd284ab4de7c02f667da2ad/spring-jdbc-3.2.8.RELEASE. E:/gradlerepo/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging/3.1.3.GA/e5e1b3fdc02ffe3545/jboss-logging-3.1.3.GA. E:/gradlerepo/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging-annotations/1.2.0.Beta1/2f437f37bb265d9f8f1392823dbca12d2bec06d6/jboss-logging-annotations-1.2.0.Beta1. E:/gradlerepo/caches/modules-2/files-2.1/org.hibernate/hibernate-core/4.3.1.Final/73618cbf2dd1fa989a13dcfc51ec10/hibernate-core-4.3.1.Final. E:/gradlerepo/caches/modules-2/files-2.1/dom4j/dom4j/1.6.1/5d3ccc056b6f056dbf0dddfdfa8f94/dom4j-1.6.1. E:/gradlerepo/caches/modules-2/files-2.1/mon/hibernate-commons-annotations/4.0.4.Final/f1af75eca4e13ac159695feceebfc/hibernate-commons-annotations-4.0.4.Final. E:/gradlerepo/caches/modules-2/files-2.1/org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final/5e731da07290bfaf3db1fbc8bbbf405a/hibernate-jpa-2.1-api-1.0.0.Final. E:/gradlerepo/caches/modules-2/files-2.1/org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/1f9fef7a9fcbb41cc390fc370a291cf/jboss-transaction-api_1.2_spec-1.0.0.Final. E:/gradlerepo/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d9a09fbf99f19e2cffe0ae219db5b/javassist-3.18.1-GA. E:/gradlerepo/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.3.0/f5e853a20bd56f9ae1e64af5cb3da/jackson-annotations-2.3.0. E:/gradlerepo/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.3.1/f9ffefe2fb3efdeb477a67c96ea2d0/jackson-core-2.3.1. E:/gradlerepo/caches/modules-2/files-2.1/commons-io/commons-io/2.2/83b5b8a7ba1c08f9e8c8ffd3c1e22a/commons-io-2.2. E:/gradlerepo/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f/commons-logging-1.1.3. E:/gradlerepo/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/235ba8bac13a8f9ea77a1ca5ebe3e8/aopalliance-1.0. E:/gradlerepo/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7. E:/gradlerepo/caches/modules-2/files-2.1/org.jboss/jandex/1.1.0.Final/e84abddff/jandex-1.1.0.Final. E:/gradlerepo/caches/modules-2/files-2.1/xml-apis/xml-apis/1.0.b2/c9d18bd356bf85c9/xml-apis-1.0.b2.jar
port,contextPath,resourceBase的设置都是容易理解的.额外的类路径extraClasspath指的意思:当启动jetty的时候,类加载器也从这些位置加载类文件.jar文件或目录要以分号或逗号分隔,并且是目录时,要以'/'结尾.上面例子的意思当启动这个嵌入式jetty,应先加载E:/idea/test/build/classes/main/,E:/idea/test/build/resources/main/两个目录下的文件和项目依赖的一些jar包.
至于这些依赖jar包路径可通过以下任务获得
task('jarPath')&&{
& & configurations.runtime.resolve().each {
& & & & print it.toString()+&;&
& & println();
3.运行一下main方法,就可以通过浏览器来访问这个web应用了.
如果开发每个应用都要打开这个工程,再运行调试,这样当然不方便.我希望通过一个命令能直接运行就可以启动这个jetty.那么继续进行下面第4步.
4.从第3步的运行,可以拷贝出这个运行命令,但这个命令相当长,我测试终端里dos命令最大输入长度是8190,而这个命令很可能超过限制,那么可以写一个start.bat文件来执行就可以了.下面是我拷贝再修改后的start.bat文件
D:\jdk7\bin\java -Didea.launcher.port=7535 -Didea.launcher.bin.path=D:\idea\bin -Dfile.encoding=UTF-8 -classpath .;E:\idea\webApp\build\classes\E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-server\9.2.1.vc51c4f8eece978feaaf05c3dc4ea\jetty-server-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\javax.servlet\javax.servlet-api\3.1.0\3cd63db2fa84bebf7c\javax.servlet-api-3.1.0.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-http\9.2.1.vafc9d4ce5d586e11ad90b9831fff\jetty-http-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-io\9.2.1.v5fef0a1bfe6951dba\jetty-io-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-util\9.2.1.vae7ac5d3cfcb21bc288dd3f4ec3bad\jetty-util-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-webapp\9.2.1.ve0f4ba7a0cebb8af1ba2ccf6e\jetty-webapp-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-xml\9.2.1.v60db9ea4569046\jetty-xml-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-servlet\9.2.1.v27faaf09a3f306babc209f9a7ae01b1528464\jetty-servlet-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-security\9.2.1.vac8cc9e5c66eb6022cbe80f4e22d4e42dc5e643\jetty-security-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-jsp\9.2.1.va2a54e3a64b5b592ba1114f70ebbde\jetty-jsp-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.toolchain\jetty-schemas\3.1.M0\6179bafb6ed2ebdf4f85\jetty-schemas-3.1.M0.E:\gradlerepo\caches\modules-2\files-2.1\javax.servlet.jsp\javax.servlet.jsp-api\2.3.1\95cfeda64ef348435fc\javax.servlet.jsp-api-2.3.1.E:\gradlerepo\caches\modules-2\files-2.1\org.glassfish.web\javax.servlet.jsp\2.3.2\613f97e845bbd6f399\javax.servlet.jsp-2.3.2.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.orbit\javax.servlet.jsp.jstl\1.2.0.v\db594f1c8fc00d536f6d135bd7f8a9a99a6b8eea\javax.servlet.jsp.jstl-1.2.0.v.E:\gradlerepo\caches\modules-2\files-2.1\org.glassfish.web\javax.servlet.jsp.jstl\1.2.2\5b2e83ef42b4eef0a7e41d43bb1d4b835f59ac7a\javax.servlet.jsp.jstl-1.2.2.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.orbit\org.eclipse.jdt.core\3.8.2.v\ebb04771ae21dec404d\org.eclipse.jdt.core-3.8.2.v.E:\gradlerepo\caches\modules-2\files-2.1\org.glassfish\javax.el\3.0.1-b05\ecaba23d84\javax.el-3.0.1-b05.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-annotations\9.2.1.ve30fffc3dd3b868be8f\jetty-annotations-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-plus\9.2.1.vfc8a3d259e441debcf4d0bc69d\jetty-plus-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.2\479c1e06db31ccae146\javax.annotation-api-1.2.E:\gradlerepo\caches\modules-2\files-2.1\org.ow2.asm\asm\5.0.1\2fdaafe6ec6a73ccba520be4a7e1565\asm-5.0.1.E:\gradlerepo\caches\modules-2\files-2.1\org.ow2.asm\asm-commons\5.0.1\7ba14d2edfdcf3f7b0e87a0939c3e\asm-commons-5.0.1.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-jndi\9.2.1.v501a0b726d045aed35ab1a3de02\jetty-jndi-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.ow2.asm\asm-tree\5.0.1\1b1e6e9d869acdac619e6\asm-tree-5.0.1.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-util-ajax\9.2.1.va2cee4e2c23a998c\jetty-util-ajax-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-deploy\9.2.1.vefbba947a824420\jetty-deploy-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-jmx\9.2.1.v8d5ac618baff4638a6\jetty-jmx-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\javax-websocket-server-impl\9.2.1.v66d7fc33bfda5d732b13ea552d\javax-websocket-server-impl-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\websocket-server\9.2.1.v\fae9ffa11263caaf9c2d\websocket-server-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.spdy\spdy-http-server\9.2.1.v\eece9af44e8db376f23c259ddcee7\spdy-http-server-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-proxy\9.2.1.v6967fbfbdaf5edff4e95c1bdb2\jetty-proxy-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\javax-websocket-client-impl\9.2.1.vcbc3afb9b4e9690\javax-websocket-client-impl-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\javax.websocket\javax.websocket-api\1.0\fc843b649d4a1dcbbefa\javax.websocket-api-1.0.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\websocket-common\9.2.1.v48aec56c2cc5a808c11c2b7fa\websocket-common-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\websocket-client\9.2.1.vc9e53eeae597cbb57\websocket-client-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\websocket-servlet\9.2.1.vdcb55ff0fe9f888dd4bab8c9ced\websocket-servlet-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.spdy\spdy-http-common\9.2.1.veabb6d2cd38a5ce4ab0cb4792ba1\spdy-http-common-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.spdy\spdy-server\9.2.1.vad4edb6321b6eace5df3c6a64aeb\spdy-server-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-client\9.2.1.vf2e58f8c89a7508d6\jetty-client-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.websocket\websocket-api\9.2.1.v\fabe69a341c72eb3fdd8b0f16e81c\websocket-api-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.spdy\spdy-core\9.2.1.ve5e1bc965e8cfde0e70a2f2f5f98d\spdy-core-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty.spdy\spdy-client\9.2.1.v\afeeac261ccb29e52cf9e852fa71\spdy-client-9.2.1.v.E:\gradlerepo\caches\modules-2\files-2.1\org.eclipse.jetty\jetty-alpn-client\9.2.1.v55fcb7a63fd830e7d\jetty-alpn-client-9.2.1.v.D:\idea\lib\idea_rt.jar com.intellij.rt.execution.application.AppMain Start
5.把server.properties和start.bat拷贝到test应用的根目录下.双击start.bat就可以启动jetty了.关闭这个窗口就可以关闭jetty.当然也可以打开IDEA的terminal来运行,ctrl+c就可以退出命令关闭jetty.有了这个server.property,就可以随时嵌入到一个web项目来启动jetty
另外:/idea/documentation/migration_faq.html
问题提到Q: What happened to incremental compilation? How do I compile my project?答案的解析里有说得编译的时机.在IDEA里你按ctrl+s,并不会即时编译,可以按ctrl+shift+f9编译当前文件.而ctrl+f9可以编译整个项目.
小结:这基本可以前面所说的需求,修改类,自动reload功能没实现,感觉还是不太实用.做成gradle插件,就更好了!但不想花太多心思.
本分类共有文章104篇,更多信息详见
& 2012 - 2016 &
&All Rights Reserved. &
/*爱悠闲图+*/
var cpro_id = "u1888441";
/*爱悠闲底部960*75*/
var cpro_id = "u1888128";

我要回帖

更多关于 war包部署到jetty 的文章

 

随机推荐