Re: Tomcat 6 and javamail

2008-11-27 Thread Lyallex
OK, firstly thanks for the feedback so far

Let me be quite clear about one thing.
I am using the same mail server in both cases. Tomcat and Eclipse are
running on the same physical device with the same IP address.

If I configure a JavaMail session as described in the following resource

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
(JavaMail section)

and set auth to false in context.xml everything works perfectly when
sending mail from the web application.

When I try to send mail with my mail component cofigured to work
without using the configured session it fails with Authentication
failed

To sum up then

The mail server does not require authentication when accessed from the
office subnet. The server guys have confirmed this.
I am using the same mail server for the standalone test, the test
where the mail component is configured to use the JNDI resource
configured in context.xml and the test where the mail component uses
the same configuration mechanism as the standlone test. The only test
that fails is the last one.

Something has changed since Tomcat 5.  I have exactly the same
component running in several webapps on Tomcat 5 servers without any
need to configure JNDI resources/Mail sessions etc

JAVA_OPTS and CATALINA_OPTS have not been modified by me and do not
contain anything other that the default settings (none of which appear
to have anything to do with mail config settings).

Any ideas much appreciated.

lyallex

2008/11/26 Rainer Frey [EMAIL PROTECTED]:
 On Wednesday 26 November 2008 08:37:14 Rainer Frey wrote:
  In the MailServer constructor I do the following
 
  properties = System.getProperties();
  ...
  properties.put(mail.smtp.auth, false);
 
  so it looks like a different properties bundle is being used when I
  run this in Tomcat ... does any of this make sense ??

 Argh, I overlooked that you use System.getProperties() here. If you specify
 any JavaMail related Properties in JAVA_OPTS or CATALINA_OPTS environment
 variables, this will be different indeed. You might want to check your tomcat
 start script.

 Rainer


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-27 Thread Rainer Frey
On Thursday 27 November 2008 12:52:56 Lyallex wrote:


(It would be easier to answer if you'd stop top quoting - but I won't correct 
this whole mail)

 OK, firstly thanks for the feedback so far

 Let me be quite clear about one thing.
 I am using the same mail server in both cases. Tomcat and Eclipse are
 running on the same physical device with the same IP address.
 The mail server does not require authentication when accessed from the
 office subnet. The server guys have confirmed this.

So the problem is certainly on Java side.

 If I configure a JavaMail session as described in the following resource

 http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
 (JavaMail section)

 and set auth to false in context.xml everything works perfectly when
 sending mail from the web application.

It then should not be anything related to Javamail or Java version, 
incompatible jar files ...

 I am using the same mail server for the standalone test, the test
 where the mail component is configured to use the JNDI resource
 configured in context.xml and the test where the mail component uses
 the same configuration mechanism as the standlone test. The only test
 that fails is the last one.

 Something has changed since Tomcat 5.  I have exactly the same
 component running in several webapps on Tomcat 5 servers without any
 need to configure JNDI resources/Mail sessions etc

In such a setup, a javamail session is no managed resource for tomcat. I can't 
imagine how the tomcat version could have any influence on that. There must 
be any other difference between your eclipse runtime and this failing tomcat.  

 JAVA_OPTS and CATALINA_OPTS have not been modified by me and do not
 contain anything other that the default settings (none of which appear
 to have anything to do with mail config settings).

Is there any other webapp that might set system properties with mail related 
content? I'd make sure and use an empty Properties object for your test. the 
only reason to use System.getProperties() is the ability to pass JavaMail 
configuration to the JVM command line. I'm not sure what static variables and 
Singletons Javamail has, so I'd test without the resource configuration (even 
if you don't use it anyway) and the Javamail jars in WEB-INF/lib. If this is 
not successful, I guess it's impossible to help unless you post more code, 
complete exception messages and perhaps the output of Javamail with 
mail.debug=true. As I think it is not directly related to tomcat, I'd 
recommend asking on the Javamail list though, they might know more details.

Rainer


 Any ideas much appreciated.

 lyallex

 2008/11/26 Rainer Frey [EMAIL PROTECTED]:
  On Wednesday 26 November 2008 08:37:14 Rainer Frey wrote:
   In the MailServer constructor I do the following
  
   properties = System.getProperties();
   ...
   properties.put(mail.smtp.auth, false);
  
   so it looks like a different properties bundle is being used when I
   run this in Tomcat ... does any of this make sense ??
 
  Argh, I overlooked that you use System.getProperties() here. If you
  specify any JavaMail related Properties in JAVA_OPTS or CATALINA_OPTS
  environment variables, this will be different indeed. You might want to
  check your tomcat start script.
 
  Rainer
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-27 Thread Lyallex
2008/11/27 Rainer Frey [EMAIL PROTECTED]:
 On Thursday 27 November 2008 12:52:56 Lyallex wrote:


 (It would be easier to answer if you'd stop top quoting - but I won't correct
 this whole mail)

Well that's most kind of you, you are being very patient.

I think I need to take a step back here. The boss is happy that
sending email from within the application is now working. I on the
other hand want to know why something that works in Tomcat 5 doesn't
work in Tomcat 6. He's less than inclined to pay for that information
however :-(

Anyway, I will certainly do some more testing, maybe install a clean
Tomcat 6 and create a simple web app that just sends email to a
preconfigured address ... whatever, I'll post results here including
code, mail debug and anything else that might help

Thanks again for your time

lyallex


 OK, firstly thanks for the feedback so far

 Let me be quite clear about one thing.
 I am using the same mail server in both cases. Tomcat and Eclipse are
 running on the same physical device with the same IP address.
 The mail server does not require authentication when accessed from the
 office subnet. The server guys have confirmed this.

 So the problem is certainly on Java side.

 If I configure a JavaMail session as described in the following resource

 http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
 (JavaMail section)

 and set auth to false in context.xml everything works perfectly when
 sending mail from the web application.

 It then should not be anything related to Javamail or Java version,
 incompatible jar files ...

 I am using the same mail server for the standalone test, the test
 where the mail component is configured to use the JNDI resource
 configured in context.xml and the test where the mail component uses
 the same configuration mechanism as the standlone test. The only test
 that fails is the last one.

 Something has changed since Tomcat 5.  I have exactly the same
 component running in several webapps on Tomcat 5 servers without any
 need to configure JNDI resources/Mail sessions etc

 In such a setup, a javamail session is no managed resource for tomcat. I can't
 imagine how the tomcat version could have any influence on that. There must
 be any other difference between your eclipse runtime and this failing tomcat.

 JAVA_OPTS and CATALINA_OPTS have not been modified by me and do not
 contain anything other that the default settings (none of which appear
 to have anything to do with mail config settings).

 Is there any other webapp that might set system properties with mail related
 content? I'd make sure and use an empty Properties object for your test. the
 only reason to use System.getProperties() is the ability to pass JavaMail
 configuration to the JVM command line. I'm not sure what static variables and
 Singletons Javamail has, so I'd test without the resource configuration (even
 if you don't use it anyway) and the Javamail jars in WEB-INF/lib. If this is
 not successful, I guess it's impossible to help unless you post more code,
 complete exception messages and perhaps the output of Javamail with
 mail.debug=true. As I think it is not directly related to tomcat, I'd
 recommend asking on the Javamail list though, they might know more details.

 Rainer


 Any ideas much appreciated.

 lyallex

 2008/11/26 Rainer Frey [EMAIL PROTECTED]:
  On Wednesday 26 November 2008 08:37:14 Rainer Frey wrote:
   In the MailServer constructor I do the following
  
   properties = System.getProperties();
   ...
   properties.put(mail.smtp.auth, false);
  
   so it looks like a different properties bundle is being used when I
   run this in Tomcat ... does any of this make sense ??
 
  Argh, I overlooked that you use System.getProperties() here. If you
  specify any JavaMail related Properties in JAVA_OPTS or CATALINA_OPTS
  environment variables, this will be different indeed. You might want to
  check your tomcat start script.
 
  Rainer
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat 6 and javamail

2008-11-27 Thread Caldarale, Charles R
 From: Lyallex [mailto:[EMAIL PROTECTED]
 Subject: Re: Tomcat 6 and javamail

 The mail server does not require authentication when accessed from the
 office subnet. The server guys have confirmed this.

Or is it that your mail server is configured to accept the network signon that 
each workstations uses?

 I am using the same mail server for the standalone test, the test
 where the mail component is configured to use the JNDI resource
 configured in context.xml and the test where the mail component uses
 the same configuration mechanism as the standlone test. The only test
 that fails is the last one.

And is everything running under the same account?  If you're running Tomcat as 
a Windows service, it will not be the account you logged into your workstation 
(and network)with.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-27 Thread Don Millhofer
Hi Lyallex, for everybody that is still struggling with this issue, here is a 
base non-authentication email class.  Once you get this working start adding 
the special features you need.   This worked with my hosting provider (Kattare) 
who were absolutely worthless in providing any guidance, after much testing.

import java.util.Date;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;


public class Email{
String  d_email, d_password, d_host, d_port;

public Email(String email, String password, String host, String port) {
d_email = email;
d_password = password;
d_host = host;
d_port  = port;
}

public boolean send(String m_to, String m_subject, String m_text) {
// email address
String to = m_to;
String from = d_email;
//  ISP mail server
String host = d_host;
// 
Properties props = new Properties();
// static transport.send() - need to specify which host to send it to
props.put(mail.smtp.host, host);
// To see what is going on
props.put(mail.debug, false);
//
Session session = Session.getInstance(props);
try {
// message
Message msg = new MimeMessage(session);
//message attributes
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(m_subject);
msg.setSentDate(new Date());
// message content
msg.setText(m_text);
//send
Transport.send(msg);
return true;
}
catch (MessagingException mex) {
// 
mex.printStackTrace();
return false;
}
}
 }
 
Happy holidays

Don


At 09:15 AM 11/27/2008, you wrote:
2008/11/27 Rainer Frey [EMAIL PROTECTED]:
 On Thursday 27 November 2008 12:52:56 Lyallex wrote:


 (It would be easier to answer if you'd stop top quoting - but I won't correct
 this whole mail)

Well that's most kind of you, you are being very patient.

I think I need to take a step back here. The boss is happy that
sending email from within the application is now working. I on the
other hand want to know why something that works in Tomcat 5 doesn't
work in Tomcat 6. He's less than inclined to pay for that information
however :-(

Anyway, I will certainly do some more testing, maybe install a clean
Tomcat 6 and create a simple web app that just sends email to a
preconfigured address ... whatever, I'll post results here including
code, mail debug and anything else that might help

Thanks again for your time

lyallex


 OK, firstly thanks for the feedback so far

 Let me be quite clear about one thing.
 I am using the same mail server in both cases. Tomcat and Eclipse are
 running on the same physical device with the same IP address.
 The mail server does not require authentication when accessed from the
 office subnet. The server guys have confirmed this.

 So the problem is certainly on Java side.

 If I configure a JavaMail session as described in the following resource

 http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
 (JavaMail section)

 and set auth to false in context.xml everything works perfectly when
 sending mail from the web application.

 It then should not be anything related to Javamail or Java version,
 incompatible jar files ...

 I am using the same mail server for the standalone test, the test
 where the mail component is configured to use the JNDI resource
 configured in context.xml and the test where the mail component uses
 the same configuration mechanism as the standlone test. The only test
 that fails is the last one.

 Something has changed since Tomcat 5.  I have exactly the same
 component running in several webapps on Tomcat 5 servers without any
 need to configure JNDI resources/Mail sessions etc

 In such a setup, a javamail session is no managed resource for tomcat. I 
 can't
 imagine how the tomcat version could have any influence on that. There must
 be any other difference between your eclipse runtime and this failing tomcat.

 JAVA_OPTS and CATALINA_OPTS have not been modified by me and do not
 contain anything other that the default settings (none of which appear
 to have anything to do with mail config settings).

 Is there any other webapp that might set system properties with mail related
 content? I'd make sure and use an empty Properties object for your test. the
 only reason to use System.getProperties() is the ability to pass JavaMail
 configuration to the JVM command line. I'm not sure what static variables and
 Singletons Javamail has, so I'd test without the resource 

Re: Tomcat 6 and javamail

2008-11-27 Thread Lyallex
2008/11/27 Caldarale, Charles R [EMAIL PROTECTED]:
 From: Lyallex [mailto:[EMAIL PROTECTED]
 Subject: Re: Tomcat 6 and javamail

 The mail server does not require authentication when accessed from the
 office subnet. The server guys have confirmed this.

 Or is it that your mail server is configured to accept the network signon 
 that each workstations uses?

No, it's relaying from my subnet, no authentication required
(according to the network guys anyway, I work for a hosting company
and these guys seem to know their stuff).

 I am using the same mail server for the standalone test, the test
 where the mail component is configured to use the JNDI resource
 configured in context.xml and the test where the mail component uses
 the same configuration mechanism as the standlone test. The only test
 that fails is the last one.

 And is everything running under the same account?  If you're running Tomcat 
 as a Windows service, it will not be the account you logged into your 
 workstation (and network)with.

I start Tomcat from the command line. I only ever pass the IP address
of the mail server. I can even telnet to it and send a mail from the
command line.

lyallex


  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you received 
 this in error, please contact the sender and delete the e-mail and its 
 attachments from all computers.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-26 Thread Rainer Frey
On Wednesday 26 November 2008 08:37:14 Rainer Frey wrote:
  In the MailServer constructor I do the following
 
  properties = System.getProperties();
  ...
  properties.put(mail.smtp.auth, false);
 
  so it looks like a different properties bundle is being used when I
  run this in Tomcat ... does any of this make sense ??

Argh, I overlooked that you use System.getProperties() here. If you specify 
any JavaMail related Properties in JAVA_OPTS or CATALINA_OPTS environment 
variables, this will be different indeed. You might want to check your tomcat 
start script.

Rainer


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-25 Thread Lyallex
Hello again

2008/11/19 Don Millhofer [EMAIL PROTECTED]:
 Are you sure that the mail server, serving the host you are deploying to does 
 not require authentication?  I got this same error trying to go through the 
 Google Mail Server without proper authentication.


I am absolutely sure that the mail server I am using for the
standalone test is the same one that I am using for the tomcat server.

I tried setting mail.smtp.auth = true and the send failed in Eclipse,
the debug output was exactly the same as when I run the code
in Tomcat Authentication failure

I then hardcoded properties.put(mail.smtp.auth, false); in the
MailServer constructor  and ran the Eclipse test, it worked, so I ran
it in Tomcat and it failed with Authentication exception 

In the MailServer constructor I do the following

properties = System.getProperties();
...
properties.put(mail.smtp.auth, false);

so it looks like a different properties bundle is being used when I
run this in Tomcat ... does any of this make sense ??

Thanks
lyallex



 when I invoke the component in the webapp I get
 javax.mail.AuthenticationFailedException
 debug output shows that my components configuration parameters are
 IDENTICAL to those used in standalone mode.

 You say in Eclipse you use -  (mail.smtp.auth = false) and sends the email.  
 Try sending authentication.

private class SMTPAuthenticator extends javax.mail.Authenticator {
@ Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(d_email, d_password);
}
}

 Don


 At 06:41 AM 11/25/2008, you wrote:
Start by making sure there is only one copy of the javamail jar.
Remove either the one in tomcat's lib directory or your webapp's lib
directory.

-- David


On Nov 19, 2008, at 6:04 AM, Lyallex [EMAIL PROTECTED] wrote:

Hi

Tomcat 6.0.16
jdk1.6.0_06
javamail 1.4.1

I have a simple component that uses javamail 1.4.1 to send e-mail
It works perfectly 'standalone' (executed from Eclipse).
It connects to the server (mail.smtp.auth = false)
and sends the email

I've read the available docs at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
which talk about activation.jar among others
As I am using jdk 1.6 I understand that this is no longer required (it
is included in the distro).

The javamail 1.4.1 jars are in CATALINA_HOME/lib
I have also tried them in WEB-INF/classes/lib

when I invoke the component in the webapp I get
javax.mail.AuthenticationFailedException
debug output shows that my components configuration parameters are
IDENTICAL to those used in standalone mode.

I am not using jndi resources or resources defined in context.xml, I
am not using tomcats JavaMail session management.

I just need this to work as a simple component without lots of config
to start with.

Can anyone let me in on the 'secret' to getting this to work. I've had
similar components working in earlier releases (and they are still
working)
Something must have changed, I'm rather hoping it's not a securuity
thing but I suspect it might be.

I'm not asking anyone to debug my application I could just do with a
pointer or two.

Any help much appreciated

Cheers
lyallex

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-25 Thread Rainer Frey
On Tuesday 25 November 2008 15:09:54 Lyallex wrote:
 Hello again

 2008/11/19 Don Millhofer [EMAIL PROTECTED]:
  Are you sure that the mail server, serving the host you are deploying to
  does not require authentication?  I got this same error trying to go
  through the Google Mail Server without proper authentication.

 I am absolutely sure that the mail server I am using for the
 standalone test is the same one that I am using for the tomcat server.

This is no answer to above question.

 I tried setting mail.smtp.auth = true and the send failed in Eclipse,
 the debug output was exactly the same as when I run the code
 in Tomcat Authentication failure

Are you running Tomcat on the same machine as Eclipse? The mail server may 
require authentication for some machines, but not for others


 I then hardcoded properties.put(mail.smtp.auth, false); in the
 MailServer constructor  and ran the Eclipse test, it worked, so I ran
 it in Tomcat and it failed with Authentication exception 

 In the MailServer constructor I do the following

 properties = System.getProperties();
 ...
 properties.put(mail.smtp.auth, false);

 so it looks like a different properties bundle is being used when I
 run this in Tomcat ... does any of this make sense ??

Tomcat does not automagically change your code. If this is passed in your 
code, it is used.

  You say in Eclipse you use -  (mail.smtp.auth = false) and sends the
  email.  Try sending authentication.
 
 private class SMTPAuthenticator extends javax.mail.Authenticator {
 @ Override
 public PasswordAuthentication getPasswordAuthentication() {
 return new PasswordAuthentication(d_email, d_password);
 }
 }

Did you try that? If the mail server says it wants authentication, it's no use 
forcing JavaMail to not authenticate.


 Thanks
 lyallex

Rainer

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-19 Thread David Smith
Start by making sure there is only one copy of the javamail jar.   
Remove either the one in tomcat's lib directory or your webapp's lib  
directory.


-- David


On Nov 19, 2008, at 6:04 AM, Lyallex [EMAIL PROTECTED] wrote:


Hi

Tomcat 6.0.16
jdk1.6.0_06
javamail 1.4.1

I have a simple component that uses javamail 1.4.1 to send e-mail
It works perfectly 'standalone' (executed from Eclipse).
It connects to the server (mail.smtp.auth = false)
and sends the email

I've read the available docs at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
which talk about activation.jar among others
As I am using jdk 1.6 I understand that this is no longer required (it
is included in the distro).

The javamail 1.4.1 jars are in CATALINA_HOME/lib
I have also tried them in WEB-INF/classes/lib

when I invoke the component in the webapp I get
javax.mail.AuthenticationFailedException
debug output shows that my components configuration parameters are
IDENTICAL to those used in standalone mode.

I am not using jndi resources or resources defined in context.xml, I
am not using tomcats JavaMail session management.

I just need this to work as a simple component without lots of config
to start with.

Can anyone let me in on the 'secret' to getting this to work. I've had
similar components working in earlier releases (and they are still
working)
Something must have changed, I'm rather hoping it's not a securuity
thing but I suspect it might be.

I'm not asking anyone to debug my application I could just do with a
pointer or two.

Any help much appreciated

Cheers
lyallex

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat 6 and javamail

2008-11-19 Thread Lyallex
Hi

Tomcat 6.0.16
jdk1.6.0_06
javamail 1.4.1

I have a simple component that uses javamail 1.4.1 to send e-mail
It works perfectly 'standalone' (executed from Eclipse).
It connects to the server (mail.smtp.auth = false)
and sends the email

I've read the available docs at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
which talk about activation.jar among others
As I am using jdk 1.6 I understand that this is no longer required (it
is included in the distro).

The javamail 1.4.1 jars are in CATALINA_HOME/lib
I have also tried them in WEB-INF/classes/lib

when I invoke the component in the webapp I get
javax.mail.AuthenticationFailedException
debug output shows that my components configuration parameters are
IDENTICAL to those used in standalone mode.

I am not using jndi resources or resources defined in context.xml, I
am not using tomcats JavaMail session management.

I just need this to work as a simple component without lots of config
to start with.

Can anyone let me in on the 'secret' to getting this to work. I've had
similar components working in earlier releases (and they are still
working)
Something must have changed, I'm rather hoping it's not a securuity
thing but I suspect it might be.

I'm not asking anyone to debug my application I could just do with a
pointer or two.

Any help much appreciated

Cheers
lyallex

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-19 Thread Lyallex
Hi

Well I've had problems with this before.

As I'm sure you know, the JavaMail API 1.4.1 distribution contains
dsn.jar, imap.jar, mailapi.jar, pop3.jar and smtp.jar

I was very careful to make sure that I only had the above jars in
EITHER the web application's lib directory (WEB-INF/lib) OR tomcat's
lib directory (../apache-tomcat-6.0.16/lib) restarting every time I
made a change.

I just tried again, searching the entire tomcat filesystem each time
to ensure that there were no duplicates but still no luck.

Unfortunately the mail server admin is being less than helpful so I
can't even see what is happening at the other end.

Any other ideas ?

Thanks anyway
lyallex

2008/11/25 David Smith [EMAIL PROTECTED]:
 Start by making sure there is only one copy of the javamail jar.  Remove
 either the one in tomcat's lib directory or your webapp's lib directory.

 -- David


 On Nov 19, 2008, at 6:04 AM, Lyallex [EMAIL PROTECTED] wrote:

 Hi

 Tomcat 6.0.16
 jdk1.6.0_06
 javamail 1.4.1

 I have a simple component that uses javamail 1.4.1 to send e-mail
 It works perfectly 'standalone' (executed from Eclipse).
 It connects to the server (mail.smtp.auth = false)
 and sends the email

 I've read the available docs at
 http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
 which talk about activation.jar among others
 As I am using jdk 1.6 I understand that this is no longer required (it
 is included in the distro).

 The javamail 1.4.1 jars are in CATALINA_HOME/lib
 I have also tried them in WEB-INF/classes/lib

 when I invoke the component in the webapp I get
 javax.mail.AuthenticationFailedException
 debug output shows that my components configuration parameters are
 IDENTICAL to those used in standalone mode.

 I am not using jndi resources or resources defined in context.xml, I
 am not using tomcats JavaMail session management.

 I just need this to work as a simple component without lots of config
 to start with.

 Can anyone let me in on the 'secret' to getting this to work. I've had
 similar components working in earlier releases (and they are still
 working)
 Something must have changed, I'm rather hoping it's not a securuity
 thing but I suspect it might be.

 I'm not asking anyone to debug my application I could just do with a
 pointer or two.

 Any help much appreciated

 Cheers
 lyallex

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 6 and javamail

2008-11-19 Thread Don Millhofer
Are you sure that the mail server, serving the host you are deploying to does 
not require authentication?  I got this same error trying to go through the 
Google Mail Server without proper authentication.

when I invoke the component in the webapp I get
javax.mail.AuthenticationFailedException
debug output shows that my components configuration parameters are
IDENTICAL to those used in standalone mode.

You say in Eclipse you use -  (mail.smtp.auth = false) and sends the email.  
Try sending authentication.

private class SMTPAuthenticator extends javax.mail.Authenticator {
@ Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(d_email, d_password);
}
}

Don


At 06:41 AM 11/25/2008, you wrote:
Start by making sure there is only one copy of the javamail jar.   
Remove either the one in tomcat's lib directory or your webapp's lib  
directory.

-- David


On Nov 19, 2008, at 6:04 AM, Lyallex [EMAIL PROTECTED] wrote:

Hi

Tomcat 6.0.16
jdk1.6.0_06
javamail 1.4.1

I have a simple component that uses javamail 1.4.1 to send e-mail
It works perfectly 'standalone' (executed from Eclipse).
It connects to the server (mail.smtp.auth = false)
and sends the email

I've read the available docs at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
which talk about activation.jar among others
As I am using jdk 1.6 I understand that this is no longer required (it
is included in the distro).

The javamail 1.4.1 jars are in CATALINA_HOME/lib
I have also tried them in WEB-INF/classes/lib

when I invoke the component in the webapp I get
javax.mail.AuthenticationFailedException
debug output shows that my components configuration parameters are
IDENTICAL to those used in standalone mode.

I am not using jndi resources or resources defined in context.xml, I
am not using tomcats JavaMail session management.

I just need this to work as a simple component without lots of config
to start with.

Can anyone let me in on the 'secret' to getting this to work. I've had
similar components working in earlier releases (and they are still
working)
Something must have changed, I'm rather hoping it's not a securuity
thing but I suspect it might be.

I'm not asking anyone to debug my application I could just do with a
pointer or two.

Any help much appreciated

Cheers
lyallex

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]