Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2161

JBAS014356 exception not thrown for @Asyncronous EJB methods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.0.0.CR1
    • 8.0.0.Alpha4
    • EJB
    • None
    • Hide

      package example;
      @Stateless
      @LocalBean
      public class MyEjb {
      void foo()

      { System.out.println("Hello"); }


      }

      package example;

      @WebServlet("/MyServlet")
      public class MyServlet extends HttpServlet {
      @EJB MyEJb ejb

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

      { ejb.foo(); }


      }

      Show
      package example; @Stateless @LocalBean public class MyEjb { void foo() { System.out.println("Hello"); } } package example; @WebServlet("/MyServlet") public class MyServlet extends HttpServlet { @EJB MyEJb ejb protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ejb.foo(); } }

      If you call an ejb method with default visibility (e.g. from a servlet in the same package), an EJBException with code JBAS014356 is thrown because the method is not public.

      If the method is annotated with @Asynchronous and returns void, the exception is not seen because the interceptor from AsyncFutureInterceptorFactory is used before NotBusinessMethodInterceptor, the exception is thrown in the worker thread instead.

      With a void return, the exception is silently dropped. With a Future<?> return, it will be set as the failure exception on the future rather than being thrown from the call.

      As per the forum reference we need to check the spec, but the validity of the business method should probably be checked before the handoff to the worker thread.

            sdouglas1@redhat.com Stuart Douglas
            rhn-support-jlivings James Livingston (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: