When using SOAP to send a register handling event to the service, the SOAP API returns an OK response, but the application logs show that the handling of the event fails with an exception.
Steps to reproduce:
Send a soap message to the service with the following body:
Expected behavior:
Handles handling event without errors.
Actual behavior:
Following logs shown:
2022-10-01 11:54:29.343 INFO 54823 --- [nio-8080-exec-1] s.c.d.i.m.jms.JmsApplicationEventsImpl : Received handling event registration attempt se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt@7ad887e3[
registrationTime=Sat Oct 01 11:54:29 CEST 2022
completionTime=Sat Jan 01 00:00:00 CET 2022
trackingId=2
voyageNumber=5
type=LOAD
unLocode=AA234
]
2022-10-01 11:54:29.379 ERROR 54823 --- [erContainer#1-1] HandlingEventRegistrationAttemptConsumer : javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) ~[activemq-client-5.15.3.jar:5.15.3]
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:213) ~[activemq-client-5.15.3.jar:5.15.3]
at se.citerus.dddsample.infrastructure.messaging.jms.HandlingEventRegistrationAttemptConsumer.onMessage(HandlingEventRegistrationAttemptConsumer.java:26) ~[classes/:na]
at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:211) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076) [spring-jms-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
Caused by: java.lang.ClassNotFoundException: Forbidden class se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.checkSecurity(ClassLoadingAwareObjectInputStream.java:112) ~[activemq-client-5.15.3.jar:5.15.3]
at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:57) ~[activemq-client-5.15.3.jar:5.15.3]
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1925) ~[na:1.8.0_252]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1808) ~[na:1.8.0_252]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2099) ~[na:1.8.0_252]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1625) ~[na:1.8.0_252]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:465) ~[na:1.8.0_252]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:423) ~[na:1.8.0_252]
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:211) ~[activemq-client-5.15.3.jar:5.15.3]
... 11 common frames omitted
When using SOAP to send a register handling event to the service, the SOAP API returns an OK response, but the application logs show that the handling of the event fails with an exception.
Steps to reproduce:
Expected behavior: Handles handling event without errors.
Actual behavior: Following logs shown: