目前我正在使用 web3j 在我的私有区块链中创建一个帐户。喜欢:
Web3j web3 = Web3j.build(new HttpService());
Web3ClientVersion web3ClientVersion;
String walletFileName = WalletUtils.generateFullNewWalletFile("password",new File("/opt/test"));
LOGGER.info("walletFileName>>>>>" + walletFileName.substring(0));
这段代码在我的本地机器上运行良好。但是我在我的测试服务器中遇到了这个异常:
java.security.InvalidAlgorithmParameterException: parameter object not a ECParameterSpec
at org.bouncycastle.jce.provider.JDKKeyPairGenerator$EC.initialize(Unknown Source)
at org.web3j.crypto.Keys.createSecp256k1KeyPair(Keys.java:49)
at org.web3j.crypto.Keys.createEcKeyPair(Keys.java:55)
at org.web3j.crypto.WalletUtils.generateNewWalletFile(WalletUtils.java:44)
at org.web3j.crypto.WalletUtils.generateFullNewWalletFile(WalletUtils.java:29)
at com.belrium.service.UserWalletService.createNewWallet(UserWalletService.java:91)
at com.belrium.service.UserAuthenticationService.verifyEmailAddress(UserAuthenticationService.java:126)
at com.belrium.controller.UserAuthenticationController.verifyEmailAddress(UserAuthenticationController.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
我进行了很多搜索并尝试了所有方法,但无法解决。请帮忙。