You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by contactreji <co...@gmail.com> on 2013/09/20 10:43:54 UTC

Email Attachments - Adding to Exchange Attachments

Hi 

I am trying to send email with a attachment file.. I am using Spring DSL

The code which I have made for sending email is as follows

*
<setHeader headerName="CC">
            <constant>reji.mathews@wipro.com</constant>
        </setHeader>

        <setHeader headerName="to">
            <constant>om_integration_lowerenv@outotec.com</constant>
        </setHeader>

        <setHeader headerName="from">
            <constant>no_reply@outotec.com</constant>
        </setHeader>

        <setHeader headerName="subject">
            <constant>FUSE QA ALERT : MIKHEEVSKY : ID55 - COPPER IN
CONCENTRATE</constant>
        </setHeader>

        <setBody>
            <simple> Hi This si the message from REJI!!!! Have a great day
</simple>
        </setBody>

        <setHeader headerName="contentType">
            <constant>text/plain</constant>
        </setHeader>

        <multicast>
            <to uri="smtp://smtp.td.local:25?mapMailMessage=true"/>
        </multicast>
*


I want to add the attachement  called "payload.txt"

How can I attache the file in this Camel Email Component? Can somebody help
me with this pleaseee..

I am creating the attachment using java code inside the processor component. 


		PrintWriter writer = new PrintWriter("payload.txt", "UTF-8");
		writer.println("This is the file content");
		writer.close();

If I can add this file to the the exchange form the processor itself, i
guess it should work. But I want to add to the existing exchange itself. Not
create a new exchange..



Reji



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
Hi David

I posted my response for this at
http://camel.465427.n5.nabble.com/Re-Email-Attachments-Adding-to-Exchange-Attachments-td5741847.html

Please let me know if it works

cheers
Reji



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5741849.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by David M Nayagam <da...@wipro.com>.
Hi Regi,

can i have solution for this.

i have created one sample web service and deployed in servicemix 4.5.2. i am
able to get the url and client java using getting response:

i am creating another project to consume the webservice but i am getting
error. Source and error is attached.

-----------------------------
ISimpleWebservice Interface
-----------------------------
package com.webservice.example;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

@WebService
public interface ISimpleWebservice
{
        @WebResult(name="Customer")
        public Customer getCustomer(@WebParam(name="cutomer") Customer
cutomer);
}
-------------------------------------
SimpleWebservice IMPL
-------------------------
package com.webservice.example;

import javax.jws.WebService;

@WebService(endpointInterface = "com.webservice.example.ISimpleWebservice",
serviceName = "ISimpleWebservice")
public class SimpleWebservice implements ISimpleWebservice
{
        public Customer getCustomer(Customer cutomer)
        {
                System.out.println(" Calling IMPL Class......:  "+
cutomer.getName());
                cutomer.setDescription("SUCCESS");
                return cutomer;
        }
}
----------------------------
Customer POJO
--------------------

package com.webservice.example;

public class Customer
{
        String name;
        String description;
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
        public String getDescription() {
                return description;
        }
        public void setDescription(String description) {
                this.description = description;
        }
}
-----------------------------
came-cxf.xml
-------------------
<?xml version="1.0" encoding="UTF-8"?>

<beans
    xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
        xmlns:cxf="http://camel.apache.org/schema/cxf"
        xmlns:soap="http://cxf.apache.org/bindings/soap"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                                               
http://www.springframework.org/schema/beans/spring-beans.xsd
                                                http://cxf.apache.org/jaxws
                                               
http://cxf.apache.org/schemas/jaxws.xsd
                                               
http://camel.apache.org/schema/cxf
                               
http://camel.apache.org/schema/cxf/camel-cxf.xsd
                        http://cxf.apache.org/bindings/soap
                       
http://cxf.apache.org/schemas/configuration/soap.xsd">

   
   
        <jaxws:endpoint id="aSimpleWebservice"
                       
implementor="com.webservice.example.SimpleWebservice"
                       
address="http://localhost:9003/weservice/SimpleWebservice">
                         
    </jaxws:endpoint>

</beans>

--------------------------------------
WSDL FILE
------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://example.webservice.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="ISimpleWebservice"
targetNamespace="http://example.webservice.com/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://example.webservice.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://example.webservice.com/">
<xs:complexType name="getCustomer">
<xs:sequence>
<xs:element minOccurs="0" name="cutomer" type="tns:customer"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="customer">
<xs:sequence>
<xs:element minOccurs="0" name="description" type="xs:string"/>
<xs:element minOccurs="0" name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getCustomerResponse">
<xs:sequence>
<xs:element minOccurs="0" name="customer" type="tns:customer"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getCustomer" nillable="true" type="tns:getCustomer"/>
<xs:element name="getCustomerResponse" nillable="true"
type="tns:getCustomerResponse"/>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="getCustomer">
    <wsdl:part element="tns:getCustomer" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getCustomerResponse">
    <wsdl:part element="tns:getCustomerResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="ISimpleWebservice">
    <wsdl:operation name="getCustomer">
      <wsdl:input message="tns:getCustomer" name="getCustomer">
    </wsdl:input>
      <wsdl:output message="tns:getCustomerResponse"
name="getCustomerResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ISimpleWebserviceSoapBinding"
type="tns:ISimpleWebservice">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getCustomer">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getCustomer">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getCustomerResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ISimpleWebservice">
    <wsdl:port binding="tns:ISimpleWebserviceSoapBinding"
name="SimpleWebservicePort">
      <soap:address
location="http://localhost:9003/weservice/SimpleWebservice"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
--------------------------------------------------------------------
==================
Consmer Projects:
==================

camel-context.xml
--------------------------------------
<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context.xsd
  http://camel.apache.org/schema/spring
                http://camel.apache.org/schema/spring/camel-spring.xsd
                http://camel.apache.org/schema/cxf
                http://camel.apache.org/schema/cxf/camel-cxf.xsd">


  <bean id="enrich" class="com.enricher.Enrich" />
  <cxf:cxfEndpoint id="SimpleWebservice"
    address="http://localhost:9003/weservice/SimpleWebservice"
    wsdlURL="http://localhost:9003/weservice/SimpleWebservice?wsdl"
endpointName="ISimpleWebservice"
    serviceName="ISimpleWebservice"
serviceClass="com.webservice.example.ISimpleWebservice" />
 
       
  <camelContext xmlns="http://camel.apache.org/schema/spring"> 
   
     
    <route>
      <from uri="file://D:/Input?noop=false"/>
       <log message="Name of the client to be created received : "/>
       <bean ref="enrich" method="createCustomer"/>
       <log message="Enrich Crossed.....: "/>
       <to uri="cxf:bean:SimpleWebservice"/>
       <log message="SOAP Response received : ${body}"/>
       <to uri="bean:enrich?method=createCustomer"/>
    </route>
  </camelContext>

</beans>

--------------------
ENRICH
-------------------

package com.enricher;


import org.apache.camel.Body;

public class Enrich
{  
    public Customer createCustomer(@Body Customer customer)
    {
    System.out.println("Comming to Enrich Method...");
    Customer customer2 = new Customer();
    customer2.setDescription("GOOD");
    customer2.setName("ABC");
        return customer2;
    }    
}

-----------------------------------
Customer
-----------
package com.enricher;


public class Customer
{
        String name;
        String description;
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
        public String getDescription() {
                return description;
        }
        public void setDescription(String description) {
                this.description = description;
        }
}
---------------------------

But i am getting Error Like:

org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint: Endpoint[cxf://bean:SimpleWebservice]. Reason:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service
{http://www.springframework.org/schema/beans}ISimpleWebservice.
        at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:395)[101:org.apache.camel.camel-core:2.10.6]
        at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:114)[101:org.apache.camel.camel-core:2.10.6]
=====================================
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find definition for service
{http://www.springframework.org/schema/beans}ISimpleWebservice.
        at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:171)[132:org.apache.cxf.cxf-rt-core:2.6.8]
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:416)[132:org.apache.cxf.cxf-rt-core:2.6.8]
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:538)[132:org.apache.cxf.cxf-rt-core:2.6.8]

*************************************************
Can you let me know what exactly I am doing wrong? I am new to Camel so
facing lot of issues.
I did lot of googling but not able to get it running. Is there any other
approach to consume the webservice.

Thanks in advance !!!!!

Thanks
David
9786495225 



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5741843.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Regi,
  
           If you are using Jboss Fuse Installation you need to reinstall it
again and test your application

Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740087.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Christian Mueller <ch...@gmail.com>.
Contactreji, can you please subscribe to the discussion forum as we describe
here [1]. Otherwise all your mails has to be moderate by the Camel team and
is may missed/delayed.

[1] http://camel.apache.org/discussion-forums.html

Thanks in advance,
Christian 



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5741445.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Christian Müller <ch...@gmail.com>.
You have to remove the ${ESB_HOME}/data directory, if you do this change
afterwards. It's the case for a few config changes after you already
started and stopped the ESB.

Best,
Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Fri, Oct 11, 2013 at 7:35 PM, contactreji <co...@gmail.com> wrote:

> hi
>
> Finally after a lot of struggle and handson, i have a fix here.
>
> We have to comment out *javax.activation;version="1.1", \*  from two places
> inside the file *<Fuse_ESB_Home>/etc/jre.properties* .
>
> There are 2 places where it occurs..
>
> *Very Important: THIS HAS TO BE DONE BEFORE THE FIRST KARAF BOOT. Else this
> fix doesn't work*
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5741368.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
hi

Finally after a lot of struggle and handson, i have a fix here.

We have to comment out *javax.activation;version="1.1", \*  from two places
inside the file *<Fuse_ESB_Home>/etc/jre.properties* .

There are 2 places where it occurs..

*Very Important: THIS HAS TO BE DONE BEFORE THE FIRST KARAF BOOT. Else this
fix doesn't work*



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5741368.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi reggi,

           I don't have any idea on this.Please contact Claus Ibsen for more
details

Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740111.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Reggi,

        Can you tell me your camel route?? so that i can suggest better
solution for this problem


Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740118.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
Hey Bharath!!

Thanks a lot buddy!!!
It works flawlessly !!!

I have done the same in Production and Quality environment. But now I am a
bit concerned  about Production side. It seems like going for a complete
fuse installations could really hurt the customer. They cant afford to loose
service at all.

Could you tell me how can we go about this without affecting the
productions. Above all, we do not have access to production. We need to
explain this to the server administrators to do it step by step..

Is server re installation mandatory? If so could you explain what really
happens when the server is re installed?

Cheers
Reji 



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740105.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Regi,
  
          Please see the below link for more details
http://fusesource.com/forums/thread.jspa?threadID=4131&tstart=0

Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740088.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
Hi Bharath

Thanks a lot for that.

just wanted to point out that my jboss fuse doesn't start up once I
commented the line which you have mentioned. 

I found a similar fix suggested by someone on some blog. But I face issue
starting up the container. It simply hangs up as if its waiting for some
resource/files.

We are wrapped by company proxy. Would it expect some external entities to
be downloaded. That would explain its hung up state on fuse startup.
Can you suggest in this state, what is a way out for the puzzle.

Regards
Reji





--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740078.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Regi,

          It seems to be JRE issue.Please comment the following line in your
etc/jre.properties

javax.activation;version="1.1", \

and delete your data directory or take back up if you want and restart your
Fuse Container


Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5740036.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Christian Müller <ch...@gmail.com>.
Add the attachment only to the in message.

Best,
Christian
Am 23.09.2013 08:18 schrieb "contactreji" <co...@gmail.com>:

> Hi Bharath
>
> I am using Fuse version 2.10.0.fuse-71-047.. Seems like there is some
> serious issue with attaching files..
> I modified my program and added the processor right before the email
> component.
>
> My processor code is as follows
> *
> public class AddAttachment implements Processor{
>
>         @Override
>         public void process(Exchange exchng) throws Exception {
>                 // TODO Auto-generated method stub
>
>                 Message in = exchng.getIn();
>
>         /*      in.addAttachment("payload", new DataHandler(new
> FileDataSource(
>                                 "d:/payload.txt")));*/
>
>                 exchng.getOut().addAttachment("payload.txt", new
> DataHandler(new
> FileDataSource(
>                                 "d:/payload.txt")));
> }
> }
> *
>
> payload.txt is the file which i want to attach and send ..
> Could you suggest.
>
> Reji
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5739972.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
Hi Bharath

I am using Fuse version 2.10.0.fuse-71-047.. Seems like there is some
serious issue with attaching files..
I modified my program and added the processor right before the email
component.

My processor code is as follows
*
public class AddAttachment implements Processor{

	@Override
	public void process(Exchange exchng) throws Exception {
		// TODO Auto-generated method stub
		
		Message in = exchng.getIn();
		
	/*	in.addAttachment("payload", new DataHandler(new FileDataSource(
				"d:/payload.txt")));*/
		
		exchng.getOut().addAttachment("payload.txt", new DataHandler(new
FileDataSource(
				"d:/payload.txt")));
}
}
*

payload.txt is the file which i want to attach and send ..
Could you suggest.

Reji



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5739972.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Regi,

         What version of Fuse ESB you are using??

Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5739868.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by contactreji <co...@gmail.com>.
Hey Bharath
Thanks a lot.. 

I get following exception

*
  nested exception is:
	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
multipart/mixed; 
	boundary="----=_Part_17_708704654.1379674347139"]
org.apache.camel.RuntimeCamelException: javax.mail.MessagingException:
IOException while sending message;
  nested exception is:
	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
multipart/mixed; 
	boundary="----=_Part_17_708704654.1379674347139"
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1271)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:187)[154:org.apache.camel.camel-jms:2.10.0.fuse-71-047]
	at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:108)[154:org.apache.camel.camel-jms:2.10.0.fuse-71-047]
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[153:org.springframework.jms:3.0.7.RELEASE]
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[153:org.springframework.jms:3.0.7.RELEASE]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)[:1.6.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)[:1.6.0_45]
	at java.lang.Thread.run(Unknown Source)[:1.6.0_45]
Caused by: javax.mail.MessagingException: IOException while sending message;
  nested exception is:
	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
multipart/mixed; 
	boundary="----=_Part_17_708704654.1379674347139"
	at
com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1177)[96:javax.mail:1.4.5]
	at
org.apache.camel.component.mail.DefaultJavaMailSender.send(DefaultJavaMailSender.java:124)[241:org.apache.camel.camel-mail:2.10.0.fuse-71-047]
	at
org.apache.camel.component.mail.MailProducer.process(MailProducer.java:49)[241:org.apache.camel.camel-mail:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]
	at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:104)[154:org.apache.camel.camel-jms:2.10.0.fuse-71-047]
	... 11 more
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for
MIME type multipart/mixed; 
	boundary="----=_Part_17_708704654.1379674347139"
	at javax.activation.ObjectDataContentHandler.writeTo(Unknown
Source)[:1.6.0_45]
	at javax.activation.DataHandler.writeTo(Unknown Source)[:1.6.0_45]
	at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485)[96:javax.mail:1.4.5]
	at
javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1773)[96:javax.mail:1.4.5]
	at
com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1121)[96:javax.mail:1.4.5]
	... 49 more
*



--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5739867.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Email Attachments - Adding to Exchange Attachments

Posted by Bharath <bh...@gmail.com>.
Hi Regi,

            "Attachments are not support by all Camel components
The Attachments API is based on the Java Activation Framework and is
generally only used by the Mail API. Since many of the other Camel
components do not support attachments, the attachments could potentially be
lost as they propagate along the route. The rule of thumb, therefore, is to
add attachments just before sending a message to the mail endpoint"

Example:
Message in = exchange.getIn();
in.setBody("Hello World");
in.addAttachment("logo.jpeg", new DataHandler(new
FileDataSource("src/test/data/logo.jpeg")));

For More Details please refer camel mail component
http://camel.apache.org/mail.html


Cheers!!!
Bharath.R




--
View this message in context: http://camel.465427.n5.nabble.com/Email-Attachments-Adding-to-Exchange-Attachments-tp5739863p5739865.html
Sent from the Camel - Users mailing list archive at Nabble.com.