You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sylvester <sy...@gmail.com> on 2009/01/07 13:13:02 UTC

Problem with the Email binding component

Hi,
I want to make a poller-sender bridge. I have both the sender and the 
poller endpoints in the same xbean. it deploys fine, but when the poller 
gets a message it says:


ERROR - MailComponent                  - Error sending mail...
javax.mail.NoSuchProviderException: invalid provider
        at javax.mail.Session.getTransport(Session.java:704)
        at javax.mail.Session.getTransport(Session.java:651)
        at javax.mail.Session.getTransport(Session.java:631)
        at 
org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
rEndpoint.java:105)

followed by

[Fatal Error] :-1:-1: Premature end of file.
ERROR - MailComponent                  - Error processing exchange InOnly[
  id: ID:192.168.4.75-11eb0fb036d-14:0
  status: Active
  role: provider
  service: {http://test2}myMailService3
  endpoint: senderEndpoint123
  in: Unable to display: org.xml.sax.SAXParseException: Premature end of 
file.
]
javax.mail.NoSuchProviderException: invalid provider
        at javax.mail.Session.getTransport(Session.java:704)

The above info is correct, so the target service is being invoked 
correctly. What could be the problem?

Thanks,
Sylvester


Re: Problem with the Email binding component

Posted by Sylvester Steele <sy...@gmail.com>.
Thanks! that did the trick! It works fine now.
-- 
View this message in context: http://www.nabble.com/Problem-with-the-Email-binding-component-tp21330046p21432749.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with the Email binding component

Posted by Lars Heinemann <lh...@apache.org>.
I suggest you take a look at the MEP logic in the JBI specification.
On success the InOnly will be answered with a DONE.

Regards
Lars


2009/1/13 Sylvester Steele <sy...@gmail.com>:
>
> I do have a doubt however. Why is the DONE receipt coming back to my SU when
> I am using the in-only pattern?
>
>
> lhein wrote:
>>
>> Sylvester,
>>
>> looking at the ERROR message I think your problem is in your bean
>> message handling.
>>
>>> ERROR - BeanComponent                  - Error processing exchange
>>> InOnly[
>>>  id: ID:192.168.2.79-11eca8c7aa4-2:9
>>>  status: Done
>>>  role: consumer
>>>  interface: {http://test2}myMailService3
>>>  service: {http://test2}myMailService3
>>>  endpoint: senderEndpoint123
>>
>> This is the DONE receipt of your mail sender sent back to your bean
>> component after sending the mail successfully.
>> The problem seems to be that you take this receipt and send again a
>> message to the sender.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-with-the-Email-binding-component-tp21330046p21434256.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
http://lhein.blogspot.com

Re: Problem with the Email binding component

Posted by Sylvester Steele <sy...@gmail.com>.
I do have a doubt however. Why is the DONE receipt coming back to my SU when
I am using the in-only pattern? 


lhein wrote:
> 
> Sylvester,
> 
> looking at the ERROR message I think your problem is in your bean
> message handling.
> 
>> ERROR - BeanComponent                  - Error processing exchange
>> InOnly[
>>  id: ID:192.168.2.79-11eca8c7aa4-2:9
>>  status: Done
>>  role: consumer
>>  interface: {http://test2}myMailService3
>>  service: {http://test2}myMailService3
>>  endpoint: senderEndpoint123
> 
> This is the DONE receipt of your mail sender sent back to your bean
> component after sending the mail successfully.
> The problem seems to be that you take this receipt and send again a
> message to the sender.
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-the-Email-binding-component-tp21330046p21434256.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with the Email binding component

Posted by Lars Heinemann <lh...@apache.org>.
Sylvester,

looking at the ERROR message I think your problem is in your bean
message handling.

> ERROR - BeanComponent                  - Error processing exchange InOnly[
>  id: ID:192.168.2.79-11eca8c7aa4-2:9
>  status: Done
>  role: consumer
>  interface: {http://test2}myMailService3
>  service: {http://test2}myMailService3
>  endpoint: senderEndpoint123

This is the DONE receipt of your mail sender sent back to your bean
component after sending the mail successfully.
The problem seems to be that you take this receipt and send again a
message to the sender.

Please do the following:
In your process() method you need to distinguish between the
ExchangeStatus of the message exchange. So you should check in that
method if the exchange you received is still active or just a DONE,
ERROR or FAULT.

Use some snippet like this:

if (exchange.getStatus() == ExchangeStatus.DONE) {
   // this message exchange is a DONE receipt from a service I called
(here the mail sender)
   // do whatever you need to do here
   return;
} else if (exchange.getStatus() == ExchangeStatus.ERROR) {
   // this message exchange is an ERROR message from the mail sender
because it was unable to send the mail
   // do whatever you need to do here
   return;
} else if (exchange.getFault() != null) {
   // this is a fault message
   exchange.setStatus(ExchangeStatus.DONE);
   channel.send(exchange);
} else {
   // this is a message from the mail poller. the exchange status is ACTIVE

   QName name= new QName("http://test2","myMailService3" ); //this is the sender
   MessageExchange exchange2 =
channel.createExchangeFactory(name).createInOnlyExchange();
   MessageUtil.transferInToIn(exchange, exchange2);
   exchange2.setService(name);

   System.out.println("Sending exchange to sender endpoint");
   // you use send here which is asynchron...that means it will not
block here until the exchange was
   // processed by the target service...the DONE or ERROR will be
processed later also with this method
   // if you use sendSync, it will block here and no DONE or ERROR
will reenter this method. you can check the
   // exchange right after the call to sendSync for the result
   channel.send(exchange2);
   System.out.println("Sent exchange to sender endpoint");

   exchange.setStatus(ExchangeStatus.DONE); //the poller
   System.out.println("Sending exchange to usual endpoint");
   channel.send(exchange);
   System.out.println("Sent exchange to usual endpoint");
}

The other possibility would be the below code (here you could leave
the checks from above away):

   QName name= new QName("http://test2","myMailService3" ); //this is the sender
   MessageExchange exchange2 =
channel.createExchangeFactory(name).createInOnlyExchange();
   MessageUtil.transferInToIn(exchange, exchange2);
   exchange2.setService(name);

   System.out.println("Sending exchange to sender endpoint");
   if (channel.sendSync(exchange2)) {
      // the exchange was sent and the answer received
      if (exchange2.getStatus() != ERROR) {
         System.out.println("Sent exchange to sender endpoint");
         exchange.setStatus(ExchangeStatus.DONE); //the poller
         System.out.println("Sending exchange to usual endpoint");
         channel.send(exchange);
         System.out.println("Sent exchange to usual endpoint");
      } else {
         // the mail sender was not able to send the mail
         // so also set the original exchange to error
         System.out.println("Received error from the mail sender...");
         exchange.setError(exchange2.getError());
         exchange.setStatus(ExchangeStatus.ERROR);
         channel.send(exchange);
      }
   } else {
      // the mail sender was not able to send the mail
      // so also set the original exchange to error
      System.out.println("Unable to contact the mail sender...");
      exchange.setError(exchange2.getError());
      exchange.setStatus(ExchangeStatus.ERROR);
      channel.send(exchange);
   }

Hope this helps.

Regards
Lars











2009/1/13 Sylvester Steele <sy...@gmail.com>:
>
> Hi,
> I seem to be running into the same date parse exception with the
>
> Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint
>
> approach when I use the 2008.01 version. I tried setting the required
> properties to null / not setting to null either way I got the Date parse
> exception.
>
>
>
>
>
> When I used the 2008.02 I get: (summary at end)
>
> ERROR - BeanComponent                  - Error processing exchange InOnly[
>  id: ID:192.168.2.79-11eca8c7aa4-2:9
>  status: Done
>  role: consumer
>  interface: {http://test2}myMailService3
>  service: {http://test2}myMailService3
>  endpoint: senderEndpoint123
>  in: Unable to display: org.xml.sax.SAXParseException: Content is not
> allowed i
> n prolog.
> ]
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>        at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(Me
> ssageExchangeImpl.java:614)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(Delive
> ryChannelImpl.java:386)
>
> If I set the mentioned properties to null I get the above exception and the
> sender emails repeatedly.
> If I do not set the mentioned properties to null I get the above exception
> but no email is sent.
>
>
> Relevant bits from my Bean SU:
>
>
> Setting properties to null:
>
>   message.setProperty("org.apache.servicemix.mail.from", null);
>        message.setProperty("org.apache.servicemix.mail.to", null);
>        message.setProperty("org.apache.servicemix.mail.cc", null);
>        message.setProperty("org.apache.servicemix.mail.bcc", null);
>        message.setProperty("org.apache.servicemix.mail.replyto", null);
>
> Sending exchange to poller and sender:
>
>
>  QName name= new QName("http://test2","myMailService3" ); //this is the
> sender
>
>        MessageExchangeFactory
> messageExchangeFactory=channel.createExchangeFactory(name);
>        MessageExchange exchange2=
> messageExchangeFactory.createInOnlyExchange();
>        MessageUtil.transferInToIn(exchange, exchange2);
>        exchange2.setService(name);
>
>        System.out.println("Sending exchange to sender endpoint");
>        channel.send(exchange2);
>        System.out.println("Sent exchange to sender endpoint");
>
>
>        exchange.setStatus(ExchangeStatus.DONE); //the poller
>        System.out.println("Sending exchange to usual endpoint");
>        channel.send(exchange);
>        System.out.println("Sent exchange to usual endpoint");
>
>
> Summary:
>
> using 2008.01- no email sent
> using 2008.02- repeated email + exception if properties set to null in the
> Bean SU. Exception but no email if properties not set to null.
>
> What am I missing here?
>
> Thanks,
> Sylvester
>
>
> lhein wrote:
>>
>> Well...you should be able to set them to NULL.
>> That should do the trick I think.
>>
>> Regards
>> Lars
>>
>>
>> 2009/1/12 Sylvester <sy...@gmail.com>:
>>> Hi,
>>>>
>>>> The bean endpoint should remove the following properties before
>>>> forwarding the exchange to the mail sender:
>>>>
>>>> org.apache.servicemix.mail.to
>>>> org.apache.servicemix.mail.cc
>>>> org.apache.servicemix.mail.bcc
>>>> org.apache.servicemix.mail.from
>>>> org.apache.servicemix.mail.replyto
>>>
>>> I don't see any way of removing these properties. Right now I am just
>>> setting these to empty strings. Will that do?
>>>
>>> Sylvester
>>>
>>
>>
>>
>> --
>> http://lhein.blogspot.com
>>
>>
>> -----
>> Regards
>> Lars
>>
>>
>> http://lhein.blogspot.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-with-the-Email-binding-component-tp21330046p21429347.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
http://lhein.blogspot.com

Re: Problem with the Email binding component

Posted by Sylvester Steele <sy...@gmail.com>.
Hi,
I seem to be running into the same date parse exception with the 

Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint

approach when I use the 2008.01 version. I tried setting the required
properties to null / not setting to null either way I got the Date parse
exception.





When I used the 2008.02 I get: (summary at end)

ERROR - BeanComponent                  - Error processing exchange InOnly[
  id: ID:192.168.2.79-11eca8c7aa4-2:9
  status: Done
  role: consumer
  interface: {http://test2}myMailService3
  service: {http://test2}myMailService3
  endpoint: senderEndpoint123
  in: Unable to display: org.xml.sax.SAXParseException: Content is not
allowed i
n prolog.
]
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(Me
ssageExchangeImpl.java:614)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(Delive
ryChannelImpl.java:386)
        
If I set the mentioned properties to null I get the above exception and the
sender emails repeatedly.
If I do not set the mentioned properties to null I get the above exception
but no email is sent.

 
Relevant bits from my Bean SU:


Setting properties to null:

   message.setProperty("org.apache.servicemix.mail.from", null);
        message.setProperty("org.apache.servicemix.mail.to", null);
        message.setProperty("org.apache.servicemix.mail.cc", null);
        message.setProperty("org.apache.servicemix.mail.bcc", null);
        message.setProperty("org.apache.servicemix.mail.replyto", null);

Sending exchange to poller and sender:


 QName name= new QName("http://test2","myMailService3" ); //this is the
sender
                
        MessageExchangeFactory
messageExchangeFactory=channel.createExchangeFactory(name);
        MessageExchange exchange2=
messageExchangeFactory.createInOnlyExchange();
        MessageUtil.transferInToIn(exchange, exchange2);
        exchange2.setService(name);
       
        System.out.println("Sending exchange to sender endpoint");
        channel.send(exchange2);
        System.out.println("Sent exchange to sender endpoint");
        

        exchange.setStatus(ExchangeStatus.DONE); //the poller
        System.out.println("Sending exchange to usual endpoint");
        channel.send(exchange);
        System.out.println("Sent exchange to usual endpoint");


Summary:

using 2008.01- no email sent
using 2008.02- repeated email + exception if properties set to null in the
Bean SU. Exception but no email if properties not set to null.

What am I missing here?

Thanks,
Sylvester


lhein wrote:
> 
> Well...you should be able to set them to NULL.
> That should do the trick I think.
> 
> Regards
> Lars
> 
> 
> 2009/1/12 Sylvester <sy...@gmail.com>:
>> Hi,
>>>
>>> The bean endpoint should remove the following properties before
>>> forwarding the exchange to the mail sender:
>>>
>>> org.apache.servicemix.mail.to
>>> org.apache.servicemix.mail.cc
>>> org.apache.servicemix.mail.bcc
>>> org.apache.servicemix.mail.from
>>> org.apache.servicemix.mail.replyto
>>
>> I don't see any way of removing these properties. Right now I am just
>> setting these to empty strings. Will that do?
>>
>> Sylvester
>>
> 
> 
> 
> -- 
> http://lhein.blogspot.com
> 
> 
> -----
> Regards 
> Lars 
> 
> 
> http://lhein.blogspot.com 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-the-Email-binding-component-tp21330046p21429347.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with the Email binding component

Posted by Lars Heinemann <lh...@apache.org>.
Well...you should be able to set them to NULL.
That should do the trick I think.

Regards
Lars


2009/1/12 Sylvester <sy...@gmail.com>:
> Hi,
>>
>> The bean endpoint should remove the following properties before
>> forwarding the exchange to the mail sender:
>>
>> org.apache.servicemix.mail.to
>> org.apache.servicemix.mail.cc
>> org.apache.servicemix.mail.bcc
>> org.apache.servicemix.mail.from
>> org.apache.servicemix.mail.replyto
>
> I don't see any way of removing these properties. Right now I am just
> setting these to empty strings. Will that do?
>
> Sylvester
>



-- 
http://lhein.blogspot.com

Re: Problem with the Email binding component

Posted by Sylvester <sy...@gmail.com>.
Hi,
> The bean endpoint should remove the following properties before
> forwarding the exchange to the mail sender:
>
> org.apache.servicemix.mail.to
> org.apache.servicemix.mail.cc
> org.apache.servicemix.mail.bcc
> org.apache.servicemix.mail.from
> org.apache.servicemix.mail.replyto
 I don't see any way of removing these properties. Right now I am just 
setting these to empty strings. Will that do?

Sylvester

Re: Problem with the Email binding component

Posted by Lars Heinemann <lh...@apache.org>.
Sylvester,

well you can maybe also you a simple camel route with a processor
deleting the mentioned properties from the nmsg.
But if you go for the bean solution you could just create getters and
setters in your bean class for a QName targetService attribute
and then you should be able to set the value inside the xbean.xml as
usually.
In the message processing you would then just use the DeliveryChannel
object to create a new message exchange (maybe InOnly) and
set the service of this exchange to the targetService mentioned above.
Then you could use the MessageUtils class to transfer the in-message of
the received exchange to the in-message of the fresh created exchange
and then call the send or sendSync method of the channel to send the new
exchange to the sender service. also don't forget to done or fail the
original exchange from the poller.

Regards
Lars


Sylvester Steele schrieb:
>  Lars,
>
> Thanks for your reply. I want to go with the
>
> Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint
>
> approach. I know the  Mail Poller Endpoint --> Bean Endpoint part well. I've
> already done it. But any pointers to to how to make the Bean SU invoke the
> sender will be very helpful.
>
> Thanks
>
> On Fri, Jan 9, 2009 at 12:04 PM, Lars Heinemann <lh...@apache.org> wrote:
>
>   
>> Sylvester,
>>
>> you are running into an issue which is caused by your bridge. The mail
>> component recently had the problem, that when just bridging mail from
>> poller to sender, the component tries to re-use some of the mail
>> properties set by the poller. This will have strange results or may
>> even not work at all.
>> This problem is fixed in the current trunk version of the component by
>> having the possibility to ignore specific message properties by using
>> the ignoreMessageProperties attribute. (I answered you in another
>> thread about this topic).
>>
>> A possible workaround if you want to stay with the current released
>> version of the mail component:
>>
>> Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint
>>
>> The bean endpoint should remove the following properties before
>> forwarding the exchange to the mail sender:
>>
>> org.apache.servicemix.mail.to
>> org.apache.servicemix.mail.cc
>> org.apache.servicemix.mail.bcc
>> org.apache.servicemix.mail.from
>> org.apache.servicemix.mail.replyto
>>
>> That should do the trick.
>>
>> Regards
>> Lars
>>
>>
>>
>>
>>
>> 2009/1/9 Sylvester <sy...@gmail.com>
>>     
>>> Hi,
>>> Well I tried adding the geronimo dependency and it didn't work. Anyway,
>>>       
>> now maven compiles and it, and it gets deployed properly in smx. The poller
>> works fine. The sender is giving me some trouble. This is a poller sender
>> bridge.
>>     
>>> My xBean looks like:
>>>
>>> <mail:sender service="test2:myMailService3"
>>>       endpoint="senderEndpoint123" sender="blah@blah.com"
>>>       receiver="blah@blah.com"
>>>       connection="smtps://blah@smtp.blah.com:PORT_NO?password=blah"
>>>
>>>       
>> customTrustManagers="org.apache.servicemix.mail.security.DummyTrustManager"
>>     
>>>       debugMode="true">
>>>       <property name="marshaler">
>>>           <bean class="com.MyMailMarshaler" />
>>> </property>
>>>       </mail:sender>
>>>
>>> MyMailMarshaler just has a sysout and then calls the default marshaler.
>>>
>>> The error is:
>>>
>>> DEBUG: JavaMail version 1.4
>>> DEBUG: java.io.FileNotFoundException: C:\Program
>>>       
>> Files\Java\jdk1.5.0_14\jre\lib\
>>     
>>> javamail.providers (The system cannot find the file specified)
>>> DEBUG: !anyLoaded
>>> DEBUG: not loading resource: /META-INF/javamail.providers
>>> DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
>>> DEBUG: Tables of loaded providers
>>> DEBUG: Providers Listed By Class Name:
>>>       
>> {com.sun.mail.smtp.SMTPSSLTransport=javax
>>     
>>> .mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun
>>>       
>> Microsyste
>>     
>>> ms, Inc],
>>>       
>> com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com
>>     
>>> .sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc],
>>>       
>> com.sun.mail.imap.IMAPSSLSt
>>     
>>> ore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun
>>>       
>> Microsyst
>>     
>>> ems, Inc],
>>>       
>> com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.su
>>     
>>> n.mail.pop3.POP3SSLStore,Sun Microsystems, Inc],
>>>       
>> com.sun.mail.imap.IMAPStore=jav
>>     
>>> ax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems,
>>>       
>> Inc],
>>     
>> com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP
>>     
>>> 3Store,Sun Microsystems, Inc]}
>>> DEBUG: Providers Listed By Protocol:
>>>       
>> {imaps=javax.mail.Provider[STORE,imaps,com.
>>     
>>> sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc],
>>>       
>> imap=javax.mail.Provider[STOR
>>     
>>> E,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc],
>>>       
>> smtps=javax.mail.Prov
>>     
>>> ider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems,
>>>       
>> Inc],
>>     
>>> pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
>>>       
>> Microsystems
>>     
>>> , Inc],
>>>       
>> pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
>>     
>>> Microsystems, Inc],
>>>       
>> smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.S
>>     
>>> MTPTransport,Sun Microsystems, Inc]}
>>> DEBUG: successfully loaded resource:
>>>       
>> /META-INF/javamail.default.address.map
>>     
>>> DEBUG: !anyLoaded
>>> DEBUG: not loading resource: /META-INF/javamail.address.map
>>> DEBUG: java.io.FileNotFoundException: C:\Program
>>>       
>> Files\Java\jdk1.5.0_14\jre\lib\
>>     
>>> javamail.address.map (The system cannot find the file specified)
>>> DEBUG: setDebug: JavaMail version 1.4
>>> DEBUG: getProvider() returning
>>>       
>> javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.
>>     
>>> smtp.SMTPSSLTransport,Sun Microsystems, Inc]
>>> DEBUG SMTP: useEhlo true, useAuth true
>>> DEBUG SMTP: trying to connect to host "smtp.BLAH.com", port 465, isSSL
>>>       
>> true
>>     
>>> 220 mx.BLAH.com ESMTP m28sm39846542poh.25
>>> DEBUG SMTP: connected to host "smtp.BLAH.com", port: [PORT_NO]
>>>
>>> EHLO BLAH
>>> 250-BLAH at your service, [IP ADDRESS]
>>> 250-SIZE 35651584
>>> 250-8BITMIME
>>> 250-AUTH LOGIN PLAIN
>>> 250 ENHANCEDSTATUSCODES
>>> DEBUG SMTP: Found extension "SIZE", arg "35651584"
>>> DEBUG SMTP: Found extension "8BITMIME", arg ""
>>> DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
>>> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
>>> DEBUG SMTP: Attempt to authenticate
>>> AUTH LOGIN
>>> [BLAH]
>>> 235 2.7.0 Accepted
>>>
>>> convertJBIToMail invoked
>>>
>>> ERROR - MailComponent                  - Error sending mail...
>>> javax.mail.MessagingException: Unparseable date: "Fri, 09 Jan 2009
>>>       
>> 10:45:07 +070
>>     
>>> 0";
>>>  nested exception is:
>>>       java.text.ParseException: Unparseable date: "Fri, 09 Jan 2009
>>>       
>> 10:45:07 +
>>     
>>> 0700"
>>>       at
>>>       
>> org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertJBIT
>>     
>>> oMail(DefaultMailMarshaler.java:93)
>>>       at com.MyMailMarshaler.convertJBIToMail(MyMailMarshaler.java:32)
>>>       at
>>>       
>> org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
>>     
>>> rEndpoint.java:116)
>>>
>>> I do nothing to the date, and I don't know the sender should have a
>>>       
>> problem with it when the poller works fine with the same date. What could be
>> the problem?
>>
>>
>>
>> --
>> http://lhein.blogspot.com
>>
>>     
>
>   


Re: Problem with the Email binding component

Posted by Sylvester Steele <sy...@gmail.com>.
 Lars,

Thanks for your reply. I want to go with the

Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint

approach. I know the  Mail Poller Endpoint --> Bean Endpoint part well. I've
already done it. But any pointers to to how to make the Bean SU invoke the
sender will be very helpful.

Thanks

On Fri, Jan 9, 2009 at 12:04 PM, Lars Heinemann <lh...@apache.org> wrote:

> Sylvester,
>
> you are running into an issue which is caused by your bridge. The mail
> component recently had the problem, that when just bridging mail from
> poller to sender, the component tries to re-use some of the mail
> properties set by the poller. This will have strange results or may
> even not work at all.
> This problem is fixed in the current trunk version of the component by
> having the possibility to ignore specific message properties by using
> the ignoreMessageProperties attribute. (I answered you in another
> thread about this topic).
>
> A possible workaround if you want to stay with the current released
> version of the mail component:
>
> Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint
>
> The bean endpoint should remove the following properties before
> forwarding the exchange to the mail sender:
>
> org.apache.servicemix.mail.to
> org.apache.servicemix.mail.cc
> org.apache.servicemix.mail.bcc
> org.apache.servicemix.mail.from
> org.apache.servicemix.mail.replyto
>
> That should do the trick.
>
> Regards
> Lars
>
>
>
>
>
> 2009/1/9 Sylvester <sy...@gmail.com>
> >
> > Hi,
> > Well I tried adding the geronimo dependency and it didn't work. Anyway,
> now maven compiles and it, and it gets deployed properly in smx. The poller
> works fine. The sender is giving me some trouble. This is a poller sender
> bridge.
> >
> > My xBean looks like:
> >
> > <mail:sender service="test2:myMailService3"
> >       endpoint="senderEndpoint123" sender="blah@blah.com"
> >       receiver="blah@blah.com"
> >       connection="smtps://blah@smtp.blah.com:PORT_NO?password=blah"
> >
> customTrustManagers="org.apache.servicemix.mail.security.DummyTrustManager"
> >       debugMode="true">
> >       <property name="marshaler">
> >           <bean class="com.MyMailMarshaler" />
> > </property>
> >       </mail:sender>
> >
> > MyMailMarshaler just has a sysout and then calls the default marshaler.
> >
> > The error is:
> >
> > DEBUG: JavaMail version 1.4
> > DEBUG: java.io.FileNotFoundException: C:\Program
> Files\Java\jdk1.5.0_14\jre\lib\
> > javamail.providers (The system cannot find the file specified)
> > DEBUG: !anyLoaded
> > DEBUG: not loading resource: /META-INF/javamail.providers
> > DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
> > DEBUG: Tables of loaded providers
> > DEBUG: Providers Listed By Class Name:
> {com.sun.mail.smtp.SMTPSSLTransport=javax
> > .mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun
> Microsyste
> > ms, Inc],
> com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com
> > .sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc],
> com.sun.mail.imap.IMAPSSLSt
> > ore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun
> Microsyst
> > ems, Inc],
> com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.su
> > n.mail.pop3.POP3SSLStore,Sun Microsystems, Inc],
> com.sun.mail.imap.IMAPStore=jav
> > ax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems,
> Inc],
> >
> com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP
> > 3Store,Sun Microsystems, Inc]}
> > DEBUG: Providers Listed By Protocol:
> {imaps=javax.mail.Provider[STORE,imaps,com.
> > sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc],
> imap=javax.mail.Provider[STOR
> > E,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc],
> smtps=javax.mail.Prov
> > ider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems,
> Inc],
> > pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
> Microsystems
> > , Inc],
> pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
> > Microsystems, Inc],
> smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.S
> > MTPTransport,Sun Microsystems, Inc]}
> > DEBUG: successfully loaded resource:
> /META-INF/javamail.default.address.map
> > DEBUG: !anyLoaded
> > DEBUG: not loading resource: /META-INF/javamail.address.map
> > DEBUG: java.io.FileNotFoundException: C:\Program
> Files\Java\jdk1.5.0_14\jre\lib\
> > javamail.address.map (The system cannot find the file specified)
> > DEBUG: setDebug: JavaMail version 1.4
> > DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.
> > smtp.SMTPSSLTransport,Sun Microsystems, Inc]
> > DEBUG SMTP: useEhlo true, useAuth true
> > DEBUG SMTP: trying to connect to host "smtp.BLAH.com", port 465, isSSL
> true
> > 220 mx.BLAH.com ESMTP m28sm39846542poh.25
> > DEBUG SMTP: connected to host "smtp.BLAH.com", port: [PORT_NO]
> >
> > EHLO BLAH
> > 250-BLAH at your service, [IP ADDRESS]
> > 250-SIZE 35651584
> > 250-8BITMIME
> > 250-AUTH LOGIN PLAIN
> > 250 ENHANCEDSTATUSCODES
> > DEBUG SMTP: Found extension "SIZE", arg "35651584"
> > DEBUG SMTP: Found extension "8BITMIME", arg ""
> > DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
> > DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> > DEBUG SMTP: Attempt to authenticate
> > AUTH LOGIN
> > [BLAH]
> > 235 2.7.0 Accepted
> >
> > convertJBIToMail invoked
> >
> > ERROR - MailComponent                  - Error sending mail...
> > javax.mail.MessagingException: Unparseable date: "Fri, 09 Jan 2009
> 10:45:07 +070
> > 0";
> >  nested exception is:
> >       java.text.ParseException: Unparseable date: "Fri, 09 Jan 2009
> 10:45:07 +
> > 0700"
> >       at
> org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertJBIT
> > oMail(DefaultMailMarshaler.java:93)
> >       at com.MyMailMarshaler.convertJBIToMail(MyMailMarshaler.java:32)
> >       at
> org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
> > rEndpoint.java:116)
> >
> > I do nothing to the date, and I don't know the sender should have a
> problem with it when the poller works fine with the same date. What could be
> the problem?
>
>
>
> --
> http://lhein.blogspot.com
>

Re: Problem with the Email binding component

Posted by Lars Heinemann <lh...@apache.org>.
Sylvester,

you are running into an issue which is caused by your bridge. The mail
component recently had the problem, that when just bridging mail from
poller to sender, the component tries to re-use some of the mail
properties set by the poller. This will have strange results or may
even not work at all.
This problem is fixed in the current trunk version of the component by
having the possibility to ignore specific message properties by using
the ignoreMessageProperties attribute. (I answered you in another
thread about this topic).

A possible workaround if you want to stay with the current released
version of the mail component:

Mail Poller Endpoint --> Bean Endpoint --> Mail Sender Endpoint

The bean endpoint should remove the following properties before
forwarding the exchange to the mail sender:

org.apache.servicemix.mail.to
org.apache.servicemix.mail.cc
org.apache.servicemix.mail.bcc
org.apache.servicemix.mail.from
org.apache.servicemix.mail.replyto

That should do the trick.

Regards
Lars





2009/1/9 Sylvester <sy...@gmail.com>
>
> Hi,
> Well I tried adding the geronimo dependency and it didn't work. Anyway, now maven compiles and it, and it gets deployed properly in smx. The poller works fine. The sender is giving me some trouble. This is a poller sender bridge.
>
> My xBean looks like:
>
> <mail:sender service="test2:myMailService3"
>       endpoint="senderEndpoint123" sender="blah@blah.com"
>       receiver="blah@blah.com"
>       connection="smtps://blah@smtp.blah.com:PORT_NO?password=blah"
>       customTrustManagers="org.apache.servicemix.mail.security.DummyTrustManager"
>       debugMode="true">
>       <property name="marshaler">
>           <bean class="com.MyMailMarshaler" />
> </property>
>       </mail:sender>
>
> MyMailMarshaler just has a sysout and then calls the default marshaler.
>
> The error is:
>
> DEBUG: JavaMail version 1.4
> DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.5.0_14\jre\lib\
> javamail.providers (The system cannot find the file specified)
> DEBUG: !anyLoaded
> DEBUG: not loading resource: /META-INF/javamail.providers
> DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
> DEBUG: Tables of loaded providers
> DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax
> .mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsyste
> ms, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com
> .sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLSt
> ore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsyst
> ems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.su
> n.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=jav
> ax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc],
> com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP
> 3Store,Sun Microsystems, Inc]}
> DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.
> sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STOR
> E,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Prov
> ider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc],
> pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems
> , Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
> Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.S
> MTPTransport,Sun Microsystems, Inc]}
> DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
> DEBUG: !anyLoaded
> DEBUG: not loading resource: /META-INF/javamail.address.map
> DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.5.0_14\jre\lib\
> javamail.address.map (The system cannot find the file specified)
> DEBUG: setDebug: JavaMail version 1.4
> DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.
> smtp.SMTPSSLTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> DEBUG SMTP: trying to connect to host "smtp.BLAH.com", port 465, isSSL true
> 220 mx.BLAH.com ESMTP m28sm39846542poh.25
> DEBUG SMTP: connected to host "smtp.BLAH.com", port: [PORT_NO]
>
> EHLO BLAH
> 250-BLAH at your service, [IP ADDRESS]
> 250-SIZE 35651584
> 250-8BITMIME
> 250-AUTH LOGIN PLAIN
> 250 ENHANCEDSTATUSCODES
> DEBUG SMTP: Found extension "SIZE", arg "35651584"
> DEBUG SMTP: Found extension "8BITMIME", arg ""
> DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> DEBUG SMTP: Attempt to authenticate
> AUTH LOGIN
> [BLAH]
> 235 2.7.0 Accepted
>
> convertJBIToMail invoked
>
> ERROR - MailComponent                  - Error sending mail...
> javax.mail.MessagingException: Unparseable date: "Fri, 09 Jan 2009 10:45:07 +070
> 0";
>  nested exception is:
>       java.text.ParseException: Unparseable date: "Fri, 09 Jan 2009 10:45:07 +
> 0700"
>       at org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertJBIT
> oMail(DefaultMailMarshaler.java:93)
>       at com.MyMailMarshaler.convertJBIToMail(MyMailMarshaler.java:32)
>       at org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
> rEndpoint.java:116)
>
> I do nothing to the date, and I don't know the sender should have a problem with it when the poller works fine with the same date. What could be the problem?



--
http://lhein.blogspot.com

Re: Problem with the Email binding component

Posted by Sylvester <sy...@gmail.com>.
Hi,
Well I tried adding the geronimo dependency and it didn't work. Anyway, 
now maven compiles and it, and it gets deployed properly in smx. The 
poller works fine. The sender is giving me some trouble. This is a 
poller sender bridge.

My xBean looks like:

<mail:sender service="test2:myMailService3"
        endpoint="senderEndpoint123" sender="blah@blah.com"
        receiver="blah@blah.com"
        connection="smtps://blah@smtp.blah.com:PORT_NO?password=blah"
        
customTrustManagers="org.apache.servicemix.mail.security.DummyTrustManager"
        debugMode="true">
        <property name="marshaler">
            <bean class="com.MyMailMarshaler" />
</property>
        </mail:sender>

MyMailMarshaler just has a sysout and then calls the default marshaler.

The error is:

DEBUG: JavaMail version 1.4
DEBUG: java.io.FileNotFoundException: C:\Program 
Files\Java\jdk1.5.0_14\jre\lib\
javamail.providers (The system cannot find the file specified)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: 
{com.sun.mail.smtp.SMTPSSLTransport=javax
.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun 
Microsyste
ms, Inc], 
com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com
.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], 
com.sun.mail.imap.IMAPSSLSt
ore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun 
Microsyst
ems, Inc], 
com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.su
n.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], 
com.sun.mail.imap.IMAPStore=jav
ax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun 
Microsystems, Inc],
com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP
3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: 
{imaps=javax.mail.Provider[STORE,imaps,com.
sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], 
imap=javax.mail.Provider[STOR
E,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], 
smtps=javax.mail.Prov
ider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun 
Microsystems, Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun 
Microsystems
, Inc], 
pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
 Microsystems, Inc], 
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.S
MTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program 
Files\Java\jdk1.5.0_14\jre\lib\
javamail.address.map (The system cannot find the file specified)
DEBUG: setDebug: JavaMail version 1.4
DEBUG: getProvider() returning 
javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.
smtp.SMTPSSLTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.BLAH.com", port 465, isSSL true
220 mx.BLAH.com ESMTP m28sm39846542poh.25
DEBUG SMTP: connected to host "smtp.BLAH.com", port: [PORT_NO]

EHLO BLAH
250-BLAH at your service, [IP ADDRESS]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
DEBUG SMTP: Found extension "SIZE", arg "35651584"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
[BLAH]
235 2.7.0 Accepted

convertJBIToMail invoked

ERROR - MailComponent                  - Error sending mail...
javax.mail.MessagingException: Unparseable date: "Fri, 09 Jan 2009 
10:45:07 +070
0";
  nested exception is:
        java.text.ParseException: Unparseable date: "Fri, 09 Jan 2009 
10:45:07 +
0700"
        at 
org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertJBIT
oMail(DefaultMailMarshaler.java:93)
        at com.MyMailMarshaler.convertJBIToMail(MyMailMarshaler.java:32)
        at 
org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
rEndpoint.java:116)

I do nothing to the date, and I don't know the sender should have a 
problem with it when the poller works fine with the same date. What 
could be the problem?

Re: Problem with the Email binding component

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Seems the javamail provider jar is missing.
Try add
        <dependency>
            <groupId>org.apache.geronimo.javamail</groupId>
            <artifactId>geronimo-javamail_1.4_provider</artifactId>
            <version>1.6</version>
        </dependency>
into your pom.xml
Freeman

Sylvester wrote:
> Hi,
> I want to make a poller-sender bridge. I have both the sender and the 
> poller endpoints in the same xbean. it deploys fine, but when the 
> poller gets a message it says:
>
>
> ERROR - MailComponent                  - Error sending mail...
> javax.mail.NoSuchProviderException: invalid provider
>        at javax.mail.Session.getTransport(Session.java:704)
>        at javax.mail.Session.getTransport(Session.java:651)
>        at javax.mail.Session.getTransport(Session.java:631)
>        at 
> org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSende
> rEndpoint.java:105)
>
> followed by
>
> [Fatal Error] :-1:-1: Premature end of file.
> ERROR - MailComponent                  - Error processing exchange 
> InOnly[
>  id: ID:192.168.4.75-11eb0fb036d-14:0
>  status: Active
>  role: provider
>  service: {http://test2}myMailService3
>  endpoint: senderEndpoint123
>  in: Unable to display: org.xml.sax.SAXParseException: Premature end 
> of file.
> ]
> javax.mail.NoSuchProviderException: invalid provider
>        at javax.mail.Session.getTransport(Session.java:704)
>
> The above info is correct, so the target service is being invoked 
> correctly. What could be the problem?
>
> Thanks,
> Sylvester
>
>