Closed
Description
When using SSL with JavaMail, the ClientHandshaker delivered by glassfish tries to instantiate the SSLSessionImpl. But the signature of the constructure seem to have change in recent updates of JDK 8 (u161).
Environment Details
- GlassFish Version (and build number): 5.0 Release (Windows and Linux)
- JDK version: 8u161
- OS: Windows 10 and Ubuntu 16.04
- Database: n.a.
Problem Description
The connection to an SSL email server fails, due to an error in instantiation the SSLSessionImpl in the ClientHandshaker.
Fatal exception occured while processing datasource: sun.security.ssl.SSLSessionImpl.<init>(Lsun/security/ssl/ProtocolVersion;Lsun/security/ssl/CipherSuite;Ljava/util/Collection;Lsun/security/ssl/SessionId;Ljava/lang/String;I)V
java.lang.NoSuchMethodError: sun.security.ssl.SSLSessionImpl.<init>(Lsun/security/ssl/ProtocolVersion;Lsun/security/ssl/CipherSuite;Ljava/util/Collection;Lsun/security/ssl/SessionId;Ljava/lang/String;I)V
at sun.security.ssl.ClientHandshaker.serverHello(ClientHandshaker.java:709)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:984)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:919)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:619)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:393)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:124)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:128)
at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:758)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:693)
at javax.mail.Service.connect(Service.java:366)
at javax.mail.Service.connect(Service.java:246)
Steps to reproduce
Session session = Session.getInstance(props);
Store store = null;
store = session.getStore("imaps");
store.connect("host",
"user",
"password"
);
Impact of Issue
No SSL available.
Activity
glassfishrobot commentedon Mar 20, 2018
@yooouuri Commented
I am having the same issue (not with email),
java.lang.NoSuchMethodError: sun.security.ssl.SSLSessionImpl.<init>(...)
https://stackoverflow.com/questions/49383650/sun-security-ssl-sslsessionimpl-not-found
@sapsiero after downgrading to 1.8.0_151 the issue is gone.
So after 151 there is something broken...
glassfishrobot commentedon Mar 21, 2018
@yaminikb Commented
@yooouuri There is some incompatible changes in the JDK after u152 that is impacting Grizzly. Hence, Grizzly had to be fixed and integrated into GlassFish 5.0.1. Can you try with latest GlassFish 5.0.1?
http://download.oracle.com/glassfish/5.0.1/nightly/latest-glassfish.zip
glassfishrobot commentedon Mar 21, 2018
@yooouuri Commented
@yaminikb When I try to create a JDBC pool with 5.0.1 I get the following error:
#22473
glassfishrobot commentedon Jul 6, 2018
@Asilvam Commented
I have the same issue:
after downgrading to 1.8.0_151 the issue is gone.
thanks @yooouuri
glassfishrobot commentedon Sep 17, 2018
Kunzol commentedon Jan 8, 2019
I found a workaround with the help of a similar issue on stackoverflow
I removed the "sun" folder from the jar file
"glassfish5/glassfish/modules/endorsed/grizzly-npn-bootstrap.jar"
After removing the "sun" folder from the jar, glassfish runs with openJDK 8 (1.8.0_181), too.
github-actions commentedon Mar 5, 2020
This issue has been marked as inactive and old and will be closed in 7 days if there is no further activity. If you want the issue to remain open please add a comment
team172011 commentedon Aug 2, 2020
thanks @Kunzol this issue was still the case for me with the current glassfish 5.1 and latest jdk 8 "1.8.0_261" on linux (ubuntu 18)
tbvinh commentedon Feb 1, 2021
I just installed the Glassfish at:
http://download.oracle.com/glassfish/5.0.1/nightly/latest-glassfish.zip (open java 1.8.0_275-8u275)
Then remove out the folder sun* in glassfish5/glassfish/modules/endorsed/grizzly-npn-bootstrap.jar
Everything is OK
OndroMih commentedon Mar 1, 2023
Dear @shrsm2022, have you considered using GlassFish 7 with Java 11+?
It looks like this issue has been resolved already in GlassFish 6: #23179
GlassFish 5.1 is an old version and not supported anymore by the Eclipse GlassFish project team. If you can't deploy your application to GlassFish 7 because of the change in Jakarta EE package names from javax to jakarta, you can try the Eclipse Transformer tool to transform your application to use the jakarta package in the final WAR/EAR package and then deploy to GlassFish 7.
If you need help with upgrading to GlassFish 7 or support older versions of GlassFish, I recommend seeking professional services from companies that provide commercial support for Eclipse GlassFish, see: https://glassfish.org/support.html
14 remaining items