gpt4 book ai didi

java - SSL java.security.NoSuchAlgorithmException

转载 作者:太空宇宙 更新时间:2023-11-03 13:51:23 27 4
gpt4 key购买 nike

Java 表示在这一行中,找不到文件 ssc.store:

server = ((SSLServerSocketFactory) SSLServerSocketFactory.getDefault()).createServerSocket(port);

(服务器是一个ServerSocket)

我尝试使用包含此代码的库,但无法打开此 ServerSocket。

完全错误

Error opening ServerSocket
java.net.SocketException: java.security.NoSuchAlgorithmException: Error
constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLServerSocketFactory.throwException(Unknown Source)
at javax.net.ssl.DefaultSSLServerSocketFactory.createServerSocket(Unknown Source)
at com.blogspot.debukkitsblog.Net.Server.start(Server.java:327)
at com.blogspot.debukkitsblog.Net.Server.<init>(Server.java:86)
at com.blogspot.debukkitsblog.Net.Server.<init>(Server.java:51)
at de.yee.GameServer.<init>(GameServer.java:16)
at de.yee.Main.main(Main.java:9)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at javax.net.ssl.SSLContext.getInstance(Unknown Source)
at javax.net.ssl.SSLContext.getDefault(Unknown Source)
at javax.net.ssl.SSLServerSocketFactory.getDefault(Unknown Source)
... 5 more
Caused by: java.security.PrivilegedActionException: java.io.FileNotFoundException: ssc.store (Das System kann die angegebene Datei nicht finden)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getKeyManagers(Unknown Source)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.<clinit>(Unknown Source)
at sun.security.ssl.SSLContextImpl$DefaultSSLContext.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
... 11 more
Caused by: java.io.FileNotFoundException: ssc.store (Das System kann die angegebene Datei nicht finden)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(Unknown Source)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(Unknown Source)
... 19 more

问题是什么?

最佳答案

您需要运行代码的工作目录中的 ssc.store 文件。商店在这里:https://github.com/DeBukkIt/SimpleServerClient/blob/master/ssc.store (或在您 checkout 的特定分支或标签中)。

例如,如果您在 IntelliJ 中运行 main 方法,存储文件应该位于项目根目录中。或者,如果将应用程序打包到 jar 中并运行 java -jar yourapp.jar,则 ssc.store 应该位于同一目录中作为 jar 文件。

关于java - SSL java.security.NoSuchAlgorithmException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43387692/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com