Re: [Jamvm-general] Question About SSL
Brought to you by:
rlougher
From: Robert L. <rob...@gm...> - 2010-09-24 22:38:30
|
Hi Tom. On 24 September 2010 21:10, Tom Lynch <tl...@ac...> wrote: > Hello, > > I am trying to get JamVM and SSL to work, I am using the code below and am > getting the following error, I am using JamVM on an embedded ARM, and it > appears I don't have the cacerts file configured correctly. How can I > configure that?? > > Unfortunately, I know very little about this aspect of the GNU Classpath library (this is the implementation of the class library that JamVM uses). You could try asking on the GNU Classpath list (cla...@gn...), but this has been rather quiet recently. Rob. > Exception in thread "main" java.lang.RuntimeException: > java.lang.RuntimeException: error instantiating default socket factory: > java.security.KeyManagementException: java.securs > at > javax.net.ssl.SSLSocketFactory$ErrorSocketFactory.createSocket(SSLSocketFactory.java:214) > at > gnu.java.net.protocol.http.HTTPConnection.getSocket(HTTPConnection.java:733) > at > gnu.java.net.protocol.http.HTTPConnection.getOutputStream(HTTPConnection.java:802) > at gnu.java.net.protocol.http.Request.dispatch(Request.java:292) > at > gnu.java.net.protocol.http.HTTPURLConnection.connect(HTTPURLConnection.java:219) > at > gnu.java.net.protocol.http.HTTPURLConnection.getInputStream(HTTPURLConnection.java:488) > at SSLTEST.main(SSLTEST.java:26) > Caused by: java.lang.RuntimeException: error instantiating default socket > factory: java.security.KeyManagementException: > java.security.KeyStoreException: java.io.FileNotFoundEs > at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:147) > at > javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:159) > at > javax.net.ssl.HttpsURLConnection.getSSLSocketFactory(HttpsURLConnection.java:232) > at > gnu.java.net.protocol.http.HTTPURLConnection.connect(HTTPURLConnection.java:172) > ...2 more > Caused by: java.security.KeyManagementException: > java.security.KeyStoreException: java.io.FileNotFoundException: > /usr/lib/security/cacerts > at > gnu.javax.net.ssl.provider.SSLContextImpl.defaultTrustManager(SSLContextImpl.java:283) > at > gnu.javax.net.ssl.provider.SSLContextImpl.engineInit(SSLContextImpl.java:202) > at javax.net.ssl.SSLContext.init(SSLContext.java:291) > at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:141) > ...5 more > Caused by: java.security.KeyStoreException: java.io.FileNotFoundException: > /usr/lib/security/cacerts > at > gnu.javax.net.ssl.provider.X509TrustManagerFactory.engineInit(X509TrustManagerFactory.java:173) > at javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:285) > at > gnu.javax.net.ssl.provider.SSLContextImpl.defaultTrustManager(SSLContextImpl.java:270) > ...8 more > > > > Code: > > import java.io.BufferedReader; > import java.io.InputStreamReader; > import java.io.OutputStreamWriter; > import java.io.Writer; > import java.net.Socket; > > import javax.net.ssl.SSLSocketFactory; > > public class Test { > > public static final String TARGET_HTTPS_SERVER = "www.verisign.com"; > public static final int TARGET_HTTPS_PORT = 443; > > public static void main(String[] args) throws Exception { > > Socket socket = SSLSocketFactory.getDefault(). > createSocket(TARGET_HTTPS_SERVER, TARGET_HTTPS_PORT); > try { > Writer out = new OutputStreamWriter( > socket.getOutputStream(), "ISO-8859-1"); > out.write("GET / HTTP/1.1\r\n"); > out.write("Host: " + TARGET_HTTPS_SERVER + ":" + > TARGET_HTTPS_PORT + "\r\n"); > out.write("Agent: SSL-TEST\r\n"); > out.write("\r\n"); > out.flush(); > BufferedReader in = new BufferedReader( > new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); > String line = null; > while ((line = in.readLine()) != null) { > System.out.println(line); > } > } finally { > socket.close(); > } > } > } > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Jamvm-general mailing list > Jam...@li... > https://lists.sourceforge.net/lists/listinfo/jamvm-general > > |