Closed ihudedi closed 2 years ago
Hi @phax Did you see this issue? Thanks, Itay
Hi @phax Do you have any updates for this issue? Thanks, Itay
@ihudedi do I understand you correctly: the problem is, that the AS2DispositionException
that is converted to the MDN is not your AS2DispositionException
but the "generic" one created by the handler, correct? If yes, I added some exceptions now, that keep the original AS2DispositionException
- that should solve the issue, right?
Hi @phax, Yes.so after your fix when I throw as2dispositionexception it will return with the correct message in mdn? Thanks, Itay
Yes, I hope so - with the above commit I am just avoiding, that existing AS2DispositionException
get wrapped again in other AS2DispositionException
.
I will create a 4.9.2 release and you can try it out.
4.9.2 is out. @ihudedi please verify that it works as expected.
Hi @phax It still not working In AS2ReceiverHandle::handleIncomingMessage you added the below code: catch (final AS2DispositionException ex) { // Re-throw "as is" throw ex; // and it goes to the next catch - you should handle the AS2DispotionException in AS2Exception catch } catch (final AS2Exception ex) { throw new AS2DispositionException (DispositionType.createError ("authentication-failed"), AbstractActiveNetModule.DISP_PARTNERSHIP_NOT_FOUND, ex); }
@ihudedi no, that is not the case. two consecutive catch blocks cannot comminicate with each other. I check the callers.
To my understand, the exception thrown in line 669 https://github.com/phax/as2-lib/blob/master/as2-lib/src/main/java/com/helger/as2lib/processor/receiver/net/AS2ReceiverHandler.java#L669 is caught in line 738 https://github.com/phax/as2-lib/blob/master/as2-lib/src/main/java/com/helger/as2lib/processor/receiver/net/AS2ReceiverHandler.java#L738
Can you please elaborate, what issue you are facing with 4.9.2?
Same issue as wrote above.
Can you please post the updated stack trace - that would really help me
Hi @phax I finally found the issue In AbstractMessageProcessor ::executeAction this is the code::
if (aCauses.isNotEmpty ()) throw new AS2ProcessorException (this, aCauses); --> here in the aCauses I have the AS2DispositionException but you wrap it in AS2ProcessorException and in AS2RecieverHandler I am getting the unexpected-processing-error. Please add block catch for AS2ProcessorException when the aCause has disposirionException
This is the stack trace
2022-01-04 03:55:08,472 INFO [http-nio-10086-exec-3] (AS2ReceiverHandler:472) - sent MDN [automatic-action/MDN-sent-automatically; processed/Error: unexpected-processing-error] 127.0.0.1:55776 [
Please try release 4.10.0 - https://github.com/phax/as2-lib/releases/tag/as2-lib-parent-pom-4.10.0
Hi @phax It solved the issue. Thanks a lot, Itay
Hi @phax When using servlet and throw disposition error like this: throw new AS2DispositionException(DispositionType.createError("authentication-failed")).setText("User must change his password. Please contact the administrator");
The disposition the return in the MDN is like this and not as sent: DISPOSITION: automatic-action/MDN-sent-automatically; processed/Error: unexpected-processing-error
If you see in the log the correct error is sent but you wrap it in generic message and remove the text that we added
2021-11-03 12:06:44,228 DEBUG [http-nio-10086-exec-6] (AbstractMessageProcessor:202) - action 'storemdn' was handled by modules [[com.bmc.ctm.mft.b2b.hub.as2.module.MftMDNFileModule@3b40d50f]] 2021-11-03 12:06:44,229 INFO [http-nio-10086-exec-6] (AS2ReceiverHandler:471) - sent MDN [automatic-action/MDN-sent-automatically; processed/Error: unexpected-processing-error] 10.63.24.213:52211 []
2021-11-03 12:06:44,229 INFO [http-nio-10086-exec-6] (AS2Exception:124) - as2-lib 4.7.1 AS2DispositionException terminated: automatic-action/MDN-sent-automatically; processed/Error: unexpected-processing-error; source msg: []
com.helger.as2lib.processor.AS2ProcessorException: Processor 'DefaultMessageProcessor' threw exception:
com.helger.as2lib.disposition.AS2DispositionException: automatic-action/MDN-sent-automatically; processed/Error: authentication-failed
1.: com.bmc.ctm.mft.b2b.hub.as2.utils.As2ServerUtils.checkBaseAuthentication(As2ServerUtils.java:143)
2.: com.bmc.ctm.mft.b2b.hub.as2.module.HubAs2MessageFileModule.handle(HubAs2MessageFileModule.java:41)
3.: com.helger.as2lib.processor.AbstractMessageProcessor.executeAction(AbstractMessageProcessor.java:178)
4.: com.helger.as2lib.processor.DefaultMessageProcessor.handle(DefaultMessageProcessor.java:65)
5.: com.helger.as2lib.processor.receiver.net.AS2ReceiverHandler.handleIncomingMessage(AS2ReceiverHandler.java:649)
6.: com.bmc.ctm.mft.b2b.hub.as2.handler.As2MftReceiverHandler.handleIncomingMessage(As2MftReceiverHandler.java:36)
7.: com.helger.as2servlet.AbstractAS2ReceiveXServletHandler.handeIncomingMessage(AbstractAS2ReceiveXServletHandler.java:147)
8.: com.bmc.ctm.mft.b2b.hub.as2.servlet.AS2ServletCodeConfig.handeIncomingMessage(AS2ServletCodeConfig.java:63)
9.: com.helger.as2servlet.AbstractAS2ReceiveBaseXServletHandler.onRequest(AbstractAS2ReceiveBaseXServletHandler.java:230)
10.: com.helger.xservlet.AbstractXServlet._invokeHandler(AbstractXServlet.java:345)
11.: com.helger.xservlet.AbstractXServlet.service(AbstractXServlet.java:529)
12.: javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
13.: com.helger.xservlet.AbstractXServlet.service(AbstractXServlet.java:583)
[88 elements omitted -- org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)]
at com.helger.as2lib.processor.AbstractMessageProcessor.executeAction(AbstractMessageProcessor.java:192) ~[as2-lib-4.7.1.jar!/:4.7.1]
at com.helger.as2lib.processor.DefaultMessageProcessor.handle(DefaultMessageProcessor.java:65) ~[as2-lib-4.7.1.jar!/:4.7.1]
at com.helger.as2lib.processor.receiver.net.AS2ReceiverHandler.handleIncomingMessage(AS2ReceiverHandler.java:649) [as2-lib-4.7.1.jar!/:4.7.1]
at com.bmc.ctm.mft.b2b.hub.as2.handler.As2MftReceiverHandler.handleIncomingMessage(As2MftReceiverHandler.java:36) [classes!/:?]
at com.helger.as2servlet.AbstractAS2ReceiveXServletHandler.handeIncomingMessage(AbstractAS2ReceiveXServletHandler.java:147) [as2-servlet-4.7.1.jar!/:4.7.1]
at com.bmc.ctm.mft.b2b.hub.as2.servlet.AS2ServletCodeConfig.handeIncomingMessage(AS2ServletCodeConfig.java:63) [classes!/:?]
at com.helger.as2servlet.AbstractAS2ReceiveBaseXServletHandler.onRequest(AbstractAS2ReceiveBaseXServletHandler.java:230) [as2-servlet-4.7.1.jar!/:4.7.1]
at com.helger.xservlet.AbstractXServlet._invokeHandler(AbstractXServlet.java:345) [ph-xservlet-9.6.0.jar!/:9.6.0]
at com.helger.xservlet.AbstractXServlet.service(AbstractXServlet.java:529) [ph-xservlet-9.6.0.jar!/:9.6.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [tomcat-embed-core-9.0.45.jar!/:?]
at com.helger.xservlet.AbstractXServlet.service(AbstractXServlet.java:583) [ph-xservlet-9.6.0.jar!/:9.6.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at com.bmc.ctm.mft.b2b.hub.configuration.http.RequestMethodFilter.doFilter(RequestMethodFilter.java:42) [classes!/:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at com.bmc.ctm.mft.b2b.hub.configuration.http.B2BEnabledFilter.doFilter(B2BEnabledFilter.java:134) [classes!/:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:149) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at com.bmc.ctm.mft.b2b.hub.configuration.http.B2BEnabledFilter.doFilter(B2BEnabledFilter.java:134) [classes!/:?]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at com.bmc.ctm.mft.b2b.hub.configuration.http.RequestMethodFilter.doFilter(RequestMethodFilter.java:42) [classes!/:?]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.debug.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:90) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:78) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:67) [spring-security-web-5.4.6.jar!/:5.4.6]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) [spring-web-5.3.6.jar!/:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) [spring-boot-actuator-2.4.5.jar!/:2.4.5]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.3.6.jar!/:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.6.jar!/:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) [tomcat-embed-core-9.0.45.jar!/:?]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.45.jar!/:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.45.jar!/:?]
Thanks, Itay