Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E672B200CAE for ; Wed, 21 Jun 2017 11:46:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E50FF160BE2; Wed, 21 Jun 2017 09:46:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 37028160BD0 for ; Wed, 21 Jun 2017 11:46:04 +0200 (CEST) Received: (qmail 59943 invoked by uid 500); 21 Jun 2017 09:46:03 -0000 Mailing-List: contact commits-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tomee.apache.org Delivered-To: mailing list commits@tomee.apache.org Received: (qmail 59934 invoked by uid 500); 21 Jun 2017 09:46:03 -0000 Delivered-To: apmail-openejb-commits@openejb.apache.org Received: (qmail 59931 invoked by uid 99); 21 Jun 2017 09:46:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2017 09:46:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 0CB3F1AF993 for ; Wed, 21 Jun 2017 09:46:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id R3IzxABZ-lEq for ; Wed, 21 Jun 2017 09:46:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4FEE65FC3D for ; Wed, 21 Jun 2017 09:46:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7B7C4E00A3 for ; Wed, 21 Jun 2017 09:46:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 397B62193E for ; Wed, 21 Jun 2017 09:46:00 +0000 (UTC) Date: Wed, 21 Jun 2017 09:46:00 +0000 (UTC) From: "antoine vianey (JIRA)" To: commits@openejb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (TOMEE-2071) OpenEJBAsyncContext NPE when using AsyncResponse MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 21 Jun 2017 09:46:05 -0000 antoine vianey created TOMEE-2071: ------------------------------------- Summary: OpenEJBAsyncContext NPE when using AsyncResponse Key: TOMEE-2071 URL: https://issues.apache.org/jira/browse/TOMEE-2071 Project: TomEE Issue Type: Bug Components: TomEE Core Server Affects Versions: 7.0.3, 7.0.2 Reporter: antoine vianey Using the following code works fine with Tomee (mvn tomee:run) and return a 201 OK response along with the location. {code:java} @POST public void post(@Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse, @NotNull @Valid ExpenseDTO expenseDTO) throws ParseException { double amount = NumberFormat.getInstance().parse(expenseDTO.getAmount()).doubleValue(); CompletableFuture cf = supplyAsync(() -> doSomething(), executorService); cf .thenAccept(myBean -> { URI location = uriInfo.getRequestUri().resolve(uriInfo.getPath() + "/" + myBean.getId()); Response response = Response.created(location).build(); asyncResponse.resume(response); }).exceptionally(e -> { logger.error("An Error occurred.", e); asyncResponse.resume(Response.serverError().build()); return null; }); } {code} But when called in tests with OPENEJB EMBEDDED like this : {code:java} Properties p = new Properties(); p.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); p.setProperty(EJBContainer.APP_NAME, "/app"); EJBContainer ejbContainer = EJBContainer.createEJBContainer(p); {code} It fails with this.context being null at (with exceptionnaly not bein called in my method) : java.lang.NullPointerException at org.apache.openejb.server.httpd.OpenEJBAsyncContext.dispatch(OpenEJBAsyncContext.java:230) at org.apache.openejb.server.httpd.OpenEJBAsyncContext.dispatch(OpenEJBAsyncContext.java:223) at org.apache.openejb.server.httpd.OpenEJBAsyncContext.dispatch(OpenEJBAsyncContext.java:218) at org.apache.openejb.server.httpd.EEFilter$AsynContextWrapper.dispatch(EEFilter.java:171) at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.redispatch(Servlet3ContinuationProvider.java:125) at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.resume(Servlet3ContinuationProvider.java:131) at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.doResumeFinal(AsyncResponseImpl.java:96) at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.doResume(AsyncResponseImpl.java:89) at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.resume(AsyncResponseImpl.java:73) at com.engagetech.challenge.service.ExpenseService.lambda$post$1(MyService.java:80) at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656) at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632) at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1595) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) -- This message was sent by Atlassian JIRA (v6.4.14#64029)