-
Bug
-
Resolution: Unresolved
-
Major
-
7.4.20.GA
-
None
-
False
-
None
-
False
-
-
-
-
-
-
-
-
When call a getHeaders/handleFault/close method in soap handler with the CDI bean invocation, IllegalStateException has been thrown since JBoss EAP 7.4.19. It works until JBoss EAP 7.4.18. This issue is essentially the same as JBEAP-28310. This issue asks to fix thread context classloader during execution of getHeaders/handleFault/close methods. This behavior may be a regression issue.
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(); // it works 7.4.0 to 7.4.18 and 7.4.21+ // As a workaround, set TCCL to application module class loader for JBEAP-28311, fixed in JBoss EAP 7.4.21 // 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(); // In 7.4.19+, java.lang.IllegalStateException: Unable to access CDI // the same workaround for JBEAP-28310 is available // 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(); // In 7.4.19+, java.lang.IllegalStateException: Unable to access CDI } @Override public void close(MessageContext messageContext) { LOG.info("### TCCL in SOAPHandler.close = " + Thread.currentThread().getContextClassLoader().toString()); new DelegateBean(); // In 7.4.19+, java.lang.IllegalStateException: Unable to access CDI } }
DelegateBean.java
@Dependent public class DelegateBean { EmptyBean logic = CDI.current().select(EmptyBean.class).get(); }
- clones
-
JBEAP-28791 [GSS](8.0.z) Sever throws IllegalStateException when call a getHeaders/handleFault/close in soap handler with the CDI bean invocation
- New