我正在开发一个应用程序,它通过ALPN使用Pushy和HTTP / 2访问来向Apple iPhone发送推送通知。
为此,我已将JVM配置为使用以下VM参数的请求使用ALPN。
-Xbootclasspath/p:<Path To ALPN JAR>
此Apple Push Notification Server连接正常。
但在同一个应用程序中,我有一个MSSQL数据源通过MSSQL Jdbc Driver连接到数据库。但是当它尝试连接到MSSQL时会抛出以下错误:
java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.algorithmConstraints from class sun.security.ssl.ClientHandshaker
任何人都可以帮助我,或指出我正确的方向。
完整堆栈跟踪
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.algorithmConstraints from class sun.security.ssl.ClientHandshaker
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 58 more
Caused by: java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.algorithmConstraints from class sun.security.ssl.ClientHandshaker
at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:778)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:285)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:969)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:904)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1618)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:621)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(SQLServerDataSource.java:57)
at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:373)
at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:469)
at com.zaxxer.hikari.pool.BaseHikariPool.<init>(BaseHikariPool.java:162)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:61)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:49)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:78)
删除VM Argument修复了数据源问题,但ALPN连接失败。
更新
Jetty的ALPN-Boot库将覆盖包sun.security.ssl
jsse.jar中也提供了哪个(这意味着是JVM核心类)
此重写使dataSource失败,因为MSSQL Server不是HTTP2服务器
这就是我
的原因java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.algorithmConstraints from class sun.security.ssl.ClientHandshaker
无论如何我可以同时使用HTTP2和HTTP吗?