camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <christian.ja...@innogy.com>
Subject AW: Error sending email from Camel application
Date Fri, 05 Jan 2018 13:43:36 GMT
Hi Charles,

I'm not sure if I can help you out, but a couple of days ago I had an error with sending multiple
REST requests to a remote server. I aggregated the responses values of each request in a complicated
Map of Map of Maps structure that resided in the Camel header. After a couple of requests,
the http handshake threw an exception. After some debugging I figured out: Camel uses the
complete Camel Header to setup the http header. So the toString() result of my Map of Map
of Maps went into the http request as a header, and that grew too large. What helped me out
was to implement a custom headerFilterStrategy in which I managed to keep all of my custom
header values out of the way.

Maybe this will help you...

Regards,
Christian

-----Urspr√ľngliche Nachricht-----
Von: Charles Berger [mailto:charlesb.yesmail@googlemail.com]
Gesendet: Freitag, 5. Januar 2018 13:30
An: users@camel.apache.org
Betreff: Re: Error sending email from Camel application

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.
----------------------------------------------------------------
innogy SE
Vorsitzender des Aufsichtsrates: Dr. Erhard Schipporeit
Vorstand: Uwe Tigges (Vorsitzender), Dr. Hans Buenting,
Dr. Bernhard Guenther, Martin Herrmann, Hildegard Mueller
Sitz der Gesellschaft: Essen, Eingetragen beim Amtsgericht Essen,
Handelsregister-Nr. HRB 27091, USt-IdNr. DE304171711
Mime
View raw message