Error in java api service: Could not find deployment

78 Views Asked by At

I updated my java api service which was using Open Liberty 23.0.0.9 to use Open Liberty 23.0.0.11 However after the update, my java service can sometimes crash upon receiving too many requests at the same time, and logs:

Could not find deployment

Here is a more detailed info about the crash:

java.lang.IllegalStateException: Could not find deployment
       at com.ibm.ws.cdi.impl.AbstractCDIRuntime.getCDI(AbstractCDIRuntime.java:162)
       at javax.enterprise.inject.spi.CDI.current(CDI.java:64)
       at com.comp.myHandlers.component.jaxws.server.handler.HeaderInboundHandler.processInbound(HeaderInboundHandler.java:76)
       at com.comp.myHandlers.component.jaxws.server.handler.HeaderInboundHandlerBase.handleMessage(HeaderInboundHandlerBase.java:88)
       at com.comp.myHandlers.component.jaxws.server.handler.HeaderInboundHandlerBase.handleMessage(HeaderInboundHandlerBase.java:26)
       at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandleMessage(HandlerChainInvoker.java:355)
       at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandlerChain(HandlerChainInvoker.java:254)
       at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeProtocolHandlers(HandlerChainInvoker.java:131)
       at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessageInternal(SOAPHandlerInterceptor.java:174)
       at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:129)
       at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:78)
       at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
       at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:127)
       at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:278)
       at com.ibm.ws.jaxws.endpoint.AbstractJaxWsWebEndpoint$1.run(AbstractJaxWsWebEndpoint.java:238)
       at com.ibm.ws.jaxws.endpoint.AbstractJaxWsWebEndpoint$1.run(AbstractJaxWsWebEndpoint.java:235)
       at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
       at com.ibm.ws.jaxws.endpoint.AbstractJaxWsWebEndpoint.invoke(AbstractJaxWsWebEndpoint.java:235)
       at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.handleRequest(LibertyJaxWsServlet.java:136)
       at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.doPost(LibertyJaxWsServlet.java:95)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:706)
       at com.ibm.ws.jaxws.webcontainer.LibertyJaxWsServlet.service(LibertyJaxWsServlet.java:87)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1260)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:748)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:445)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:197)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:100)
       at com.ibm.ws.security.jaspi.JaspiServletFilter.doFilter(JaspiServletFilter.java:58)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:203)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:93)
       at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1068)
       at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1259)
       at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1077)
       at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:77)
       at com.ibm.ws.webcontainer40.servlet.CacheServletWrapper40.handleRequest(CacheServletWrapper40.java:87)
       at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:969)
       at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:293)
       at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:1259)
       at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:475)
       at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:434)
       at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:569)
       at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:503)
       at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:363)
       at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:330)
       at com.ibm.ws.channel.ssl.internal.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1135)
       at com.ibm.ws.channel.ssl.internal.SSLConnectionLink.readyInboundPostHandshake(SSLConnectionLink.java:768)
       at com.ibm.ws.channel.ssl.internal.SSLConnectionLink$MyHandshakeCompletedCallback.complete(SSLConnectionLink.java:439)
       at com.ibm.ws.channel.ssl.internal.SSLUtils.handleHandshake(SSLUtils.java:959)
       at com.ibm.ws.channel.ssl.internal.SSLHandshakeIOCallback.complete(SSLHandshakeIOCallback.java:87)
       at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:516)
       at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:586)
       at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:970)
       at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1059)
       at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:280)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
       at java.base/java.lang.Thread.run(Thread.java:1583)

I believe there is something wrong with CDI.current().select(JsonWebToken.class).get() in my JWT handler that I use:

public class JWTTokenForwardingHandler implements SOAPHandler<SOAPMessageContext>, ServiceContextAware {

   protected Map<String, Object> serviceContext;
   protected static final MyLogger log = My.getLoggerManager().getLogger(JWTTokenForwardingHandler.class);

   @Override
   public Set<QName> getHeaders() {
      return null;
   }

   @SuppressWarnings("unchecked")
   @Override
   public boolean handleMessage(final SOAPMessageContext context) {
      final Boolean isOutbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
      if (isOutbound) {
         try {
            final JsonWebToken jwt = CDI.current().select(JsonWebToken.class).get();

            if (jwt != null) {
               Map<String, List<String>> requestHeaders = (Map<String, List<String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS);
               if (requestHeaders == null) {
                  requestHeaders = new HashMap<>();
               }
               ....
            }
         } catch (final Exception e) {
            Logger.getLogger(this.getClass().getName()).log(Level.FINE, "No JWT in CDI context, nothing to forward", e);
         }
      }
      return true;
   }

   @Override
   public boolean handleFault(final SOAPMessageContext context) {
      return false;
   }

   @Override
   public void close(final MessageContext context) {

   }

   @Override
   public void setServiceContext(Map<String, Object> ctx) {
      this.serviceContext = ctx;
   }
}

However I am not sure and I wonder if anyone else had this issue or know how to solve it without rolling back the Open Liberty version?

1

There are 1 best solutions below

0
Benjamin Confino On

I'm afraid I think this is a bug in our end. There's only so much I can say from just a stack, but one of those things is that your CDI code is fine and should not throw this error.

Please could you open an issue on open liberty and attach the JAX-WS traces, you will find instructions for doing so here: https://www.ibm.com/support/pages/mustgather-jax-wsjax-rpc-web-services-engine-problems-websphere-application-server under the Collect Data for Liberty

Thank you