Java8获取复制内容_使用maven jetty插件在java 8上运行jetty 9时获取错误扫描文件[复制]...

参见英文答案 >

Spring AOP gives IllegalArgumentException with Java 8                                    3个

我正在运行一个简单的Hello World Web应用程序,使用

servlet-3.1,

jetty-9,运行于

jdk-8并使用maven-jetty-plugin.

public class HelloWorldServlet extends HttpServlet {

@Override

protected void doGet(HttpServletRequest request, HttpServletResponse response) {

try {

String message = "Hello Jetty From the HelloWorldServlet";

OutputStream stream = response.getOutputStream();

stream.write(message.getBytes());

stream.flush();

} catch (IOException ex) {

Logger.getLogger(HelloWorldServlet.class.getName()).log(Level.SEVERE, null, ex);

}

}

并在web.xml文件中很好地映射:

hello

org.tarrsalah.jetty.example.HelloWorldServlet

hello

/*

但是看起来jetty在运行mvn jetty时无法完成我的servlet类:run,我在这里缺少什么?

--- jetty-maven-plugin:9.1.3.v20140225:run (default-cli) @ jetty-example ---

2014-04-02 10:09:46.126:INFO::main: Logging initialized @12796ms

Configuring Jetty for project: jetty-example

webAppSourceDirectory not set. Trying src/main/webapp

Reload Mechanic: automatic

Classes = /home/tarrsalah/src/misc/jetty-exampe/target/classes

Context path = /

Tmp directory = /home/tarrsalah/src/misc/jetty-exampe/target/tmp

Web defaults = org/eclipse/jetty/webapp/webdefault.xml

Web overrides = none

web.xml file = file:/home/tarrsalah/src/misc/jetty-exampe/src/main/webapp/WEB-INF/web.xml

Webapp directory = /home/tarrsalah/src/misc/jetty-exampe/src/main/webapp

2014-04-02 10:09:46.291:INFO:oejs.Server:main: jetty-9.1.3.v20140225

2014-04-02 10:09:46.954:INFO:oeja.AnnotationConfiguration:main: Scanned 1 container path jars, 0 WEB-INF/lib jars, 1 WEB-INF/classes dirs in 82ms for context o.e.j.m.p.JettyWebAppContext@1f38957{/,file:/home/tarrsalah/src/misc/jetty-exampe/src/main/webapp/,STARTING}{file:/home/tarrsalah/src/misc/jetty-exampe/src/main/webapp/}

2014-04-02 10:09:46.954:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@1f38957{/,file:/home/tarrsalah/src/misc/jetty-exampe/src/main/webapp/,STARTING}{file:/home/tarrsalah/src/misc/jetty-exampe/src/main/webapp/}

java.lang.RuntimeException: Error scanning file HelloWorldServlet.class

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:705)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:821)

at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159)

at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:542)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)

at java.lang.Thread.run(Thread.java:744)

Caused by:

java.lang.IllegalArgumentException

at org.objectweb.asm.ClassReader.(Unknown Source)

at org.objectweb.asm.ClassReader.(Unknown Source)

at org.objectweb.asm.ClassReader.(Unknown Source)

at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:970)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:700)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:686)

at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:821)

at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159)

at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:542)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)

at java.lang.Thread.run(Thread.java:744)

2014-04-02 10:09:46.958:WARN:oejsh.RequestLogHandler:main: !RequestLog

2014-04-02 10:09:47.108:INFO:oejs.ServerConnector:main: Started ServerConnector@506594a5{HTTP/1.1}{0.0.0.0:8080}

2014-04-02 10:09:47.109:INFO:oejs.Server:main: Started @13779ms

Started Jetty Server

的pom.xml

org.eclipse.jetty

jetty-maven-plugin

9.1.3.v20140225

更新:

将maven-compiler-plugin的配置从1.8更改为1.7后,使用java-8和jetty-9有什么问题?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值