camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Berger <charlesb.yesm...@googlemail.com>
Subject Re: Error sending email from Camel application
Date Fri, 05 Jan 2018 12:30:00 GMT
The route is taking properties from a POJO and building up a message
to use to send an email.  I add the from, to & subject headers in the
route which are just string values.  The message body is created using
a Velocity template which extracts some values from the POJO.

I included some tracers in the route and here is the info that is
logged by Camel immediately before calling the SMTP endpoint (I've
anonymised some of the data):

2018-01-05 11:42:09,265 []
org.apache.camel.processor.interceptor.Tracer  INFO -
ID-iusa16025-local-1515152339856-0-11 >>> (emailNotifications)
log[body] --> smtp://localhost <<< Pattern:InOnly,
Headers:{breadcrumbId=ID-iusa16025-local-1515152339856-0-11,
Content-Type=application/json, downloadSuccessful=false,
from=noreply@xxx.com, JMSCorrelationID=null,
JMSCorrelationIDAsBytes=null, JMSDeliveryMode=2,
JMSDestination=queue://emailQueue, JMSExpiration=0,
JMSMessageID=ID:iusa16025.local-64140-1515152341226-7:1:2:1:1,
JMSPriority=4, JMSRedelivered=false, JMSReplyTo=null,
JMSTimestamp=1515152529152, JMSType=null, JMSXGroupID=null,
JMSXUserID=null, subject=EDM Image Manager Alert, to=xxx@yyy.com},
BodyType:String, Body:Hi,

Image https://i.xxx.com/zzz.png for template Sample Template failed to
upload to the CDN.

XXX Image Manager team.

The error message logged is this:

2018-01-05 11:42:09,312 []
org.apache.camel.processor.DefaultErrorHandler ERROR - Failed delivery
for (MessageId: ID-iusa16025-local-1515152339856-0-13 on ExchangeId:
ID-iusa16025-local-1515152339856-0-11). Exhausted after delivery
attempt: 1 caught: org.apache.camel.TypeConversionException: Error
during type conversion from type: java.lang.String to the required
type: java.lang.String with value queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer
found for class java.util.Vector$1 and no properties discovered to
create BeanSerializer (to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])

Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor
                                                    Elapsed (ms)
[emailNotifications] [emailNotifications] [activemq://emailQueue
                                                  ] [       153]
[emailNotifications] [convertBodyTo4    ]
[convertBodyTo[com.yesmail.edmimagebridge.model.SingleImageModel]
        ] [         2]
[emailNotifications] [setHeader1        ] [setHeader[subject]
                                                  ] [         0]
[emailNotifications] [setHeader2        ] [setHeader[to]
                                                  ] [         4]
[emailNotifications] [setHeader3        ] [setHeader[from]
                                                  ] [         0]
[emailNotifications] [to9               ] [velocity:errorEmailBody.vm
                                                  ] [       101]
[emailNotifications] [log10             ] [log
                                                  ] [         0]
[emailNotifications] [to10              ] [smtp://localhost
                                                  ] [        46]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.TypeConversionException: Error during type conversion
from type: java.lang.String to the required type: java.lang.String
with value queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer
found for class java.util.Vector$1 and no properties discovered to
create BeanSerializer (to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])

The message suggests that I should disable
SerializationFeature.FAIL_ON_EMPTY_BEANS but I'm not sure how to
achieve that.  I'm researching that just now and I was looking at
doing something like this:

JacksonDataFormat df = new JacksonDataFormat(java.util.Vector.class);
df.disableFeature(SerializationFeature.FAIL_ON_EMPTY_BEANS);

in beforeStart method of my CamelContextLifecycle class.

Mime
View raw message