6

I just started a new vaadin project with maven (com.vaadin:[email protected]).

In the default MyVaadinUI.java i have replaced the Butten.ClickListener() with a lambda expression, after that i get a exception while running package jetty:run

Before:

Button button = new Button("Click Me");
  button.addClickListener(new Button.ClickListener() {
    public void buttonClick(ClickEvent event) {
      layout.addComponent(new Label("Thank you for clicking"));
    }
});
layout.addComponent(button);

After:

Button button = new Button("Click Me");
button.addClickListener(event -> layout.addComponent(new Label("Thank you for clicking")));
layout.addComponent(button);

Exception:

2014-08-26 13:23:30.069:WARN:oeja.AnnotationParser:EXCEPTION 
java.lang.ArrayIndexOutOfBoundsException: 1612
    at org.objectweb.asm.ClassReader.readClass(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:899)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:755)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:744)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:744)
    at org.mortbay.jetty.plugin.MavenAnnotationConfiguration.doParse(MavenAnnotationConfiguration.java:73)
    at org.mortbay.jetty.plugin.MavenAnnotationConfiguration.parseWebInfClasses(MavenAnnotationConfiguration.java:52)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:119)
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:468)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1237)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:298)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    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:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
    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:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

I`m using IntelliJ13.1 with JDK8 on OSX

5
  • 2
    I'd say that your version of ASM does not support Java 8. Jetty is using ASM to scan binary classes for annotations. Commented Aug 26, 2014 at 12:15
  • 3
    thx, updating jetty-maven-plugin solved it for me. Commented Aug 27, 2014 at 11:23
  • thanks, I had the same issue and using jetty-maven-plugin 9.2.2.v20140723 instead of 9.0.6.v20130930 fix the issue. Commented Nov 27, 2014 at 22:38
  • 1
    Hi, what version of jetty are you using? I'm using 8.1.16.v20140903 and I'm still getting the same issue. Commented Dec 12, 2014 at 3:29
  • 1
    @CodeJunkie I am experiencing the same issue with Jetty 8.1.2.v20120308, as @Schrodinger's'Cat said, you can upgrade to 9.2.2 and it should fix. Commented Feb 16, 2015 at 17:02

2 Answers 2

4

I faced this issue when I deployed the app in jetty 8.12.x. I resolved the issue by upgrading to jetty 9.2.x. (Yes, lambdas are used in app)

Sign up to request clarification or add additional context in comments.

Comments

3

I've read a lot of pages about this issue because I encountered it too.

For me the solution was simple but hard to be found. I use jetty-8.1.10 with asm-3.3.1 and primefaces-5.1.

The problem appears when you have lambda expressions in any of the annotated classes, or in any class referenced by the annotated ones.

Simply changing the code from Java 8 compliance in Java 7 compliance (lambda expressions in normal Java 7 code), the warns had gone away. This was only possible debugging the org.objectweb.asm.ClassReader.

Cheers.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.