Search code examples
javasslgoogle-cloud-sql

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


Still trying to deploy and get my server running .. As my Cloud SQL database is getting initialized I am getting the following exception:

[main] ERROR com.mz.server.BootstrappingServerConfig - Error trying to migrate SQL scripts ..
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
    at org.flywaydb.core.Flyway.migrate(Flyway.java:1006)
    at com.mz.database.SqlDatabaseBootstrapper.executeMigration(SqlDatabaseBootstrapper.java:60)
    at com.mz.server.BootstrappingServerConfig.contextInitialized(BootstrappingServerConfig.java:46)
    ...
Caused by: java.sql.SQLException: java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.localSupportedSignAlgs from class sun.security.ssl.ClientHandshaker
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)
    ...
Caused by: java.lang.IllegalAccessError: tried to access field sun.security.ssl.Handshaker.localSupportedSignAlgs from class sun.security.ssl.ClientHandshaker
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:285)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    ...

I am not sure what information I should deliver here - this would be my app.yaml:

runtime: java
vm: true

runtime_config:
  jdk: openjdk8
  server: jetty9

env_variables:
  'ALPN_ENABLE': 'true'   # OPTIONAL

beta_settings:
  cloud_sql_instances: mahlzeit-test:us-central1:mahlzeit-life-cloudsql-prod

health_check:
  enable_health_check: false

This is how I am configuring my DataSource in my Spring Application Context:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://google/mz_db?cloudSqlInstance=mz-test:us-central1:mz-life-cloudsql-prod&amp;socketFactory=com.google.cloud.sql.mysql.SocketFactory" />
    <property name="username" value="root" />
    <property name="password" value="" />
</bean>

The compute instances which are accessing the Cloud SQL instances are in the same project.

Why am I getting

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

and how can I fix this?


Running mvn dependency:list

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mz-web-server 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:list (default-cli) @ mz-web-server ---
[INFO] 
[INFO] The following files have been resolved:
[INFO]    org.springframework:spring-test:jar:4.0.3.RELEASE:compile
[INFO]    mysql:mysql-connector-java:jar:5.1.39:compile
[INFO]    org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:compile
[INFO]    org.springframework.security:spring-security-core:jar:4.0.3.RELEASE:compile
[INFO]    log4j:log4j:jar:1.2.17:compile
[INFO]    org.apache.maven:maven-settings:jar:2.2.1:compile
[INFO]    org.springframework:spring-tx:jar:4.2.3.RELEASE:compile
[INFO]    com.google.oauth-client:google-oauth-client:jar:1.21.0:compile
[INFO]    org.apache.commons:commons-dbcp2:jar:2.0:compile
[INFO]    com.google.http-client:google-http-client-jackson2:jar:1.21.0:compile
[INFO]    aopalliance:aopalliance:jar:1.0:compile
[INFO]    com.paypal.sdk:rest-api-sdk:jar:1.6.0:compile
[INFO]    org.springframework:spring-webmvc:jar:4.2.3.RELEASE:compile
[INFO]    org.apache.httpcomponents:httpmime:jar:4.3.4:compile
[INFO]    org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[INFO]    org.mindrot:jbcrypt:jar:0.3m:compile
[INFO]    com.squareup.okio:okio:jar:1.6.0:compile
[INFO]    com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO]    com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
[INFO]    org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[INFO]    org.apache.maven:maven-project:jar:2.2.1:compile
[INFO]    org.jooq:jooq-meta:jar:3.7.2:compile
[INFO]    commons-pool:commons-pool:jar:1.5.4:compile
[INFO]    org.jooq:jooq-codegen-maven:jar:3.7.2:compile
[INFO]    org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO]    org.apache.httpcomponents:httpclient:jar:4.3.4:compile
[INFO]    org.hamcrest:hamcrest-core:jar:1.3:test
[INFO]    commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO]    javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO]    org.json:json:jar:20140107:compile
[INFO]    com.google.gwt:gwt-servlet:jar:2.8.0-beta1:compile
[INFO]    org.springframework.security:spring-security-web:jar:4.0.3.RELEASE:compile
[INFO]    org.springframework:spring-core:jar:4.2.3.RELEASE:compile
[INFO]    com.mz:mz-data-model:jar:0.1-SNAPSHOT:compile
[INFO]    com.google.guava:guava-jdk5:jar:17.0:compile
[INFO]    commons-logging:commons-logging:jar:1.2:compile
[INFO]    com.google.cloud.sql:mysql-socket-factory:jar:1.0.0:compile
[INFO]    org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
[INFO]    com.mz:mz-web-client:war:0.1-SNAPSHOT:runtime
[INFO]    org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[INFO]    org.springframework:spring-beans:jar:4.2.3.RELEASE:compile
[INFO]    org.apache.commons:commons-pool2:jar:2.2:compile
[INFO]    com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
[INFO]    com.google.maps:google-maps-services:jar:0.1.14:compile
[INFO]    com.mz:mz-web-shared:jar:0.1-SNAPSHOT:compile
[INFO]    com.google.appengine:appengine-testing:jar:1.9.38:test
[INFO]    org.springframework:spring-web:jar:4.2.3.RELEASE:compile
[INFO]    org.springframework:spring-orm:jar:4.2.3.RELEASE:compile
[INFO]    joda-time:joda-time:jar:2.9.1:compile
[INFO]    commons-codec:commons-codec:jar:1.6:compile
[INFO]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[INFO]    com.google.appengine:appengine-api-stubs:jar:1.9.38:test
[INFO]    org.springframework:spring-expression:jar:4.2.3.RELEASE:compile
[INFO]    com.google.api-client:google-api-client:jar:1.21.0:compile
[INFO]    com.google.appengine:appengine-api-1.0-sdk:jar:1.9.38:compile
[INFO]    com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO]    com.google.guava:guava:jar:19.0:compile
[INFO]    org.springframework.security:spring-security-acl:jar:4.0.3.RELEASE:compile
[INFO]    org.jooq:jooq:jar:3.7.2:compile
[INFO]    junit:junit:jar:4.11:test
[INFO]    classworlds:classworlds:jar:1.1-alpha-2:compile
[INFO]    org.springframework:spring-jdbc:jar:4.2.3.RELEASE:compile
[INFO]    com.google.apis:google-api-services-sqladmin:jar:v1beta4-rev19-1.21.0:compile
[INFO]    org.springframework:spring-aop:jar:4.2.3.RELEASE:compile
[INFO]    org.apache.maven:maven-repository-metadata:jar:2.2.1:compile
[INFO]    com.maxmind.geoip:geoip-api:jar:1.3.1:compile
[INFO]    org.apache.maven:maven-artifact:jar:2.2.1:compile
[INFO]    com.google.code.gson:gson:jar:2.2.2:compile
[INFO]    net.sf.ehcache:ehcache:jar:2.10.1:compile
[INFO]    org.springframework:spring-context-support:jar:4.0.3.RELEASE:compile
[INFO]    org.apache.maven:maven-profile:jar:2.2.1:compile
[INFO]    org.jooq:jooq-codegen:jar:3.7.2:compile
[INFO]    org.springframework:spring-context:jar:4.2.3.RELEASE:compile
[INFO]    com.squareup.okhttp:okhttp:jar:2.7.5:compile
[INFO]    org.apache.maven:maven-model:jar:2.2.1:compile
[INFO]    org.flywaydb:flyway-core:jar:3.2.1:compile
[INFO]    com.sendgrid:smtpapi-java:jar:1.2.0:compile
[INFO]    com.google.http-client:google-http-client:jar:1.21.0:compile
[INFO]    org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[INFO]    backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[INFO]    org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO]    org.springframework.security:spring-security-config:jar:4.0.3.RELEASE:compile
[INFO]    com.sendgrid:sendgrid-java:jar:2.2.2:compile
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.730 s
[INFO] Finished at: 2016-06-06T09:27:35+02:00
[INFO] Final Memory: 16M/226M
[INFO] ------------------------------------------------------------------------

Solution

  • The problem was

    env_variables:
      'ALPN_ENABLE': 'true'   # OPTIONAL
    

    which I simply used from a tutorial without thinking about what that is/means.

    ALPN is a library which appears to optimize HTTPS requests. I tried to add the library to my dependencies which did not work. Maybe I got the wrong version or something like that. However, at the moment this is no requirement for me.

    To solve the issue I simply removed this variable. Setting it to 'false' should also do it.