[email] JavaMail works Commons Email does not

2012-01-10 Thread Frank Sullivan
I have a web application (Flex, Spring, Hibernate) that has a simple email 
module that uses Common Email.  Currently it only sends plain text messages. 
Here is basically what happens:

HtmlEmail email = new HtmlEmail();
email.setHostName(smtpHost);
email.setAuthentication(smtpUser, smtpPassword);
email.setTextMsg(plainText);
email.setSubject(subject);
email.addTo(recipientAddress);
email.setFrom(fromAddress);
email.send();

The problem is that is only works when invoke it from simple Java application.  
It does not work from a within the Spring service that is running in the Tomcat 
container.  Even weirder is that if I put straight JavaMail code in the Spring 
service, it works!

Properties props = new Properties();
props.put(mail.smtp.host, smtpHost);
props.put(mail.smtp.user, smtpUser);
props.put(mail.smtp.password, smtpPassword);
Session session = Session.getDefaultInstance(props);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(fromAddress));
msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new 
InternetAddress(recipientAddress)});
msg.setSubject(subject);
msg.setText(plainText);
Transport.send(msg);

Any clues?

Thanks, Frank Sullivan


Re: [email] JavaMail works Commons Email does not

2012-01-10 Thread Konstantin Kolinko
2012/1/10 Frank Sullivan fsulli...@strikeind.com:
 I have a web application (Flex, Spring, Hibernate) that has a simple email 
 module that uses Common Email.  Currently it only sends plain text messages. 
 Here is basically what happens:

 HtmlEmail email = new HtmlEmail();
 email.setHostName(smtpHost);
 email.setAuthentication(smtpUser, smtpPassword);
 email.setTextMsg(plainText);
 email.setSubject(subject);
 email.addTo(recipientAddress);
 email.setFrom(fromAddress);
 email.send();

 The problem is that is only works when invoke it from simple Java 
 application.  It does not work from a within the Spring service that is 
 running in the Tomcat container.  Even weirder is that if I put straight 
 JavaMail code in the Spring service, it works!

 Properties props = new Properties();
 props.put(mail.smtp.host, smtpHost);
 props.put(mail.smtp.user, smtpUser);
 props.put(mail.smtp.password, smtpPassword);
 Session session = Session.getDefaultInstance(props);
 Message msg = new MimeMessage(session);
 msg.setFrom(new InternetAddress(fromAddress));
 msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new 
 InternetAddress(recipientAddress)});
 msg.setSubject(subject);
 msg.setText(plainText);
 Transport.send(msg);

 Any clues?


How exactly it fails?
What exception is there if any?

Best regards,
Konstantin Kolinko

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



RE: [email] JavaMail works Commons Email does not

2012-01-10 Thread Frank Sullivan
Nothing happens.  No exceptions.  No logging (I set logging for 
org.apache.commons.mail to TRACE).  Nothing.

Thanks, Frank


-Original Message-
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] 
Sent: Tuesday, January 10, 2012 5:37 AM
To: Commons Users List
Subject: Re: [email] JavaMail works Commons Email does not

2012/1/10 Frank Sullivan fsulli...@strikeind.com:
 I have a web application (Flex, Spring, Hibernate) that has a simple email 
 module that uses Common Email.  Currently it only sends plain text messages. 
 Here is basically what happens:

 HtmlEmail email = new HtmlEmail();
 email.setHostName(smtpHost);
 email.setAuthentication(smtpUser, smtpPassword); 
 email.setTextMsg(plainText); email.setSubject(subject); 
 email.addTo(recipientAddress); email.setFrom(fromAddress); 
 email.send();

 The problem is that is only works when invoke it from simple Java 
 application.  It does not work from a within the Spring service that is 
 running in the Tomcat container.  Even weirder is that if I put straight 
 JavaMail code in the Spring service, it works!

 Properties props = new Properties();
 props.put(mail.smtp.host, smtpHost); props.put(mail.smtp.user, 
 smtpUser); props.put(mail.smtp.password, smtpPassword); Session 
 session = Session.getDefaultInstance(props);
 Message msg = new MimeMessage(session); msg.setFrom(new 
 InternetAddress(fromAddress)); 
 msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new 
 InternetAddress(recipientAddress)});
 msg.setSubject(subject);
 msg.setText(plainText);
 Transport.send(msg);

 Any clues?


How exactly it fails?
What exception is there if any?

Best regards,
Konstantin Kolinko

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


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



Re: [email] JavaMail works Commons Email does not

2012-01-10 Thread Christian Grobmeier
On Tue, Jan 10, 2012 at 11:54 AM, Frank Sullivan
fsulli...@strikeind.com wrote:
 Nothing happens.  No exceptions.  No logging (I set logging for 
 org.apache.commons.mail to TRACE).  Nothing.

Thats weird. Have you tried to debug and look if all properties are
set or if the code is actually called?
Cheers

 Thanks, Frank


 -Original Message-
 From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
 Sent: Tuesday, January 10, 2012 5:37 AM
 To: Commons Users List
 Subject: Re: [email] JavaMail works Commons Email does not

 2012/1/10 Frank Sullivan fsulli...@strikeind.com:
 I have a web application (Flex, Spring, Hibernate) that has a simple email 
 module that uses Common Email.  Currently it only sends plain text messages. 
 Here is basically what happens:

 HtmlEmail email = new HtmlEmail();
 email.setHostName(smtpHost);
 email.setAuthentication(smtpUser, smtpPassword);
 email.setTextMsg(plainText); email.setSubject(subject);
 email.addTo(recipientAddress); email.setFrom(fromAddress);
 email.send();

 The problem is that is only works when invoke it from simple Java 
 application.  It does not work from a within the Spring service that is 
 running in the Tomcat container.  Even weirder is that if I put straight 
 JavaMail code in the Spring service, it works!

 Properties props = new Properties();
 props.put(mail.smtp.host, smtpHost); props.put(mail.smtp.user,
 smtpUser); props.put(mail.smtp.password, smtpPassword); Session
 session = Session.getDefaultInstance(props);
 Message msg = new MimeMessage(session); msg.setFrom(new
 InternetAddress(fromAddress));
 msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new
 InternetAddress(recipientAddress)});
 msg.setSubject(subject);
 msg.setText(plainText);
 Transport.send(msg);

 Any clues?


 How exactly it fails?
 What exception is there if any?

 Best regards,
 Konstantin Kolinko

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


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




-- 
http://www.grobmeier.de
https://www.timeandbill.de

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



[dbcp] BasicDataSource.createConnectionFactory() fails

2012-01-10 Thread GMail - Ugo Gagliardelli
I'm trying to use BasicDataSource 1.3 (latest release downloaded just 
now) using a custom classloader. In other words I set a ClassLoader with 
setDriverClassLoader method.
When I try to create a connection, I get an SQL Exception from 
createConnectionFactory(). Looking at source code, I see that 
createConnectionFactory method, still use:

 driver = DriverManager.getDriver(url);
that will not use the correct classloader, infact it uses what returned 
by getCallerClassLoader(), that's a classloader not able to resolve the 
driver class.


How can I have this figure work?

This is my code (Spring based):

bean id=propertyConfigurer

class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

property name=location
valuefile:///${user.dir}/config.properties/value
/property
/bean

bean id=jarClassloarder class=java.net.URLClassLoader
constructor-arg
list
bean id=jarURL class=java.net.URL
constructor-arg value=file://${db.driver.jar}/
/bean
/list
/constructor-arg
/bean
bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource
property name=driverClassLoader ref=jarClassloarder /
property name=driverClassName
value${db.driver.class}/value
/property
property name=url
value${db.driver.url}/value
/property
property name=username
value${db.driver.username}/value
/property
property name=password
value${db.driver.password}/value
/property
/bean



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



Re: [email] JavaMail works Commons Email does not

2012-01-10 Thread Siegfried Goeschl

Hi folks,

it is also useful to call Mail.setDebug(true) which turns on the 
debugging of the mail session. Having said that some stepping though the 
code might provide some insight ... :-)


Cheers,

Siegfried Goeschl

On 10.01.12 12:06, Christian Grobmeier wrote:

On Tue, Jan 10, 2012 at 11:54 AM, Frank Sullivan
fsulli...@strikeind.com  wrote:

Nothing happens.  No exceptions.  No logging (I set logging for 
org.apache.commons.mail to TRACE).  Nothing.

Thats weird. Have you tried to debug and look if all properties are
set or if the code is actually called?
Cheers


Thanks, Frank


-Original Message-
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
Sent: Tuesday, January 10, 2012 5:37 AM
To: Commons Users List
Subject: Re: [email] JavaMail works Commons Email does not

2012/1/10 Frank Sullivanfsulli...@strikeind.com:

I have a web application (Flex, Spring, Hibernate) that has a simple email 
module that uses Common Email.  Currently it only sends plain text messages. 
Here is basically what happens:

HtmlEmail email = new HtmlEmail();
email.setHostName(smtpHost);
email.setAuthentication(smtpUser, smtpPassword);
email.setTextMsg(plainText); email.setSubject(subject);
email.addTo(recipientAddress); email.setFrom(fromAddress);
email.send();

The problem is that is only works when invoke it from simple Java application.  
It does not work from a within the Spring service that is running in the Tomcat 
container.  Even weirder is that if I put straight JavaMail code in the Spring 
service, it works!

Properties props = new Properties();
props.put(mail.smtp.host, smtpHost); props.put(mail.smtp.user,
smtpUser); props.put(mail.smtp.password, smtpPassword); Session
session = Session.getDefaultInstance(props);
Message msg = new MimeMessage(session); msg.setFrom(new
InternetAddress(fromAddress));
msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new
InternetAddress(recipientAddress)});
msg.setSubject(subject);
msg.setText(plainText);
Transport.send(msg);

Any clues?


How exactly it fails?
What exception is there if any?

Best regards,
Konstantin Kolinko

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


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






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