有人能告诉我这是否与SSL会话有关,或者是否表明存在证书问题?
我正在使用从JAX wsimport
创建的一些代码,并遇到了一个偶然的问题。抛出的错误似乎与SSL会话失效有关。但是,此代码以前工作正常,我不知道在哪里看。
例外:
[ java.lang.NullPointerException ] java.lang.NullPointerException
at com.sun.net.ssl.internal.ssl.SSLSessionContextImpl.remove(SSLSessionContextImpl.java:199)
at com.sun.net.ssl.internal.ssl.SSLSessionImpl.invalidate(SSLSessionImpl.java:558)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1559)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1547)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1511)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1456)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:64)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.PrintStream.flush(PrintStream.java:286)
at sun.net.www.MessageHeader.print(MessageHeader.java:228)
at sun.net.www.http.HttpClient.writeRequests(HttpClient.java:602)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:430)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:970)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1007)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:837)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:294)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:151)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:131)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:267)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:106)
at javax.xml.ws.Service.<init>(Service.java:57)
... (truncated)
修改
我通过堆栈跟踪跟踪异常,发现自己在com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:64)
行。这似乎是将字节写入输出流,并捕获在此过程中抛出的任何异常。在catch块中,它将异常发送到SSLSocketImpl
类,最终尝试使会话无效。在会话期间,无效是空指针发生的位置(次要异常)。
AppOutputStream.write():
public synchronized void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
throws IOException
{
this.c.checkWrite();
try
{
do
{
int i = Math.min(paramInt2, this.r.availableDataBytes());
if (i > 0) {
this.r.write(paramArrayOfByte, paramInt1, i);
paramInt1 += i;
paramInt2 -= i;
}
this.c.writeRecord(this.r);
this.c.checkWrite();
}while (paramInt2 > 0);
}
catch (Exception localException) {
this.c.handleException(localException);
}
}
默认情况下不会打印初始异常的详细信息。您必须使用jvm开关-Djavax.net.debug=SSL,session
来获取此信息以打印到localhost / console日志。我已经在我的测试环境中启用了这个,但从未见过那里的错误,所以它可能不会有用。由于这会产生大量的日志信息,我担心在生产中启用此选项。
似乎我提出的字面问题可以用这些发现来回答。但是,异常的来源(输出流写入偶尔会失败)仍然没有答案。
请求关于关闭/回答此问题并打开另一个问题的建议,或继续在此处征求回复。