Jetty在idea中运行

下载

https://download.csdn.net/download/again_vivi/9796169
解压到任意目录

配置

在这里插入图片描述

configuration配置刚才解压的路径
在这里插入图片描述
设置端口:-Djetty.port=8091
在这里插入图片描述

运行时报错

如下

Detected server http port: 8080
[2019-04-28 05:17:04,217] Artifact tomcat_test_demo:war: Waiting for server connection to start artifact deployment...
53498
-DSTOP.KEY=1w75g0rco2wao
2019-04-28 17:17:09.679:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2019-04-28 17:17:09.767:WARN::Config error at <Set name="handler"><Ref id="oldhandler"/></Set> java.lang.IllegalStateException: No object for id=oldhandler
2019-04-28 17:17:09.767:WARN::Config error at <Set name="handler">|     <New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.RewriteHandler"><Set name="handler"><Ref id="oldhandler"/></Set><Set name="rewriteRequestURI">true</Set><Set name="rewritePathInfo">false</Set><Set name="originalPathAttribute">requestedPath</Set><Set name="rules">|          <Array type="org.mortbay.jetty.handler.rewrite.Rule"><Item>|             <New id="lowThreads" class="org.mortbay.jetty.handler.rewrite.LowThreadsRuleContainer"><Call name="addRule"><Arg>|                    <New id="busyresponse" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule"><Set name="pattern">/*</Set><Set name="code">500</Set><Set name="reason">Server busy</Set></New>|                  </Arg></Call></New>|           </Item><Item>|              <New class="org.mortbay.jetty.handler.rewrite.MsieSslRule"/>|            </Item><Item>|              <New class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule"><Set name="pattern">/favicon.ico</Set><Set name="name">Cache-Control</Set><Set name="value">Max-Age=3600,public</Set><Set name="terminating">true</Set></New>|            </Item><Item>|              <New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule"><Set name="regex">/rewrite/dump/regex/([^/]*)/(.*)</Set><Set name="replacement">/test/dump/$2/$1</Set></New>|            </Item><Item>|              <New id="" class="org.mortbay.jetty.handler.rewrite.RewritePatternRule"><Set name="pattern">/rewrite</Set><Set name="replacement">/rewrittento</Set></New>|            </Item><Item>|              <New id="response" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule"><Set name="pattern">/rewrite/session/</Set><Set name="code">401</Set><Set name="reason">Setting error code 401</Set></New>|            </Item><Item>|              <New id="header" class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule"><Set name="pattern">*.jsp</Set><Set name="name">Server</Set><Set name="value">Server for JSP</Set></New>|            </Item><Item>|              <New id="redirect" class="org.mortbay.jetty.handler.rewrite.RedirectPatternRule"><Set name="pattern">/rewrite/dispatch</Set><Set name="location">http://jetty.mortbay.org</Set></New>|            </Item><Item>|              <New id="forwardedHttps" class="org.mortbay.jetty.handler.rewrite.ForwardedSchemeHeaderRule"><Set name="header">X-Forwarded-Scheme</Set><Set name="headerValue">https</Set><Set name="scheme">https</Set></New>|            </Item><Item>|              <New id="virtualHost" class="org.mortbay.jetty.handler.rewrite.VirtualHostRuleContainer"><Set name="virtualHosts">|                  <Array type="java.lang.String"><Item>mortbay.com</Item><Item>www.mortbay.com</Item><Item>mortbay.org</Item><Item>www.mortbay.org</Item></Array>|                </Set><Call name="addRule"><Arg>|                    <New class="org.mortbay.jetty.handler.rewrite.CookiePatternRule"><Set name="pattern">/*</Set><Set name="name">CookiePatternRule</Set><Set name="value">1</Set></New>|                  </Arg></Call></New>|           </Item></Array>|        </Set></New>|    </Set> java.lang.IllegalStateException: No object for id=oldhandler
2019-04-28 17:17:09.768:WARN::EXCEPTION 
java.lang.IllegalStateException: No object for id=oldhandler
	at org.mortbay.xml.XmlConfiguration.refObj(XmlConfiguration.java:645)
	at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:916)
	at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:837)
	at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:286)
	at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
	at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:626)
	at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:915)
	at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:837)
	at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:286)
	at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
	at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:214)
	at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:974)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mortbay.start.Main.invokeMain(Main.java:194)
	at org.mortbay.start.Main.start(Main.java:534)
	at org.mortbay.start.Main.start(Main.java:441)
	at org.mortbay.start.Main.main(Main.java:119)

Process finished with exit code 0
Disconnected from server

在这里插入图片描述
因为在配置中
在这里插入图片描述
原来我是选中rewrite.xml的,
其实,只需要选中
在这里插入图片描述
这两个核心的即可,如果一个都不选的话,也是不行的。
在这里插入图片描述
感谢:https://intellij-support.jetbrains.com/hc/en-us/community/posts/206246209-10-5-1-can-t-configure-jetty-to-run-generated-war-file

请求

最后运行的项目名应该是maven工程生成的项目名
例如
在这里插入图片描述

访问:http://localhost:8091/tomcat_test_demo-1.0-SNAPSHOT/2

转载于:https://www.cnblogs.com/LeesinDong/p/10835254.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值