-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
When call a getHeaders/handleFault/close method in soap handler with the CDI bean invocation, IllegalStateException has been thrown since .This issue asks to fix thread context classloader during execution of getHeaders/handleFault/close methods.
public class LoggingHandler implements SOAPHandler<SOAPMessageContext> { private static final Logger LOG = LoggerFactory.getLogger(LoggingHandler.class); @Override public boolean handleMessage(SOAPMessageContext soapMessageContext) { boolean isOutBound = (boolean) soapMessageContext.get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY); if (isOutBound) { LOG.info("### TCCL in SOAPHandler.handleMessage = " + Thread.currentThread().getContextClassLoader().toString()); new DelegateBean(); // As a workaround, set TCCL to application module class loader for // ClassLoader old = Thread.currentThread().getContextClassLoader(); // Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); // new DelegateBean(); // Thread.currentThread().setContextClassLoader(old); } return true; } @Override public Set<QName> getHeaders() { LOG.info("### TCCL in SOAPHandler.getHeaders = " + Thread.currentThread().getContextClassLoader().toString()); new DelegateBean(); // the same workaround // ClassLoader old = Thread.currentThread().getContextClassLoader(); // Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); // new DelegateBean(); // Thread.currentThread().setContextClassLoader(old); return Collections.emptySet(); } @Override public boolean handleFault(SOAPMessageContext soapMessageContext) { LOG.info("### TCCL in SOAPHandler.handleFault = " + Thread.currentThread().getContextClassLoader().toString()); new DelegateBean(); } @Override public void close(MessageContext messageContext) { LOG.info("### TCCL in SOAPHandler.close = " + Thread.currentThread().getContextClassLoader().toString()); new DelegateBean(); } }
DelegateBean.java
@Dependent public class DelegateBean { EmptyBean logic = CDI.current().select(EmptyBean.class).get(); }
- is depended on by
-
JBEAP-28791 [GSS](8.0.z) Sever throws IllegalStateException when call a getHeaders/handleFault/close in soap handler with the CDI bean invocation
- New
- is incorporated by
-
JBEAP-28792 [GSS](7.4.z) JBWS-4444 - Sever throws IllegalStateException when call a getHeaders/handleFault/close in soap handler with the CDI bean invocation
- New