Hello everybody.
I'm new to the Talend ESB and of course I've read the manuals, but now I'm stuck with a strange behaviour.
I'd like to set up a route consuming files from a SFTP server, transfering them to our server's tmp directory. After each file is transferred, I'd like to send the file as attachment within an email to our mail server. So far so good. 😉
I managed to establish the sftp connection, transfer the files and even send a plain text email with the transferred file name. But as soon as I am trying to create an attachment via an javax.activationDataHandler and passing this object to the Method addAttachment(...) of the outgoing message, the esb console throws an exception:
2011-12-12 12:55:51,580 | ERROR | _transfer/Archiv | DefaultErrorHandler | ache.camel.processor.CamelLogger 232 | 158 - org.apache.camel.camel-cor
e - 2.8.2 | Failed delivery for exchangeId: ID-Q4DE8ISY507-60685-1323690312020-2-17. Exhausted after delivery attempt: 1 caught: org.springframework.mail.MailPreparationException: Could not prepare mail; nested exception is java.lang.ClassCastException: javax.activation.DataHandler cannot be cast to javax.activation.DataHandler
org.springframework.mail.MailPreparationException: Could not prepare mail; nested exception is java.lang.ClassCastException: javax.activation.DataHandler cannot
be cast to javax.activation.DataHandler
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:367)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:344)
at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:44)
...
Caused by: java.lang.ClassCastException: javax.activation.DataHandler cannot be cast to javax.activation.DataHandler
at org.apache.camel.component.mail.MailBinding.addAttachmentsToMultipart(MailBinding.java:427)
at org.apache.camel.component.mail.MailBinding.createMixedMultipartAttachments(MailBinding.java:417)
at org.apache.camel.component.mail.MailBinding.appendAttachmentsFromCamel(MailBinding.java:405)
at org.apache.camel.component.mail.MailBinding.populateMailMessage(MailBinding.java:112)
at org.apache.camel.component.mail.MailProducer$1.prepare(MailProducer.java:46)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:352)
... 41 more
The exception message is: <b>javax.activation.DataHandler cannot be cast to javax.activation.DataHandler</b>
My suggestsion is a conflict between the different "activation.jar" files?! I am stuck with this message since three days and nearly getting nuts. Neither "googling" nor reading and searching other threads and topics did it for me. I searched the Spring Docs, Camel Docs, Karaf Docs and especially the TESB docs.
Maybe it is just a simple "misconfiguration"? It would be nice getting some help from you!
I'm using a java SDK 1.6 Update 29 with the latest stable release of TESB (version 5.0.0). Our server environment consists of a six core AMD Opteron with 16 GB RAM and windows server 2008 os installed.
The attached picture displays the route and the source code of the cProcessor component that i am using to add the attachment.
Thnaks for any repsonses!
Kind regards.
Alexander