host:~$ sudo davmail davmail.properties
2010-04-14 07:31:00,933 INFO davmail - DavMail Gateway 3.6.5-1000 listening on SMTP port 1025 POP port 1110 IMAP port 1143 CALDAV port 1080 LDAP port 1389
2010-04-14 07:31:04,012 DEBUG davmail.DavGateway - DavMail released version: 3.6.5-1000
2010-04-14 07:31:06,862 DEBUG davmail - Connection from /127.0.0.1 on port 1110
2010-04-14 07:31:07,998 ERROR davmail.exchange.ExchangeSession - Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
2010-04-14 07:31:08,006 ERROR davmail - DavMail configuration exception:
Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
davmail.exception.DavMailException: DavMail configuration exception:
Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at davmail.exchange.ExchangeSessionFactory.handleNetworkDown(ExchangeSessionFactory.java:213)
at davmail.exchange.ExchangeSessionFactory.checkConfig(ExchangeSessionFactory.java:192)
at davmail.pop.PopConnection.run(PopConnection.java:89)
2010-04-14 07:31:08,007 DEBUG davmail - > -ERR DavMail configuration exception: Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/**
* Send a request to Exchange server to check current settings.
*
* @throws IOException if unable to access Exchange server
*/
public static void checkConfig() throws IOException {
String url = Settings.getProperty("davmail.url");
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance(url);
GetMethod testMethod = new GetMethod(url);
try {
// get webMail root url (will not follow redirects)
int status = DavGatewayHttpClientFacade.executeTestMethod(httpClient, testMethod);
ExchangeSession.LOGGER.debug("Test configuration status: " + status);
if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED
&& !DavGatewayHttpClientFacade.isRedirect(status)) {
throw new DavMailException("EXCEPTION_CONNECTION_FAILED", url, status);
}
// session opened, future failure will mean network down
configChecked = true;
// Reset so next time an problem occurs message will be sent once
errorSent = false;
} catch (Exception exc) {
handleNetworkDown(exc);
} finally {
testMethod.releaseConnection();
}
}
Perhaps the initial redirect for authentication is causing this to fail? Maybe if I used some other value for davmail.url ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/** * Send a request to Exchange server to check current settings. * * @throws IOException if unable to access Exchange server */publicstaticvoidcheckConfig()throwsIOException{Stringurl=Settings.getProperty("davmail.url");HttpClienthttpClient=DavGatewayHttpClientFacade.getInstance(url);GetMethodtestMethod=newGetMethod(url);try{//getwebMailrooturl(willnotfollowredirects) intstatus=DavGatewayHttpClientFacade.executeTestMethod(httpClient,testMethod);ExchangeSession.LOGGER.debug("Testconfigurationstatus:" + status); if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED && !DavGatewayHttpClientFacade.isRedirect(status)) { throw new DavMailException("EXCEPTION_CONNECTION_FAILED",url,status);}//sessionopened,futurefailurewillmeannetworkdownconfigChecked=true;//ResetsonexttimeanproblemoccursmessagewillbesentonceerrorSent=false;}catch(Exceptionexc){handleNetworkDown(exc);}finally{testMethod.releaseConnection();}}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Turns out that the errors disappeared when I input my Exchange server's cert's SHA1 hash and also switched from openjava to Sun Java. Not sure if the cert's hash was required, but it did change the error messages. It just works now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
DavMail looks like a wonderful thing -- thanks for creating it.
Any advice on how to fix the error below would be much appreciated.
Using this config, I get the error below whenever I connect to the davmail using POP or IMAP.
host$ cat davmail.properties
davmail.url=https://mail.example.com/owa/
davmail.popPort=1110
davmail.imapPort=1143
davmail.smtpPort=1025
davmail.caldavPort=1080
davmail.ldapPort=1389
davmail.keepDelay=30
davmail.sentKeepDelay=90
davmail.caldavPastDelay=90
davmail.useSystemProxies=false
davmail.enableProxy=false
davmail.proxyHost=
davmail.proxyPort=
davmail.proxyUser=
davmail.proxyPassword=
davmail.ssl.keystoreType=JKS
davmail.ssl.keyPass=
davmail.ssl.keystoreFile=
davmail.ssl.keystorePass=
davmail.server=true
davmail.server.certificate.hash=
davmail.bindAddress=
davmail.allowRemote=false
davmail.disableUpdateCheck=false
log4j.rootLogger=WARN
log4j.logger.davmail=DEBUG
log4j.logger.org.apache.commons.httpclient=WARN
log4j.logger.httpclient.wire=WARN
davmail.logFilePath=/var/log/davmail.log
Here is the error:
host:~$ sudo davmail davmail.properties
2010-04-14 07:31:00,933 INFO davmail - DavMail Gateway 3.6.5-1000 listening on SMTP port 1025 POP port 1110 IMAP port 1143 CALDAV port 1080 LDAP port 1389
2010-04-14 07:31:04,012 DEBUG davmail.DavGateway - DavMail released version: 3.6.5-1000
2010-04-14 07:31:06,862 DEBUG davmail - Connection from /127.0.0.1 on port 1110
2010-04-14 07:31:07,998 ERROR davmail.exchange.ExchangeSession - Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
2010-04-14 07:31:08,006 ERROR davmail - DavMail configuration exception:
Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
davmail.exception.DavMailException: DavMail configuration exception:
Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at davmail.exchange.ExchangeSessionFactory.handleNetworkDown(ExchangeSessionFactory.java:213)
at davmail.exchange.ExchangeSessionFactory.checkConfig(ExchangeSessionFactory.java:192)
at davmail.pop.PopConnection.run(PopConnection.java:89)
2010-04-14 07:31:08,007 DEBUG davmail - > -ERR DavMail configuration exception: Connect exception: javax.net.ssl.SSLException java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Looking at:
davmail-src-3.6.5-1000/src/java/davmail/exchange/ExchangeSessionFactory.java
it appears that the problem is in here:
/**
* Send a request to Exchange server to check current settings.
*
* @throws IOException if unable to access Exchange server
*/
public static void checkConfig() throws IOException {
String url = Settings.getProperty("davmail.url");
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance(url);
GetMethod testMethod = new GetMethod(url);
try {
// get webMail root url (will not follow redirects)
int status = DavGatewayHttpClientFacade.executeTestMethod(httpClient, testMethod);
ExchangeSession.LOGGER.debug("Test configuration status: " + status);
if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED
&& !DavGatewayHttpClientFacade.isRedirect(status)) {
throw new DavMailException("EXCEPTION_CONNECTION_FAILED", url, status);
}
// session opened, future failure will mean network down
configChecked = true;
// Reset so next time an problem occurs message will be sent once
errorSent = false;
} catch (Exception exc) {
handleNetworkDown(exc);
} finally {
testMethod.releaseConnection();
}
}
Perhaps the initial redirect for authentication is causing this to fail? Maybe if I used some other value for davmail.url ?
I wonder if this is related:
https://sourceforge.net/tracker/index.php?func=detail&aid=2860646&group_id=184600&atid=909904
You may have a broken cacerts under jre/lib/security/cacerts, check this with keytool:
keytool -list -keystore /path/to/cacerts
Turns out that the errors disappeared when I input my Exchange server's cert's SHA1 hash and also switched from openjava to Sun Java. Not sure if the cert's hash was required, but it did change the error messages. It just works now.