commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaran Nilsen" <jaran.nil...@gmail.com>
Subject Re: To and Subject headers disappearing
Date Mon, 06 Oct 2008 18:08:28 GMT
For anyone experiencing similar issues I thought I would post a reply
to myself and explain how I solved this.

The problem was due to a custom JavaMail implementation that found
it's way onto my classpath via Apache CXF.

The artifact causing the problem was:
org.apache.geronimo.specs:geronimo-javamail_1.4_spec. To me this seems
to be a custom Geronimo  implementation of JavaMail, or at least some
of it's classes. I cannot imagine the need for an implementation which
strips all the headers from the message, but I guess they have their
reason.

Using Maven on my project, I simply added
<exclusions>
    <exclusion>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-javamail_1.4_spec</artifactId>
    </exclusion>
</exclusions>

to the org.apache.cxf:cxf-rt-frontend-simple dependency.

Anyways, hopefully this will help anyone out there struggling with the
same problem :)

Jaran

On Tue, Sep 30, 2008 at 2:37 PM, Jaran Nilsen <jaran.nilsen@gmail.com> wrote:
> Hi.
>
> I am having a problem with commons-email 1.1. I am not sure where the
> problem is,but figured this would be a good place to start trying to
> figure out why this is happening to my application.
>
> I have two projects, A and B. In project A, the only dependency (Maven
> 2) is commons-email 1.1. This is again dependent on JavaMail 1.4
> (mail-1.4).
>
> In project B, I have the same dependency, commons-email 1.1, but I
> also have several other dependencies. One of these are xfire-core
> 1.2.6, which I have seen is also dependent on JavaMail 1.4. Xfire-core
> and commons-email are the ONLY artifacts depending on JavaMail in
> project B.
>
> When I run the following codesnippet in Project A, everything works
> fine. The email arrives and things are sweet like a warm summer day.
> However, when I run the same piece of code in Project B, the To and
> Subject headers disappear! I have been scratching my head and been
> testing up and down and can't figure out what is causing this.
>
> Are there anyone out there who have experienced anything similar and
> can point me in the right direction?
>
> Here is the code snippet:
> SimpleEmail email = new SimpleEmail();
> email.setHostName("localhost");
> email.setSmtpPort(25025);
> email.addTo("jaran.nilsen@integrasco.no");
> email.setFrom("peons@integrasco.no", "Integrasco Peons");
> email.setSubject("Test message");
> email.setMsg("This is a simple test of commons-email");
> email.setDebug(true);
> email.send();
>
> Debug output from Project A:
> DEBUG: JavaMail version 1.4ea
> DEBUG: java.io.FileNotFoundException:
> /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/javamail.providers (No such
> file or directory)
> 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
> Microsystems, Inc],
> com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> Microsystems, Inc],
> com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun
> Microsystems, Inc],
> com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
> Microsystems, Inc],
> com.sun.mail.imap.IMAPStore=javax.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.POP3Store,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[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
> Microsystems, Inc],
> smtps=javax.mail.Provider[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.SMTPTransport,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:
> /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/javamail.address.map (No such
> file or directory)
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "localhost", port 25025, isSSL false
> 220 ludvig.integrasco.no ESMTP Sendmail 8.13.1/8.13.1; Tue, 30 Sep
> 2008 14:35:48 +0200
> DEBUG SMTP: connected to host "localhost", port: 25025
>
> EHLO jaran-laptop
> 250-ludvig.integrasco.no Hello localhost.localdomain [127.0.0.1],
> pleased to meet you
> 250-ENHANCEDSTATUSCODES
> 250-PIPELINING
> 250-8BITMIME
> 250-SIZE
> 250-DSN
> 250-ETRN
> 250-AUTH DIGEST-MD5 CRAM-MD5
> 250-DELIVERBY
> 250 HELP
> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> DEBUG SMTP: Found extension "PIPELINING", arg ""
> DEBUG SMTP: Found extension "8BITMIME", arg ""
> DEBUG SMTP: Found extension "SIZE", arg ""
> DEBUG SMTP: Found extension "DSN", arg ""
> DEBUG SMTP: Found extension "ETRN", arg ""
> DEBUG SMTP: Found extension "AUTH", arg "DIGEST-MD5 CRAM-MD5"
> DEBUG SMTP: Found extension "DELIVERBY", arg ""
> DEBUG SMTP: Found extension "HELP", arg ""
> DEBUG SMTP: use8bit false
> MAIL FROM:<peons@integrasco.no>
> 250 2.1.0 <peons@integrasco.no>... Sender ok
> RCPT TO:<jaran.nilsen@integrasco.no>
> 250 2.1.5 <jaran.nilsen@integrasco.no>... Recipient ok
> DEBUG SMTP: Verified Addresses
> DEBUG SMTP:   "jaran.nilsen@integrasco.no" <jaran.nilsen@integrasco.no>
> DATA
> 354 Enter mail, end with "." on a line by itself
> Date: Tue, 30 Sep 2008 14:36:46 +0200 (CEST)
> From: Integrasco Peons <peons@integrasco.no>
> To: "jaran.nilsen@integrasco.no" <jaran.nilsen@integrasco.no>
> Message-ID: <19058102.01222778206577.JavaMail.jaran@jaran-laptop>
> Subject: Test message
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> This is a simple test of commons-email
> .
> 250 2.0.0 m8UCZmKZ029942 Message accepted for delivery
> QUIT
> 221 2.0.0 ludvig.integrasco.no closing connection
>
> Debug output from Project B:
> Loading javamail.default.providers from
> jar:file:/home/jaran/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar!/META-INF/javamail.default.providers
> DEBUG: loading new provider protocol=imap,
> className=com.sun.mail.imap.IMAPStore, vendor=Sun Microsystems, Inc,
> version=null
> DEBUG: loading new provider protocol=imaps,
> className=com.sun.mail.imap.IMAPSSLStore, vendor=Sun Microsystems,
> Inc, version=null
> DEBUG: loading new provider protocol=smtp,
> className=com.sun.mail.smtp.SMTPTransport, vendor=Sun Microsystems,
> Inc, version=null
> DEBUG: loading new provider protocol=smtps,
> className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Sun Microsystems,
> Inc, version=null
> DEBUG: loading new provider protocol=pop3,
> className=com.sun.mail.pop3.POP3Store, vendor=Sun Microsystems, Inc,
> version=null
> DEBUG: loading new provider protocol=pop3s,
> className=com.sun.mail.pop3.POP3SSLStore, vendor=Sun Microsystems,
> Inc, version=null
> DEBUG: getProvider() returning provider protocol=smtp;
> type=javax.mail.Provider$Type@106082;
> class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "localhost", port 25025, isSSL false
> 220 ludvig.integrasco.no ESMTP Sendmail 8.13.1/8.13.1; Tue, 30 Sep
> 2008 14:36:44 +0200
> DEBUG SMTP: connected to host "localhost", port: 25025
>
> EHLO jaran-laptop
> 250-ludvig.integrasco.no Hello localhost.localdomain [127.0.0.1],
> pleased to meet you
> 250-ENHANCEDSTATUSCODES
> 250-PIPELINING
> 250-8BITMIME
> 250-SIZE
> 250-DSN
> 250-ETRN
> 250-AUTH DIGEST-MD5 CRAM-MD5
> 250-DELIVERBY
> 250 HELP
> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> DEBUG SMTP: Found extension "PIPELINING", arg ""
> DEBUG SMTP: Found extension "8BITMIME", arg ""
> DEBUG SMTP: Found extension "SIZE", arg ""
> DEBUG SMTP: Found extension "DSN", arg ""
> DEBUG SMTP: Found extension "ETRN", arg ""
> DEBUG SMTP: Found extension "AUTH", arg "DIGEST-MD5 CRAM-MD5"
> DEBUG SMTP: Found extension "DELIVERBY", arg ""
> DEBUG SMTP: Found extension "HELP", arg ""
> DEBUG SMTP: use8bit false
> MAIL FROM:<peons@integrasco.no>
> 250 2.1.0 <peons@integrasco.no>... Sender ok
> RCPT TO:<jaran.nilsen@integrasco.no>
> 250 2.1.5 <jaran.nilsen@integrasco.no>... Recipient ok
> DEBUG SMTP: Verified Addresses
> DEBUG SMTP:   "jaran.nilsen@integrasco.no" <jaran.nilsen@integrasco.no>
> DATA
> 354 Enter mail, end with "." on a line by itself
>
> This is a simple test of commons-email
> .
> 250 2.0.0 m8UCaixb030029 Message accepted for delivery
> QUIT
> 221 2.0.0 ludvig.integrasco.no closing connection
>
> Appreciate any help on this. Starting to go out of hair to pull out :)
>
> Kind regards,
> Jaran Nilsen
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message