2016-09-15 63 views
1

我正在開發一個應用程序,它使用Pushy與HTTP/2通過ALPN訪問來向Apple iPhone發送推送通知。使用Pushy與ALPN和MSSQL Jdbc驅動程序拋出java.lang.IllegalAccessError

爲此我配置了JVM以按照以下VM參數的要求使用ALPN。

-Xbootclasspath/p:<Path To ALPN JAR> 

與Apple推送通知服務器的此連接正常工作。

但在同一個應用程序中,我有一個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參數固定的數據源的問題,但在ALPN連接失敗。

UPDATE

Jetty的ALPN-Boot的庫將覆蓋包sun.security.ssl 這也是jsse.jar可用(這意味着是一個JVM核心類) 這壓倒一切使得數據源失敗,因爲MSSQL Server是不是HTTP2服務器

這就是爲什麼我

java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.algorithmConstraints from class sun.security.ssl.ClientHandshaker 

反正是有,我可以同時使用HTTP2和HTTP在一起?

+0

這是否回答幫助擺脫這個問題的? http://stackoverflow.com/questions/32401050/handshaker-algorithmconstraints –

+0

@FrederikDeweerdt感謝您的評論,但這不是解決方案。因爲我必須從相同的代碼訪問HTTP2和HTTP服務器。 – shazin

回答