java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Java SDK 2.x连接节点失败

Open cyjseagull opened this issue 2 years ago • 8 comments

JavaSDK连接节点失败排查思路

Important: 前置说明

1. jdk版本支持

JavaSDK原则上支持从jdk 1.8到jdk 15的OracleJDKOpenJDK,但中间有部分版本禁用或者不支持secp256k1曲线,会导致sdk与节点之间握手失败,请首先检查当前使用的jdk是否支持secp256k1曲线,目前已经覆盖测试的jdk版本如下,推荐大家使用:

  • OracleJDK:

    • 1.8.0_141
    • 1.8.0_202
    • 11.0.2
    • 14.0.2
    • 15.0.2
  • OpenJDK:

    • 11.0.2
    • 14.0.2
    • 15.0.2
  • jdk下载链接:

    • OracleJDK官网:
      • https://www.oracle.com/java/technologies/downloads/archive/
    • 国内镜像:
      • http://www.codebaoku.com/jdk/jdk-oracle.html
      • http://www.codebaoku.com/jdk/jdk-openjdk.html

若使用的jdk禁用了secp256k1曲线(注意: 如果jdk不支持secp256k1曲线,不适用该方法),可以参考 #issue 470通过手动修改java.security属性的方式重新启用secp256k1曲线.

2. JavaSDK版本说明

JavaSDK 2.8.1优化了sdk连接失败的日志和报错提示,欢迎使用2.8.1以及以上版本的sdk,更便于定位错误问题。

maven方式

<dependencies>
      <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.53.Final</version>
        </dependency>
 	<dependency>
            <groupId>org.fisco-bcos.java-sdk</groupId>
            <artifactId>fisco-bcos-java-sdk</artifactId>
            <version>2.8.1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
</dependencies>

gradle方式

dependencies {
    compile ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.8.1')
}
configurations.all {
    resolutionStrategy {
        force 'io.netty:netty-all:4.1.53.Final'
    }
}

排查步骤

JavaSDK启动失败时会有类似于如下的异常信息:

* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1 Result: try to connect nodes with ecdsa context failed for cert missing
* Missed certificates: [conf/ca.crt,conf/sdk.crt,conf/sdk.key,]
currentPath: /Users/octopus/fisco/asset-app/dist

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates:
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /Users/octopus/fisco/asset-app/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html
----------------------------
* FISCO BCOS Java SDK Version: 2.8.1
* Support secp256k1 : true
* Java Version : 15.0.2
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : null
* OS Name : Mac OS X
* OS Arch : x86_64
* OS Version : 10.16
* JVM Version : 15.0.2+7-27
* JVM Vendor : Oracle Corporation
* JVM Vendor URL : https://java.oracle.com/

不同的项目对错误的处理方式不同,这段错误信息可能会重复显示多次,用户从最后的RACE INFORMATION:开始排查即可。

step1:检查是否拷贝证书

若sdk同时抛出下面两个错误,说明没有拷贝证书,需要将证书拷贝到src/main/resources/conf子目录或conf子目录下:

<==== STEP1 Result: try to connect nodes with ecdsa context failed for cert missing
* Missed certificates: xxxxxx

<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates: xxxxxx

证书拷贝步骤可参考FISCO BCOS文档:搭建第一个区块链网络


step2: 检查节点是否启动或者sdk与节点之间网络是否连通

若sdk抛出如下错误,说明sdk与节点之间网络不连通,或者节点没有启动:

* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== connect nodes failed, reason:
Failed to connect to all the nodes!
* connect to 127.0.0.1:20200 failed! Please make sure the nodes have been started, and the network between the SDK and the nodes are connected normally.reason: Connection refused: /127.0.0.1:20200

* connect to 127.0.0.1:20201 failed! Please make sure the nodes have been started, and the network between the SDK and the nodes are connected normally.reason: Connection refused: /127.0.0.1:20201

通过ps命令检查节点进程是否启动:

# 到节点所在机器运行ps命令
ps aux |grep -i fisco-bcos

通过telnet命令检查sdk到节点的网络是否连通:

telnet ${节点ip} ${节点channel_listen_port}

注意:channel_listen_port,在节点config.ini配置文件中:

$ cat node0/config.ini | egrep channel_listen
   channel_listen_ip=0.0.0.0
   channel_listen_port=20208

step3: 检查证书是否拷贝正确

保证项目打开java-sdk日志,在日志中grep SSLHandshakeExceptionValidatorException或者secp256k1`:

 grep -iE 'SSLHandshakeException|ValidatorException|secp256k1' sdk.log

若输出如下错误说明放置在sdk中的证书错误,需要重新配置证书:

...
sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
	Suppressed: javax.net.ssl.SSLHandshakeException: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
...

Note: 若这里输出disable secp256k1的日志,说明握手失败是由于jdk禁用secp256k1曲线导致的,可继续转step4排查。


step4: 非国密区块链-检查jdk是否支持secp256k1曲线

Note: 国密区块链且采用国密SSL连接可跳过本检查步骤。

FISCO BCOS非国密默认采用secp256k1曲线,但随着jdk版本的升级,secp256k1曲线逐渐被弃用(因此2.9.0版本在保证向下兼容的同时,非国密连接采用RSA曲线),对于采用非国密SSL的区块链(节点的config.ini配置sm_channel_crypto=false),在sdk日志中grep关键字disable.*secp256k1

cat sdk.log|grep -i 'disable.*secp256k1'

若有如下输出,说明当前jdk不支持secp256k1曲线,则需要参考#issue 470 手动修改java.security属性启用secp256k1曲线或者替换到支持secp256k1曲线的jdk版本:

Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1
Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1
Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1
Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1
Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled algorithm: secp256k1

Note: jdk曲线的变更均会记录在release notes中,具体可参考 https://www.oracle.com/java/technologies/javase/jdk-relnotes-index.html。


step5: 国密区块链 && 启用国密SSL连接 --- 检查netty库是否冲突

Note: 非国密区块链或者国密区块链但没有开启国密SSL连接可跳过本检查步骤。

FISCO BCOS国密区块链若开启国密SSL连接(节点的config.ini配置sm_channel_crypto=true),可能因为netty库冲突,导致sdk连接节点失败

Java SDK默认的netty库版本是netty-4.1.53.Final,Spring-boot等其他组件若和Java SDK一起使用,会引入高版本或者低版本的netty,从而因netty冲突导致sdk连接节点失败。

对于本情况,可在sdk日志中grep关键字NoSuchMethodErrornetty关键字:

cat sdk.log|grep -E 'NoSuchMethodError|netty'

若输出如下日志,说明netty库冲突:(这里的示例是spring采用了高版本的netty-4.1.60.Final,java-sdk不支持该版本的netty)。

	at io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1113) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248) ~[netty-all-4.1.60.Final.jar:4.1.60.Final]
	...

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bcosSDK' defined in class path resource [applicationContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.fisco.bcos.sdk.BcosSDK]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: 'void io.netty.handler.ssl.OpenSslContext.<init>(java.lang.Iterable, io.netty.handler.ssl.CipherSuiteFilter, io.netty.handler.ssl.ApplicationProtocolConfig, long, long, int, java.security.cert.Certificate[], io.netty.handler.ssl.ClientAuth, java.lang.String[], boolean, boolean)'
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.fisco.bcos.sdk.BcosSDK]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: 'void io.netty.handler.ssl.OpenSslContext.<init>(java.lang.Iterable, io.netty.handler.ssl.CipherSuiteFilter, io.netty.handler.ssl.ApplicationProtocolConfig, long, long, int, java.security.cert.Certificate[], io.netty.handler.ssl.ClientAuth, java.lang.String[], boolean, boolean)'
Caused by: java.lang.NoSuchMethodError: 'void io.netty.handler.ssl.OpenSslContext.<init>(java.lang.Iterable, io.netty.handler.ssl.CipherSuiteFilter, io.netty.handler.ssl.ApplicationProtocolConfig, long, long, int, java.security.cert.Certificate[], io.netty.handler.ssl.ClientAuth, java.lang.String[], boolean, boolean)'

此时参考#issue 332,指定netty版本为4.1.53解决冲突,大致写法如下:

<dependency>
		<groupId>io.netty</groupId>
		<artifactId>netty-all</artifactId>
		<version>4.1.53.Final</version>
	</dependency>

	<dependency>
		<groupId>org.fisco-bcos.java-sdk</groupId>
		<artifactId>fisco-bcos-java-sdk</artifactId>
		<version>2.8.0</version>
		<exclusions>
			<exclusion>
				<groupId>io.netty</groupId>
				<artifactId>netty-all</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

spring + java-sdk 构建应用,强烈推荐参考应用spring-boot-crud:

cyjseagull avatar Apr 12 '22 07:04 cyjseagull

2.8.1版本官方会优化SDK连接失败的日志和报错提示,欢迎试用2.8.1-SNAPSHOT版本。

若有其他连接失败的场景出现,欢迎补充本issue。

<dependencies>
      <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.53.Final</version>
        </dependency>
 	<dependency>
            <groupId>org.fisco-bcos.java-sdk</groupId>
            <artifactId>fisco-bcos-java-sdk</artifactId>
            <version>2.8.1-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
</dependencies>
dependencies {
    compile ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.8.1-SNAPSHOT')
}
configurations.all {
    resolutionStrategy {
        force 'io.netty:netty-all:4.1.53.Final'
    }
}

cyjseagull avatar Apr 13 '22 10:04 cyjseagull

使用AMOP订阅消息时报错

STEP1
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20202
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.
* ssl handshake failed:/127.0.0.1:20203
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

证书已拷贝,通过检查日志可知证书拷贝正确 jdk版本也支持secp256k1

问题应该是区块链节点运行的端口有问题,启动的nodes运行在30300-30303 于是尝试修改dist/conf中与端口相关的几个文件内容,手动改成30300-30303 但还是会报相同的错误..

尝试其他方法暂未解决问题

有办法指定nodes运行在20200-20203端口吗?这样应该就不会ssl handshake failed了吧

Cristliu avatar Jun 07 '22 03:06 Cristliu

java-sdk-demo 3.0 版本的amop试用没有问题 java-sdk-demo 2.0 版本在订阅消息这一步会有报错

Exception in thread "main" org.fisco.bcos.sdk.BcosSDKException: create BcosSDK failed, error info: init channel network error!
org.fisco.bcos.sdk.network.NetworkException: 
* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== STEP1 Result: try to connect nodes with ecdsa context failed. reason:
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20202
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.
* ssl handshake failed:/127.0.0.1:20203
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates: 
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /home/amax/fisco/java-sdk-demo2/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536 
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html 
----------------------------
* FISCO BCOS Java SDK Version: 2.9.0
* Support secp256k1 : true
* Java Version : 14.0.2
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : false
* OS Name : Linux
* OS Arch : amd64
* OS Version : 4.15.0-142-generic
* JVM Version : 14.0.2+12-46
* JVM Vendor : Oracle Corporation
* JVM Vendor URL : https://java.oracle.com/

Cristliu avatar Jun 08 '22 02:06 Cristliu

链接Java-sdk时出错,:

====> STEP1: try to connect nodes with ecdsa context... <==== STEP1-1: Load certificates for ecdsa context success... <==== STEP1 Result: try to connect nodes with ecdsa context failed. reason: init failed SSL context init failed, please make sure your cert and key files are properly configured. error info: PrivateKey type not supported PKCS#8

====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context... <==== STEP2 Result: connect with sm context failed for cert missing.

  • Missed certificates: [conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,] currentPath: /Users/gaoyanan/Downloads/fisco-demo

<====> Error: try to connect nodes with both ecdsa and sm context failed <====> <====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536 <====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html

  • FISCO BCOS Java SDK Version: 2.9.0
  • Support secp256k1 : true
  • Java Version : 11.0.17
  • JDK Disabled NamedCurves : null
  • JDK DisableNative Option : false
  • OS Name : Mac OS X
  • OS Arch : aarch64
  • OS Version : 12.5.1
  • JVM Version : 11.0.17+10-LTS-269
  • JVM Vendor : Oracle Corporation
  • JVM Vendor URL : https://openjdk.java.net/

build.gradle配置如下: implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.9.0') implementation ('io.netty:netty-tcnative-boringssl-static:2.0.48.Final')

java-sdk版本从2.7.2到2.9.0都会报这个错误,不增加io.netty:netty-tcnative-boringssl-static则会报Failed to load any of the given libraries: [netty_tcnative_osx_aarch_64, netty_tcnative_aarch_64, ne的错误,不知如何解决了

Gnancy avatar Nov 15 '22 08:11 Gnancy

刚踩了个坑 fisco-bcos-v3 版本不兼容 WeBase-v2版本,需要使用 WeBase-v3(lab分支)

----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== STEP1 Result: try to connect nodes with ecdsa context failed. reason:
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20200
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates:
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /home/mulander/fisco/WeBASE-Front/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html
----------------------------
* FISCO BCOS Java SDK Version: 2.9.1
* Support secp256k1 : true
* Java Version : 11.0.20
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : false
* OS Name : Linux
* OS Arch : amd64
* OS Version : 5.15.90.1-microsoft-standard-WSL2
* JVM Version : 11.0.20+8-post-Ubuntu-1ubuntu122.04
* JVM Vendor : Ubuntu
* JVM Vendor URL : https://ubuntu.com/

Mulander-J avatar Aug 23 '23 08:08 Mulander-J

java-sdk-demo 3.0 版本的amop试用没有问题 java-sdk-demo 2.0 版本在订阅消息这一步会有报错

Exception in thread "main" org.fisco.bcos.sdk.BcosSDKException: create BcosSDK failed, error info: init channel network error!
org.fisco.bcos.sdk.network.NetworkException: 
* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== STEP1 Result: try to connect nodes with ecdsa context failed. reason:
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20202
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.
* ssl handshake failed:/127.0.0.1:20203
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates: 
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /home/amax/fisco/java-sdk-demo2/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536 
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html 
----------------------------
* FISCO BCOS Java SDK Version: 2.9.0
* Support secp256k1 : true
* Java Version : 14.0.2
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : false
* OS Name : Linux
* OS Arch : amd64
* OS Version : 4.15.0-142-generic
* JVM Version : 14.0.2+12-46
* JVM Vendor : Oracle Corporation
* JVM Vendor URL : https://java.oracle.com/

请问你之后怎么解决的呢

gting1 avatar May 28 '24 12:05 gting1

java-sdk-demo 3.0 版本的amop试用没有问题 java-sdk-demo 2.0 版本在订阅消息这一步会有报错

Exception in thread "main" org.fisco.bcos.sdk.BcosSDKException: create BcosSDK failed, error info: init channel network error!
org.fisco.bcos.sdk.network.NetworkException: 
* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== STEP1 Result: try to connect nodes with ecdsa context failed. reason:
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20202
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.
* ssl handshake failed:/127.0.0.1:20203
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates: 
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /home/amax/fisco/java-sdk-demo2/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536 
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html 
----------------------------
* FISCO BCOS Java SDK Version: 2.9.0
* Support secp256k1 : true
* Java Version : 14.0.2
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : false
* OS Name : Linux
* OS Arch : amd64
* OS Version : 4.15.0-142-generic
* JVM Version : 14.0.2+12-46
* JVM Vendor : Oracle Corporation
* JVM Vendor URL : https://java.oracle.com/

请问你之后怎么解决的呢

好像是用java-sdk-demo 3.0 版本就没问题了,可以试看看(时间太久了,不怎么做这个了,记不大清)

Cristliu avatar May 28 '24 12:05 Cristliu

java-sdk-demo 3.0 版本的amop试用没有问题 java-sdk-demo 2.0 版本在订阅消息这一步会有报错

Exception in thread "main" org.fisco.bcos.sdk.BcosSDKException: create BcosSDK failed, error info: init channel network error!
org.fisco.bcos.sdk.network.NetworkException: 
* TRACE INFORMATION:
----------------------------
====> STEP1: try to connect nodes with ecdsa context...
<==== STEP1-1: Load certificates for ecdsa context success...
<==== STEP1 Result: try to connect nodes with ecdsa context failed. reason:
Failed to connect to all the nodes!
* ssl handshake failed:/127.0.0.1:20202
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.
* ssl handshake failed:/127.0.0.1:20203
 reason: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error. Please make sure the certificate are correctly configured and copied.

----------------------------
====> STEP2: connect nodes with ecdsa context failed, try to connect nodes with sm-context...
<==== STEP2 Result: connect with sm context failed for cert missing.
* Missed certificates: 
[conf/gm/gmca.crt,conf/gm/gmsdk.crt,conf/gm/gmsdk.key,conf/gm/gmensdk.key,conf/gm/gmensdk.crt,]
currentPath: /home/amax/fisco/java-sdk-demo2/dist
----------------------------
<====> Error: try to connect nodes with both ecdsa and sm context failed <====>
<====> Please refer to github issue: https://github.com/FISCO-BCOS/java-sdk/issues/536 
<====> Please refer to fisco-docs: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html 
----------------------------
* FISCO BCOS Java SDK Version: 2.9.0
* Support secp256k1 : true
* Java Version : 14.0.2
* JDK Disabled NamedCurves : null
* JDK DisableNative Option : false
* OS Name : Linux
* OS Arch : amd64
* OS Version : 4.15.0-142-generic
* JVM Version : 14.0.2+12-46
* JVM Vendor : Oracle Corporation
* JVM Vendor URL : https://java.oracle.com/

请问你之后怎么解决的呢

好像是用java-sdk-demo 3.0 版本就没问题了,可以试看看(时间太久了,不怎么做这个了,记不大清)

好的好的 谢谢

gting1 avatar May 28 '24 12:05 gting1