Clicky

Hi,

I have problem with connecting to exchange mail server with java(java mail)
I get this exception.
javax.net.ssl.SSLProtocolException: java.io.IOException: Duplicate extensions not allowed.

Caused by: java.io.IOException: Duplicate extensions not allowed
at sun.security.x509.CertificateExtensions.parseExtension(Unknown Source)
at sun.security.x509.CertificateExtensions.init(Unknown Source)
at sun.security.x509.CertificateExtensions.<init>(Unknown Source)
at sun.security.x509.X509CertInfo.parse(Unknown Source)
 
 

asked 05/26/2011 12:18

dbadouraly's gravatar image

dbadouraly ♦♦


4 Answers:

Perhaps this would help:


This looks like an error in the certificate that your mail server is using.
You might find more help with that on the Java networking or security forum.
If you configure JavaMail to accept any certificate, it might work around this
problem. Set the mail.protocol.ssl.trust property to "*".

http://forums.oracle.com/forums/thread.jspa?threadID=2188241&tstart=15
link
for_yan's gravatar image

for_yan

I diodn't encounter this myself, but perphaps it depends on mail server,
so I guess you can try their suggretion, somthing like that:

1:
2:
3:
4:
5:
Properties props = new Properties();
props.put("mail.smtp.host", "mail.server.com");
	props.put(" mail.protocol.ssl.trust ","*");
	Session session = Session.getDefaultInstance(props, null);
....
link
for_yan's gravatar image

for_yan

hello Thank you for your prompt reply,

I am trying to understand is this script has to be configured in Javamail? what can I do on my certificate to accept javamail.

link
dbadouraly's gravatar image

dbadouraly

What I posted above is the part of my code where I send
the email - I guess in your code you should
also have a place where you specify the mail server.
Usually you do something like that in the JavaMail code which sends your email:

props.put("mail.smtp.host", "mail.server.com");
Session session = Session.getDefaultInstance(props, null);

after that you'll create message, provide addresses, etc. say ike that:

 Message msg = new MimeMessage(session);
          msg.setFrom(new InternetAddress(adrFrom));
etc

So what you may try to overcome this error is to add one more porperty to
the set of properties which you use to create the Session.
In order to do it before you create Session with this operator:

Session session = Session.getDefaultInstance(props, null);

you should add one more property to your Properties object, liker that

props.put(" mail.protocol.ssl.trust ","*");

That's why the whole thing looks luike that:


Properties props = new Properties();
props.put("mail.smtp.host", "mail.server.com");
      props.put(" mail.protocol.ssl.trust ","*");
      Session session = Session.getDefaultInstance(props, null);

 Message msg = new MimeMessage(session);
          msg.setFrom(new InternetAddress(adrFrom));

....
and somewhere in the end you'll have
Transport.send(msg) --> that;'s where it actually sends message

So, add this one more property, and if we are lucky
and those guys in the web page were correct, your error
shoudl go away.
If not... then we are out of luck, and need to think more.




link
for_yan's gravatar image

for_yan

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×1
×2

Asked: 05/26/2011 12:18

Seen: 697 times

Last updated: 06/23/2011 08:57