Sending mail with attachements fails
------------------------------------

                 Key: SMX4KNL-240
                 URL: https://issues.apache.org/activemq/browse/SMX4KNL-240
             Project: ServiceMix Kernel
          Issue Type: Bug
    Affects Versions: 1.1.0
         Environment: servicemix-kernel-1.1.0-SNAPSHOT compiled on 2009-03-12
using camel features with CAMEL-2.0-SNAPSHOT from apache snapshot repository
            Reporter: Nicolas Bouillon


I'm trying to use this kind of camel route :
<from uri=activemq:queue:errorQueue"/>
<camel:process ref="errorMailProcessor" />
<to uri="smtp://localhost:25?to=nbouil...@localhost" />

i attach a text/plain to the message to have an mail attachement.

    @Override
    public void process(Exchange exchange) throws Exception {

....
// tried this first :
// exchange.getIn().addAttachment("message.txt",
//                new DataHandler(messageText, "text/plain"));

// then tried that :

        exchange.getIn().addAttachment(
                "message.txt",
                new DataHandler(new ByteArrayDataSource(messageText
                        .getBytes(), "text/plain")));
....        


    }

When running in a standalone Camel, it works like a charm. When running inside 
ServiceMix 4 Kernel, i got the following exception ;

s...@root:osgi> log/de
org.apache.camel.RuntimeCamelException: 
org.springframework.mail.MailSendException; nested exceptions (1) are:
Failed message 1: javax.mail.MessagingException: IOException while sending 
message;                           
  nested exception is:                                                          
                              
        javax.activation.UnsupportedDataTypeException: no object DCH for MIME 
type multipart/mixed;           
        boundary="----=_Part_48_30413667.1236949944343"                         
                              
        at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:878)
                
        at 
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81)
  
        at 
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
        at 
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
  
        at 
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
        at 
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
        at 
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
  
        at 
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
        at 
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:881)
           
        at java.lang.Thread.run(Thread.java:619)                                
                                                                                
Caused by: org.springframework.mail.MailSendException; nested exceptions (1) 
are:                                                                            
   
Failed message 1: javax.mail.MessagingException: IOException while sending 
message;                                                                        
     
  nested exception is:                                                          
                                                                                
        javax.activation.UnsupportedDataTypeException: no object DCH for MIME 
type multipart/mixed;                                                           
  
        boundary="----=_Part_48_30413667.1236949944343"                         
                                                                                
        at 
org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:422)
                                                             
        at 
org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:342)
                                                               
        at 
org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:357)
                                                               
        at 
org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346)
                                                               
        at 
org.apache.camel.component.mail.MailProducer.process(MailProducer.java:46)      
                                                                     
        at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:68)         
                                                                     
        at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:49)
                                                                  
        at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:78) 
                                                                     
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:115)
                                                           
        at 
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
             
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)       
                                                                                
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)        
                                                                                
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
                                                                     
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:57)        
                                                                                
        at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:49)
        at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:78)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:115)
        at 
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:191)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:91)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:83)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:69)
        at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:49)
        at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:78)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:115)
        at 
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
        at 
org.apache.camel.processor.DeadLetterChannel.deliverToFaultProcessor(DeadLetterChannel.java:337)
        at 
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:167)
        at 
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:129)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:55)
        at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:49)
        at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:78)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:115)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:91)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:83)
        at 
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:65)
        at 
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:72)
        ... 8 more


The bundle i have are :
s...@root:osgi> list
START LEVEL 100    
   ID   State         Spring     Level  Name
[   0] [Active     ] [       ] [    0] System Bundle (1.5.0.r750407)
[   1] [Active     ] [       ] [   10] Apache Felix Prefrences Service (1.0.2)
[   2] [Active     ] [       ] [   10] geronimo-annotation_1.0_spec (1.1.1)   
[   3] [Active     ] [       ] [   10] OSGi R4 Compendium Bundle (4.1.0)      
[   4] [Active     ] [       ] [   10] Apache ServiceMix Bundles: jaxp-ri-1.4.2 
(1.4.2.1)
[   5] [Active     ] [       ] [   10] Apache Felix Configuration Admin Service 
(1.0.4)  
[   6] [Active     ] [       ] [   10] geronimo-servlet_2.5_spec (1.1.2)        
         
[   7] [Active     ] [       ] [   10] Apache ServiceMix Specs :: JAXP API 1.4 
(1.2.0)   
[   8] [Active     ] [Started] [   40] Apache ServiceMix Kernel :: GShell Core 
(1.1.0.SNAPSHOT)
[   9] [Active     ] [       ] [    8] OPS4J Pax Logging - API (1.3.0)          
               
[  10] [Active     ] [       ] [    8] OPS4J Pax Logging - Service (1.3.0)      
               
[  11] [Active     ] [       ] [    5] OPS4J Pax Url - wrap: (0.3.3)            
               
[  12] [Active     ] [       ] [    5] OPS4J Pax Url - mvn: (0.3.3)             
               
[  13] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: JAAS Modules 
(1.1.0.SNAPSHOT)
[  14] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: GShell 
Features (1.1.0.SNAPSHOT)
[  15] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: GShell Admin 
(1.1.0.SNAPSHOT)   
[  16] [Active     ] [       ] [   30] spring-osgi-io (1.2.0.m2)                
                   
[  17] [Active     ] [       ] [   30] Apache ServiceMix Bundles: mina-1.1.7 
(1.1.7.1)             
[  18] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: GShell 
PackageAdmin Commands (1.1.0.SNAPSHOT)
[  19] [Active     ] [       ] [   30] Apache ServiceMix Kernel :: GShell 
ConfigAdmin Commands (1.1.0.SNAPSHOT) 
[  20] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: GShell OSGi 
Commands (1.1.0.SNAPSHOT)        
[  21] [Active     ] [       ] [   30] Spring Context (2.5.6)                   
                                
[  22] [Active     ] [       ] [   30] Apache ServiceMix Bundles: 
commons-jexl-1.1 (1.1.0.1)                    
[  23] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: JAAS Config 
(1.1.0.SNAPSHOT)                 
[  24] [Active     ] [       ] [   30] Apache ServiceMix Bundles: 
commons-httpclient-3.1 (3.1.0.1)              
[  25] [Active     ] [       ] [   30] Spring Core (2.5.6)                      
                                
[  26] [Active     ] [       ] [   30] jmx-impl (1.0.0.r6125-patched)           
                                
[  27] [Active     ] [       ] [   30] jmx (1.0.0.r6125-patched)                
                                
[  28] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: GShell Log 
Commands (1.1.0.SNAPSHOT)         
[  29] [Active     ] [       ] [   30] Apache ServiceMix Bundles: 
commons-vfs-1.0 (1.0.0.1)                     
[  30] [Active     ] [       ] [   30] Spring Beans (2.5.6)                     
                                
[  31] [Active     ] [       ] [   30] Unnamed - 
com.google.code.sshd:sshd:bundle:0.1 (0.1)                     
[  32] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: Management 
(1.1.0.SNAPSHOT)                  
[  33] [Active     ] [       ] [   30] Apache ServiceMix Bundles: 
commons-codec-1.2 (1.2.0.1)                   
[  34] [Active     ] [       ] [   30] spring-osgi-extender (1.2.0.m2)          
                                
[  35] [Active     ] [       ] [   30] Apache ServiceMix Bundles: cglib-2.1_3 
(2.1.0.3_1)                       
[  36] [Active     ] [       ] [   30] Apache ServiceMix Bundles: jline-0.9.94 
(0.9.94.1)                       
[  37] [Active     ] [       ] [   30] Apache ServiceMix Bundles: 
aopalliance-1.0 (1.0.0.1)                     
[  38] [Active     ] [       ] [   30] Spring AOP (2.5.6)                       
                                
[  39] [Active     ] [Started] [   30] Apache ServiceMix Kernel :: Spring 
Deployer (1.1.0.SNAPSHOT)             
[  40] [Active     ] [       ] [   30] Apache ServiceMix Bundles: oro-2.0.8 
(2.0.8.1)                           
[  41] [Active     ] [       ] [   30] spring-osgi-core (1.2.0.m2)              
                                
[  42] [Active     ] [       ] [   15] Apache ServiceMix Kernel :: File Monitor 
(1.1.0.SNAPSHOT)                
[  43] [Active     ] [       ] [   60] Apache ServiceMix Specs :: JAXB API 2.1 
(1.2.0)                          
[  44] [Active     ] [       ] [   60] Apache ServiceMix Specs :: ACTIVATION 
API 1.4 (1.2.0)                    
[  45] [Active     ] [       ] [   60] camel-core (2.0.0.SNAPSHOT)              
                                
[  46] [Active     ] [       ] [   60] camel-osgi (2.0.0.SNAPSHOT)              
                                
[  47] [Active     ] [       ] [   60] geronimo-jta_1.1_spec (1.1.1)            
                                
[  48] [Active     ] [       ] [   60] Spring Transaction (2.5.6)
[  49] [Active     ] [       ] [   60] camel-spring (2.0.0.SNAPSHOT)
[  50] [Active     ] [       ] [   60] Spring JMS (2.5.6)
[  51] [Active     ] [       ] [   60] camel-jms (2.0.0.SNAPSHOT)
[  52] [Active     ] [       ] [   60] geronimo-jms_1.1_spec (1.1.1)
[  53] [Active     ] [       ] [   60] geronimo-j2ee-management_1.1_spec (1.0.1)
[  54] [Active     ] [       ] [   60] geronimo-j2ee-connector_1.5_spec (2.0.0)
[  55] [Active     ] [       ] [   60] Apache Commons Pool Bundle (1.4)
[  56] [Active     ] [       ] [   60] xbean-spring (3.4.3)
[  57] [Active     ] [       ] [   60] activemq-core (5.2.0)
[  58] [Active     ] [       ] [   60] activemq-ra (5.2.0)
[  59] [Active     ] [       ] [   60] activemq-console (5.2.0)
[  60] [Active     ] [       ] [   60] activemq-pool (5.2.0)
[  61] [Active     ] [       ] [   60] activemq-camel (5.2.0)
[  62] [Active     ] [Started] [   60] Apache ServiceMix Features :: ActiveMQ 
Commands (4.0.0.m2-SNAPSHOT)
[  63] [Active     ] [       ] [   60] Apache Commons Collections (3.2.0)
[  64] [Active     ] [       ] [   60] camel-mail (2.0.0.SNAPSHOT)
[  65] [Active     ] [       ] [   60] Apache ServiceMix Specs :: JAVAMAIL API 
1.4 (1.2.0)
[  66] [Active     ] [       ] [   60] Java Mail (1.4.1)
[  67] [Active     ] [       ] [   60] Spring Context Support (2.5.6)
[  69] [Active     ] [       ] [   60] Component Requests (0.0.1.SNAPSHOT)
[  71] [Active     ] [       ] [   60] Apache ServiceMix Bundles: 
jaxb-impl-2.1.6 (2.1.6.1)
[  75] [Active     ] [Started] [   60] netcom.server.core (1.0.0.SNAPSHOT)
[  77] [Active     ] [       ] [   60] camel-mina (2.0.0.SNAPSHOT)
[  78] [Active     ] [       ] [   60] mvn:org.apache.mina/mina-core/1.1.7
[  79] [Active     ] [Started] [   60] netcom.server.restena.epp 
(1.0.0.SNAPSHOT)
[  81] [Active     ] [       ] [   60] Java Activation API (1.1.0)
[  82] [Active     ] [       ] [   60] Apache ServiceMix Bundles: 
geronimo-javamail_1.4_provider-1.6 (1.6.0.1)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to