java.lang.IllegalAccessError:尝试从类sun.security.ssl.ClientHandshaker访问字段sun.security.ssl.Handshaker.localSupportedSignAlgs

时间:2016-06-05 22:40:10

标签: java ssl google-cloud-sql

仍在尝试部署并让我的服务器运行..当我的Cloud SQL数据库初始化时,我收到以下异常:

[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)
    ...

我不确定我应该在这里提供哪些信息 - 这将是我的 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

这就是我在Spring Application Context中配置DataSource的方法:

<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>

正在访问Cloud SQL实例的计算实例位于同一个项目中。

为什么我

  

java.lang.IllegalAccessError:尝试从sun.security.ssl.ClientHandshaker类访问字段sun.security.ssl.Handshaker.localSupportedSignAlgs

我该如何解决这个问题?

正在运行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] ------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:1)

问题是

env_variables:
  'ALPN_ENABLE': 'true'   # OPTIONAL

我只是从教程中使用而不考虑那是什么/意味着什么。

ALPN是一个可以优化HTTPS请求的库。我尝试将库添加到我的依赖哪些无法正常工作。也许我得到了错误的版本或类似的东西。但是,目前这不是我的要求。

为了解决这个问题,我只是删除了这个变量。将其设置为'false'也应该这样做。