1 Reply Latest reply on Feb 2, 2015 9:59 PM by Vimal Kansal

    Having trouble deploying web app with AsyncListener

    Vimal Kansal Newbie

      Hi,

       

       

      I am using WildFly 8.2 on JDK 1.8. I have an AsyncListener defined, source code builds fine. But on deployment I get the following error :

       

       

      2015-02-02 20:53:52,078 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "chapter3.war" (runtime-name: "chapter3.war")

      2015-02-02 20:53:52,474 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./chapter3.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./chapter3.UndertowDeploymentInfoService: Failed to start service

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_31]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_31]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]

      Caused by: java.lang.IllegalArgumentException: UT010012: Listener class class com.redhat.chapter3.ExampleAsyncListener must implement at least one listener interface

        at io.undertow.servlet.api.ListenerInfo.<init>(ListenerInfo.java:41)

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.addListener(UndertowDeploymentInfoService.java:1222)

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:783)

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:256)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

       

       

      My Listener class is looks like :

       

      package com.redhat.chapter3;

       

       

      import java.io.PrintWriter;

       

       

      import javax.servlet.AsyncEvent;

      import javax.servlet.AsyncListener;

      import javax.servlet.ServletResponse;

      import javax.servlet.annotation.WebListener;

       

       

      /**

      * Application Lifecycle Listener implementation class ExampleAsyncListener

      *

      */

      @WebListener

      public class ExampleAsyncListener implements AsyncListener {

       

       

          /**

           * Default constructor.

           */

          public ExampleAsyncListener() {

              // TODO Auto-generated constructor stub

          }

       

       

        /**

           * @see AsyncListener#onComplete(AsyncEvent)

           */

          public void onComplete(AsyncEvent arg0) throws java.io.IOException {

               // TODO Auto-generated method stub

          System.out.println("AppAsyncListener onComplete");

          }

       

       

        /**

           * @see AsyncListener#onError(AsyncEvent)

           */

          public void onError(AsyncEvent arg0) throws java.io.IOException {

               // TODO Auto-generated method stub

          System.out.println("AppAsyncListener onError");

          }

       

       

        /**

           * @see AsyncListener#onStartAsync(AsyncEvent)

           */

          public void onStartAsync(AsyncEvent arg0) throws java.io.IOException {

               // TODO Auto-generated method stub

          System.out.println("AppAsyncListener onStartAsync");

          }

       

       

        /**

           * @see AsyncListener#onTimeout(AsyncEvent)

           */

          public void onTimeout(AsyncEvent arg0) throws java.io.IOException {

               // TODO Auto-generated method stub

          System.out.println("AppAsyncListener onComplete");

          ServletResponse response = arg0.getAsyncContext().getResponse();

          PrintWriter out = response.getWriter();

          out.write("Timeout Error in processing");

        

          }

       

      }

       

      Can somebody please help?

       

      TIA