DER输入,在Java中连接WSDL时出现整数标记错误

DER输入,在Java中连接WSDL时出现整数标记错误,java,wsdl,keytool,Java,Wsdl,Keytool,我使用keytool从.pfx文件生成了一个证书,并包含在系统属性中,如下所述 System.setProperty("javax.net.ssl.keyStore", "C:\\cert.crt"); System.setProperty("javax.net.ssl.KeyPassword", "password"); System.setProperty("javax.net.ssl.keyStoreType", "pkcs12"); System.setProperty("javax.n

我使用keytool从.pfx文件生成了一个证书,并包含在系统属性中,如下所述

System.setProperty("javax.net.ssl.keyStore", "C:\\cert.crt");
System.setProperty("javax.net.ssl.KeyPassword", "password");
System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
System.setProperty("javax.net.debug", "SSL");
由于我已经包含了“debug”属性,所以当我执行所需的方法时,我会在控制台中得到下面的消息

keyStore is : C:\cert.crt
keyStore type is : pkcs12
keyStore provider is : 
init keystore
default context init failed: java.io.IOException: DER input, Integer tag error
以下提供了例外情况的详细信息。我在这里做错了什么

java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl).
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:151)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:234)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:197)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:145)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
    at javax.xml.ws.Service.<init>(Service.java:56)
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
    at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:179)
    at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:186)
    at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:362)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:145)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
    at java.net.URL.openStream(URL.java:1010)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:793)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:251)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:118)
    ... 10 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
    at java.security.Provider$Service.newInstance(Provider.java:1245)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:147)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
    at javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
    at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:102)
    at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:327)
    at javax.net.ssl.HttpsURLConnection.<init>(HttpsURLConnection.java:285)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(HttpsURLConnectionImpl.java:65)
    at sun.net.www.protocol.https.Handler.openConnection(Handler.java:42)
    at sun.net.www.protocol.https.Handler.openConnection(Handler.java:37)
    at java.net.URL.openConnection(URL.java:945)
    ... 14 more
Caused by: java.io.IOException: DER input, Integer tag error
    at sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
    at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1202)
    at java.security.KeyStore.load(KeyStore.java:1185)
    at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(DefaultSSLContextImpl.java:150)
    at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.<init>(DefaultSSLContextImpl.java:40)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:357)
    at java.lang.Class.newInstance(Class.java:310)
    at java.security.Provider$Service.newInstance(Provider.java:1221)
    ... 25 more
java.security.NoSuchAlgorithmException:构造实现时出错(算法:Default,提供程序:SunJSSE,类:com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)。
位于com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:151)
位于com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133)
在com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:234)上
位于com.sun.xml.internal.ws.client.WSServiceDelegate。(WSServiceDelegate.java:197)
在com.sun.xml.internal.ws.client.WSServiceDelegate上。(WSServiceDelegate.java:145)
位于com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
位于javax.xml.ws.Service。(Service.java:56)
原因:java.net.SocketException:java.security.NoSuchAlgorithmException:构造实现时出错(算法:默认,提供程序:SunJSSE,类:com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
位于javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:179)
位于javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:186)
位于sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:362)
位于sun.net.NetworkClient.doConnect(NetworkClient.java:145)
位于sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
位于sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
在sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:272)
位于sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
位于sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
位于sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
位于sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
位于sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
位于sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
位于java.net.URL.openStream(URL.java:1010)
位于com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:793)
位于com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:251)
位于com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:118)
... 10多
原因:java.security.nosuchalgorithException:构造实现时出错(算法:默认,提供程序:SunJSSE,类:com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
位于java.security.Provider$Service.newInstance(Provider.java:1245)
位于sun.security.jca.GetInstance.GetInstance(GetInstance.java:220)
位于sun.security.jca.GetInstance.GetInstance(GetInstance.java:147)
位于javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
位于javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
位于javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:102)
位于javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:327)
位于javax.net.ssl.HttpsURLConnection。(HttpsURLConnection.java:285)
http.HttpsURLConnectionImpl.(HttpsURLConnectionImpl.java:65)
位于sun.net.www.protocol.https.Handler.openConnection(Handler.java:42)
位于sun.net.www.protocol.https.Handler.openConnection(Handler.java:37)
在java.net.URL.openConnection(URL.java:945)
... 14多
原因:java.io.IOException:DER输入,整数标记错误
位于sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
位于com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1202)
加载(KeyStore.java:1185)
位于com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(DefaultSSLContextImpl.java:150)
位于com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl。(DefaultSSLContextImpl.java:40)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
位于java.lang.reflect.Constructor.newInstance(Constructor.java:513)
位于java.lang.Class.newInstance0(Class.java:357)
位于java.lang.Class.newInstance(Class.java:310)
位于java.security.Provider$Service.newInstance(Provider.java:1221)
... 25多

为什么您认为.cer文件可以用作pkcs12密钥库?对此表示抱歉。我从未在我的职业生涯中使用过这些,也从未在我的新项目中尝试过。还在学习。请指导我使用什么。这就是我提到的这种方法-