Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

2009-11-16 Thread Jörg Schaible
Java Struts wrote at Montag, 16. November 2009 22:41:

> Could you please tell me the format of the manifest file?
> 
> do i have to add every thing in the same line with space as delimiter?

http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html

Delimiter is space, line may not exceed 72 characters (well, bytes) and must
be continued then. Have a look at the manifest Maven or Ant is creating.

- Jörg


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



[VFS] sftp upload fails with permission denied error while setting the last updated timestamp

2009-11-16 Thread Bhaskar Annamalai
Hi,
  I tried to use VFS for uploading a file to a sftp url. The file gets
uploaded to the location which is specified in the url. But it gets a
permission denied error while setting the last updated time of the file.
Below is the stack trace of the error.


org.apache.commons.vfs.FileSystemException: Could not set the last
modified timestamp of .
at
org.apache.commons.vfs.provider.DefaultFileContent.setLastModifiedTime(D
efaultFileContent
.java:196)
at
org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileOb
ject.java:1001)
at
org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterP
rocessing(VFSTran
sportListener.java:331)
at
org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirector
y(VFSTransportLis
tener.java:262)
at
org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportL
istener.java:154)

at
org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportL
istener.java:117)

at
org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run
(AbstractPollingT
ransportListener.java:99)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWor
kerPool.java:58)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: 3: Permission denied
at
com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
at com.jcraft.jsch.ChannelSftp._setStat(ChannelSftp.java:1871)
at com.jcraft.jsch.ChannelSftp.setStat(ChannelSftp.java:1845)
at
org.apache.commons.vfs.provider.sftp.SftpFileObject.doSetLastModifiedTim
e(SftpFileObject.
java:237)
at
org.apache.commons.vfs.provider.AbstractFileObject.doSetLastModTime(Abst
ractFileObject.ja
va:262)
at
org.apache.commons.vfs.provider.DefaultFileContent.setLastModifiedTime(D
efaultFileContent
.java:189)
... 10 more

Please suggest.

Thanks,
Bhaskar

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



[POOL] persisted pool

2009-11-16 Thread Aju Badardeen
Hi,

 

Does apache commons pool library provide a means to persist the pooled
objects ? 

 

The basic problem I am trying to solve is: I have multiple webservers
for redundancy and each has a pool  of sessions for authentication that
I use. The number of sessions that I can get is limited so I cannot
fully populate the pools on all my redundant servers. The idea is to
have a common persistence to which all the pools will point. 

 

Any pointers are appreciated.

 

Thanks,

Aj

 



Re: [EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Petite Abeille

On Nov 16, 2009, at 4:45 PM, Christopher Schultz wrote:

> STARTTLS-over-SMTP will give you better performance, because only the
> authentication is encrypted and not the entire SMTP conversation.

Hmm... are you sure? 

AFAIK, STARTTLS promotes a plain connection to an encrypted one, irrespectively 
of any authentication mechanisms:

http://en.wikipedia.org/wiki/STARTTLS

Once a connection is upgraded, it stays encrypted. 

Perhaps you are referring to SASL, which deals with authentication?

One way or another, way too many acronyms :D

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



Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

2009-11-16 Thread Java Struts
Could you please tell me the format of the manifest file?

do i have to add every thing in the same line with space as delimiter?

Thanks,

On Mon, Nov 16, 2009 at 4:19 PM, Jörg Schaible wrote:

> Java Struts wrote:
>
> > Hey thanks a lot for the response...
> >
> > I have added the below code to the my code and i am getting the below
> > exception. It is able to find the jar file location but i am getting the
> > exception for the below line.
> > JarFile jarFile = new JarFile(new File(loc.toURI()));
> >
> > The exception is here..
> >
> > Illegal character in path at index 16: file:/C:/Program
> >
>
> Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
> > : java.net.URISyntaxException: Illegal character in path at index 16:
> >
> > don't know wht's going on.. Here is the manifest file for the same.
> >
> > Manifest-Version: 1.0
> > Class-Path: TeleworkServiceJAVA.jar
> >  lib/commons-codec-1.4.jar
> >  lib/classes12.jar
> >  lib/commons-logging.jar
> >  lib/j2ee.jar
> >  lib/log4j-1.2.15.jar
> >  lib/commons-lang-2.4.jar
> >
> > One more thing is.. i have added the same code to a simple standalone
> java
> > class file and which is working fine. But why it's giving the problem at
> > the webspehere level i don't know...
>
> The format of the manifest file is simply wrong, it fails after
> the "Class-Path:" line and will not find the other libraries.
>
> - Jörg
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefano,

On 11/16/2009 1:27 PM, Stefano "Kismet" Lenzi wrote:
> On Mon, Nov 16, 2009 at 16:45, Christopher Schultz
>  wrote:
>>
>> Try setting -Dmail.debug=true and run it again. This will give you much
>> more output from Javamail.
> 
> I have tried to set the option but the output didn't change

Hmm... that's strange. I thought javamail would read system properties
as well as those set directly using a java.util.Properties object, but
maybe it doesn't. Commons-email doesn't appear to give you the option of
setting javamail properties directly, but it does allow you to set the
javamail session like this:

Properties props = new Properties();
props.put("mail.transport.protocol", "smtps");
...

Session session = Session.getDefaultInstance(props);

...
email.setMailSession(session);
email.send();

This should allow you to set properties such as mail.debug,
mail.transport.protocol, etc.

>>> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL 
>>> false
>>
>> See that SSL=false. If you want SSL, use setSSL(true) instead of
>> setTLS(true).
> 
> I don't know why I haven't tried it before, but I'm glad to say that
> it worked :)

Glad to help.

> In particular, the lines:
> "DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> Microsystems, Inc]"

I don't find anything strange about the above log message, do you?

> "DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL 
> false"

Now /that/ is strange if you have set SSL=true. Perhaps there's a bug in
the debug logging.

I have found that commons-email acts strangely in a number of
circumstances. I unfortunately had to abandon its use a while back in
order to be able to send attachments along with text *and* HTML email
messages. I wrote my own wrapper with what I believe is a simpler API.
You are welcome to it: http://www.christopherschultz.net/projects/java/

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksBw5IACgkQ9CaO5/Lv0PAkTgCffhkbKXQCSp1y5UB4XfOnBi5x
NRgAoJQtnIbh60dVUlXIh78tux/mY2+6
=4S7Y
-END PGP SIGNATURE-

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



Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

2009-11-16 Thread Jörg Schaible
Java Struts wrote:

> Hey thanks a lot for the response...
> 
> I have added the below code to the my code and i am getting the below
> exception. It is able to find the jar file location but i am getting the
> exception for the below line.
> JarFile jarFile = new JarFile(new File(loc.toURI()));
> 
> The exception is here..
> 
> Illegal character in path at index 16: file:/C:/Program
>
Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
> : java.net.URISyntaxException: Illegal character in path at index 16:
> 
> don't know wht's going on.. Here is the manifest file for the same.
> 
> Manifest-Version: 1.0
> Class-Path: TeleworkServiceJAVA.jar
>  lib/commons-codec-1.4.jar
>  lib/classes12.jar
>  lib/commons-logging.jar
>  lib/j2ee.jar
>  lib/log4j-1.2.15.jar
>  lib/commons-lang-2.4.jar
> 
> One more thing is.. i have added the same code to a simple standalone java
> class file and which is working fine. But why it's giving the problem at
> the webspehere level i don't know...

The format of the manifest file is simply wrong, it fails after
the "Class-Path:" line and will not find the other libraries.

- Jörg


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



Re: [EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Siegfried Goeschl
Hi folks,

see my comments below ...

Cheers,

Siegfried Goeschl

Stefano "Kismet" Lenzi wrote:
> On Mon, Nov 16, 2009 at 16:45, Christopher Schultz
>  wrote:
>   
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Stephano,
>>
>> On 11/16/2009 9:43 AM, Stefano "Kismet" Lenzi wrote:
>> 
>>> I was trying to use the Commons Email project for sending email with
>>> the Google provider, but I failed. I tried with the following code
>>>   SimpleEmail email = new SimpleEmail();
>>>   email.setDebug(true);
>>>   email.addTo(MAIL_DESTINATION, "Stefano Lenzi");
>>>   email.setFrom(MAIL_SENDER, "Test");
>>>   email.setSubject("Test message");
>>>   email.setMsg("This is a simple test of commons-email");
>>>   email.setHostName(SMTP_HOST_NAME);
>>>   email.setAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD);
>>>   email.setTLS(true);
>>>   email.setSmtpPort(SMTP_HOST_PORT);
>>>   email.send();
>>> but nothing happened.
>>>   
>> Try setting -Dmail.debug=true and run it again. This will give you much
>> more output from Javamail.
>> 
>
> I have tried to set the option but the output didn't change
>
>   
[SG] you already enabled the debug mode using email.setDebug()
>> It's unclear from the javadoc, but it's possible that setTLS(true)
>> merely configures Javamail to use STARTTLS over a plaintext SMTP
>> connection. If you want to use SMTPS, try setting
>> - -Dmail.transport.protocol=smtps to see if that helps.
>> 
>
> Even the -Dmail.transport.protocol=smtps  system property didn't
> change anything, it looks like that the system properties are not used
> by Commons Email
>   
[SG] correct - all the required properties are set within commons-email
thereby not relying on system properties.
>   
>>> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL 
>>> false
>>>   
>> See that SSL=false. If you want SSL, use setSSL(true) instead of
>> setTLS(true).
>> 
>
> I don't know why I haven't tried it before, but I'm glad to say that
> it worked :)
> It's strange that the first lines of the output didn't change
>   
[SG] Should provide some Q&A covering connectivity to GMAIL
> DEBUG: JavaMail version 1.4.1ea-SNAPSHOT
> DEBUG: not loading file: C:\Programmi\Java\jre6\lib\javamail.providers
> DEBUG: java.io.FileNotFoundException:
> C:\Programmi\Java\jre6\lib\javamail.providers (Impossibile trovare il
> file specificato)
> 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: not loading file: C:\Programmi\Java\jre6\lib\javamail.address.map
> DEBUG: java.io.FileNotFoundException:
> C:\Programmi\Java\jre6\lib\javamail.address.map (Impossibile trovare
> il file specificato)
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> DEBUG SMTP: useEhlo true, useAuth true
> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
> 220 mx.google.com ESMTP 3sm5919994fge.24
> DEBUG SMTP: connected to host "smtp.gmail.com", port: 465
>
> In particular, the lines:
> "DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTran

Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

2009-11-16 Thread Java Struts
Hey thanks a lot for the response...

I have added the below code to the my code and i am getting the below
exception. It is able to find the jar file location but i am getting the
exception for the below line.
JarFile jarFile = new JarFile(new File(loc.toURI()));

The exception is here..

Illegal character in path at index 16: file:/C:/Program
Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
: java.net.URISyntaxException: Illegal character in path at index 16:

don't know wht's going on.. Here is the manifest file for the same.

Manifest-Version: 1.0
Class-Path: TeleworkServiceJAVA.jar
 lib/commons-codec-1.4.jar
 lib/classes12.jar
 lib/commons-logging.jar
 lib/j2ee.jar
 lib/log4j-1.2.15.jar
 lib/commons-lang-2.4.jar

One more thing is.. i have added the same code to a simple standalone java
class file and which is working fine. But why it's giving the problem at the
webspehere level i don't know...


Could you please help me on this.

Thanks,
Srini.


On Tue, Nov 10, 2009 at 4:25 PM, James Carman wrote:

> It's obviously a classpath issue.  Throw this code somewhere where it
> can be executed in your environment where you're having troubles:
>
> final URL loc =
> Hex.class.getProtectionDomain().getCodeSource().getLocation();
> System.out.println("Found jar file at " + loc);
> final JarFile jarFile = new JarFile(new File(loc.toURI()));
> System.out.println("The version is " +
>
> jarFile.getManifest().getMainAttributes().getValue("Specification-Version"));
>
> On Tue, Nov 10, 2009 at 2:59 PM, Java Struts  wrote:
> > Hi Julis,
> >
> > Thanks a lot for the response. Here is the info. I am thinking it might
> be
> > the classpath issue. But i am not 100% sure.
> >
> > Thanks,
> >
> >
> > On Tue, Nov 10, 2009 at 2:12 PM, Julius Davies  >wrote:
> >
> >> Hi,
> >>
> >> Can you supply some version information?
> >>
> >> Local machine
> >> -
> >> OS Type and Version? *Windows Xp Pro*
> >> Java Version? *1.5*
> >> Websphere version? *6.0*
> >> Commons-Codec version? *1.4*
> >>
> >>
> >> Dev machine
> >> -
> >> OS Type and Version?   Linux. *HP-UX,  B.11.11 *
> >> Java Version? :1.5
> >> Websphere version? 6.0
> >> Commons-Codec version? 1.4
> >>
> >>
> >> Also, can you find out if any different versions of commons-codec are
> >> also present on the dev machine?  Perhaps several versions of the jar
> >> file are sitting around, and Websphere is picking up an old one?
> >>
> >>
> >>
> >> yours,
> >>
> >> Julius
> >>
> >>
> >>
> >>
> >>
> >> On Tue, Nov 10, 2009 at 10:13 AM, Java Struts 
> wrote:
> >> > Hi Folks,
> >> >
> >> > I am using Apache Commons Codec, to convert the encrypted bytes into a
> >> > HexString to pass through the URL. So when i am using it in local
> machine
> >> > which is working fine. when the same into Dev(Linux websphere) it's
> not
> >> > working and it's throwing the following exception.
> >> >
> >> > *java.lang.NoSuchMethodError:
> >> >
> >>
> org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;*
> >> >
> >> > Here is the code i am using for it.
> >> >
> >> > *public static String encryptString(SecretKey key, String input)
> throws
> >> > NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException
> {
> >> >logger.error(" Input String to Encrypt: " + input );
> >> >Cipher cipher = Cipher.getInstance("DESede");
> >> >cipher.init(Cipher.ENCRYPT_MODE, key);
> >> >//byte[] inputBytes = input.getBytes();
> >> >String encryptedString ="";
> >> >byte[] inputBytes;
> >> >
> >> >try {
> >> >logger.error(" Inside Try block of Encrypted String
> Method");
> >> >inputBytes = input.getBytes("UTF-8");
> >> >byte[] encryptedBytes= cipher.doFinal(inputBytes);
> >> >logger.error(" got encrypted bytes");
> >> >
> >> >encryptedString= Hex.encodeHexString(encryptedBytes);
> >> >logger.error(" Encrypted String : " +encryptedString);
> >> >}
> >> >catch (UnsupportedEncodingException e) {
> >> >// TODO Auto-generated catch block
> >> >logger.error("Inside Unsupported Catch Block " +
> >> e.getMessage()
> >> > + " : "+  e );
> >> >e.printStackTrace();
> >> >
> >> >
> >> >}
> >> >catch (Throwable e) {
> >> >// TODO Auto-generated catch block
> >> >logger.error("Inside Exception Catch Block " +
> e.getMessage()
> >> +
> >> > " : " +e );
> >> >e.printStackTrace();
> >> >}
> >> >return encryptedString;*
> >> >
> >> >
> >> > Could you please help me guys, I am just wondering why this is
> throwing
> >> in
> >> > Dev. It's throwing the exceptions at the below line.
> >> >
> >> >  *encryptedString= Hex.encodeHexString(encryptedBytes);
> >> > *
> >> > and catching at here
> >> >
> >> > *catch (Throwable

Re: [EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Stefano "Kismet" Lenzi
On Mon, Nov 16, 2009 at 16:45, Christopher Schultz
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Stephano,
>
> On 11/16/2009 9:43 AM, Stefano "Kismet" Lenzi wrote:
>> I was trying to use the Commons Email project for sending email with
>> the Google provider, but I failed. I tried with the following code
>>               SimpleEmail email = new SimpleEmail();
>>               email.setDebug(true);
>>               email.addTo(MAIL_DESTINATION, "Stefano Lenzi");
>>               email.setFrom(MAIL_SENDER, "Test");
>>               email.setSubject("Test message");
>>               email.setMsg("This is a simple test of commons-email");
>>               email.setHostName(SMTP_HOST_NAME);
>>               email.setAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD);
>>               email.setTLS(true);
>>               email.setSmtpPort(SMTP_HOST_PORT);
>>               email.send();
>> but nothing happened.
>
> Try setting -Dmail.debug=true and run it again. This will give you much
> more output from Javamail.

I have tried to set the option but the output didn't change

>
> It's unclear from the javadoc, but it's possible that setTLS(true)
> merely configures Javamail to use STARTTLS over a plaintext SMTP
> connection. If you want to use SMTPS, try setting
> - -Dmail.transport.protocol=smtps to see if that helps.

Even the -Dmail.transport.protocol=smtps  system property didn't
change anything, it looks like that the system properties are not used
by Commons Email

>
>> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
>
> See that SSL=false. If you want SSL, use setSSL(true) instead of
> setTLS(true).

I don't know why I haven't tried it before, but I'm glad to say that
it worked :)
It's strange that the first lines of the output didn't change

DEBUG: JavaMail version 1.4.1ea-SNAPSHOT
DEBUG: not loading file: C:\Programmi\Java\jre6\lib\javamail.providers
DEBUG: java.io.FileNotFoundException:
C:\Programmi\Java\jre6\lib\javamail.providers (Impossibile trovare il
file specificato)
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: not loading file: C:\Programmi\Java\jre6\lib\javamail.address.map
DEBUG: java.io.FileNotFoundException:
C:\Programmi\Java\jre6\lib\javamail.address.map (Impossibile trovare
il file specificato)
DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
220 mx.google.com ESMTP 3sm5919994fge.24
DEBUG SMTP: connected to host "smtp.gmail.com", port: 465

In particular, the lines:
"DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]"
"DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false"

>
> I'm not sure what gmail prefers and/or requires, but generally
> STARTTLS-over-SMTP will give you better performance, because only the
> authentication is encrypted and not the entire SMTP conversation.
>
>> http://www.rgagnon.com/javadetails/java-0570.html
>
> That page indicates that GMail requires SSL, not TLS. Try changing
> setTLS(true) to setSSL(true) and see if that works.
>
> Hope that helps,
> - -chris

Thank you it helped!


Re: [EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stephano,

On 11/16/2009 9:43 AM, Stefano "Kismet" Lenzi wrote:
> I was trying to use the Commons Email project for sending email with
> the Google provider, but I failed. I tried with the following code
>   SimpleEmail email = new SimpleEmail();
>   email.setDebug(true);
>   email.addTo(MAIL_DESTINATION, "Stefano Lenzi");
>   email.setFrom(MAIL_SENDER, "Test");
>   email.setSubject("Test message");
>   email.setMsg("This is a simple test of commons-email");
>   email.setHostName(SMTP_HOST_NAME);
>   email.setAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD);
>   email.setTLS(true);
>   email.setSmtpPort(SMTP_HOST_PORT);
>   email.send();
> but nothing happened.

Try setting -Dmail.debug=true and run it again. This will give you much
more output from Javamail.

It's unclear from the javadoc, but it's possible that setTLS(true)
merely configures Javamail to use STARTTLS over a plaintext SMTP
connection. If you want to use SMTPS, try setting
- -Dmail.transport.protocol=smtps to see if that helps.

> DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false

See that SSL=false. If you want SSL, use setSSL(true) instead of
setTLS(true).

I'm not sure what gmail prefers and/or requires, but generally
STARTTLS-over-SMTP will give you better performance, because only the
authentication is encrypted and not the entire SMTP conversation.

> http://www.rgagnon.com/javadetails/java-0570.html

That page indicates that GMail requires SSL, not TLS. Try changing
setTLS(true) to setSSL(true) and see if that works.

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksBc6wACgkQ9CaO5/Lv0PCC9gCdEyCUKnv8znCnuL3hvLcv/Bp+
CzoAoJA2vp9VPQHzATxRgD3SUe3J86tW
=mQy/
-END PGP SIGNATURE-

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



[EMAIL] Using Apache Commons Email and Google

2009-11-16 Thread Stefano "Kismet" Lenzi
Dear All,

I was trying to use the Commons Email project for sending email with
the Google provider, but I failed. I tried with the following code
SimpleEmail email = new SimpleEmail();
email.setDebug(true);
email.addTo(MAIL_DESTINATION, "Stefano Lenzi");
email.setFrom(MAIL_SENDER, "Test");
email.setSubject("Test message");
email.setMsg("This is a simple test of commons-email");
email.setHostName(SMTP_HOST_NAME);
email.setAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD);
email.setTLS(true);
email.setSmtpPort(SMTP_HOST_PORT);
email.send();
but nothing happened. Here is the debug shown DEBUG: JavaMail version
1.4.1ea-SNAPSHOT
DEBUG: not loading file: C:\Programmi\Java\jre6\lib\javamail.providers
DEBUG: java.io.FileNotFoundException:
C:\Programmi\Java\jre6\lib\javamail.providers (Impossibile trovare il
file specificato)
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: not loading file: C:\Programmi\Java\jre6\lib\javamail.address.map
DEBUG: java.io.FileNotFoundException:
C:\Programmi\Java\jre6\lib\javamail.address.map (Impossibile trovare
il file specificato)
DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false

I believe that the problem is that the protocol chosen is "smtp" while
it should be "smpts". In fact, I have later tryed the code available
here:
http://www.rgagnon.com/javadetails/java-0570.html
the it worked perfectly, and the two difference are the protocol
chosen for sending the email and the way the transport is initialized.

Is it a bug in Commons Email, or am I doing something wrong?

Ciao,
Stefano Lenzi

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