Skip to content

Instantiation of SSLSessionImpl fails in ClientHandshaker #22436

Closed
@glassfishrobot

Description

@glassfishrobot

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

glassfishrobot commented on Mar 20, 2018

@glassfishrobot
Author

@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

glassfishrobot commented on Mar 21, 2018

@glassfishrobot
Author

@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

glassfishrobot commented on Mar 21, 2018

@glassfishrobot
Author

@yooouuri Commented
@yaminikb When I try to create a JDBC pool with 5.0.1 I get the following error:

Ping Connection Pool failed for MysqlPool. The connection could not be allocated: Cannot open file:/Users/youri/glassfish5/glassfish/domains/test/config/keystore.jks [Keystore was tampered with, or password was incorrect] Please check the server.log for more details.

#22473

glassfishrobot

glassfishrobot commented on Jul 6, 2018

@glassfishrobot
Author

@Asilvam Commented
I have the same issue:

after downgrading to 1.8.0_151 the issue is gone.

thanks @yooouuri

glassfishrobot

glassfishrobot commented on Sep 17, 2018

@glassfishrobot
Author
Kunzol

Kunzol commented on Jan 8, 2019

@Kunzol

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

github-actions commented on Mar 5, 2020

@github-actions

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

team172011 commented on Aug 2, 2020

@team172011

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

tbvinh commented on Feb 1, 2021

@tbvinh

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

ghost
OndroMih

OndroMih commented on Mar 1, 2023

@OndroMih
Contributor

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

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Kunzol@OndroMih@tbvinh@glassfishrobot@team172011

        Issue actions

          Instantiation of SSLSessionImpl fails in ClientHandshaker · Issue #22436 · eclipse-ee4j/glassfish