javax.net.ssl.SSLException 在 nativescript 中安装 nativescript-messenger 之后

javax.net.ssl.SSLException after nativescript-messenger installation in nativescript

我使用 vue-cli-template 安装了项目

https://github.com/nativescript-vue/vue-cli-template/tree/master

我安装了 nativescript-messenger,即使没有更改代码我也看到了错误

Error: Command ./gradlew failed with exit code 1 Error output: 
 Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

我们无法在那里提供命令的完整输出:

cd dist && tns run android --device ZY223J2852 --log trace

但下面是日志跟踪的开始和结束。

Loading extensions.
Asserting extension nativescript-cloud is installed.
Extension nativescript-cloud is installed.
System information:
{ platform: 'linux',
  shell: '/bin/bash',
  os: 'Linux daniel-Inspiron-3543 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux\n',
  procArch: 'x64',
  nodeVer: '8.11.1',
  npmVer: '6.2.0',
  nodeGypVer: null,
  nativeScriptCliVersion: '4.1.2',
  gitVer: '2.17.1',
  dotNetVer: null,
  javacVersion: '1.8.0_171',
  adbVer: '1.0.40',
  androidInstalled: true,
  monoVer: null,
  gradleVer: '4.9',
  isAndroidSdkConfiguredCorrectly: true,
  xcodeVer: undefined,
  xcodeprojLocation: null,
  itunesInstalled: false,
  cocoaPodsVer: undefined,
  isCocoaPodsWorkingCorrectly: false,
  isCocoaPodsUpdateRequired: false,
  pythonInfo: null }
Looking for project in '/home/daniel/pro/sms_api/dist'
Project directory is '/home/daniel/pro/sms_api/dist'.
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: { type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Starting',
  customDimensions: { cd5: 'CLI' } }

...

Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command prepareJSApp is after-prepareJSApp
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
BeforeHookName for command buildAndroidPlugin is before-buildAndroidPlugin
spawn: ./gradlew "-p" "/home/daniel/pro/sms_api/dist/platforms/tempPlugin/nativescript_messenger" "assembleRelease" "-PcompileSdk=android-27" "-PbuildToolsVersion=27.0.3" "-PsupportVersion=26.0.0-alpha1"
Unable to apply changes on device: ZY223J2852. Error is: Failed to build plugin nativescript-messenger : 
Error: Command ./gradlew failed with exit code 1 Error output: 
 Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1964)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1921)
    at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1904)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1420)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:60)
    at org.gradle.wrapper.Download.download(Download.java:45)
    at org.gradle.wrapper.Install.call(Install.java:62)
    at org.gradle.wrapper.Install.call(Install.java:48)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:91)
    at sun.security.validator.Validator.getInstance(Validator.java:179)
    at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:312)
    at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:171)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:184)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
    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)
    ... 14 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
    at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
    at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
    at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:89)
    ... 26 more
.
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command liveSync is after-liveSync
sudo update-ca-certificates -f
^CProject dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
  '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
  '/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch

我在尝试

 sudo update-ca-certificates -f

但这并没有帮助。

系统

Ubuntu 18.04

java-版本

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

我将 openjdk 替换为 Oracle Java,然后是

https://github.com/mesosphere/hdfs-deprecated/issues/141

但它也不起作用。

安装nativescript-phone后出现同样的错误。

我修好了谢谢

错误与

有关

JEP 229, switch from the jks keystore default format to the pkcs12 format

解决方法:

sudo su
/usr/bin/printf '\xfe\xed\xfe\xed\x00\x00\x00\x02\x00\x00\x00\x00\xe2\x68\x6e\x45\xfb\x43\xdf\xa4\xd9\x92\xdd\x41\xce\xb6\xb2\x1c\x63\x30\xd7\x92' > /etc/ssl/certs/java/cacerts
/var/lib/dpkg/info/ca-certificates-java.postinst configure