Hi vidya vadke,
Make sure your keystore file exists at that path C:\Documents and
Settings\Admin\.keystore ... anyway for me i use this:
Series<Parameter> parameters =
server.getContext().getParameters();
parameters.add("sslContextFactory",
"com.noelios.restlet.ext.ssl.PkixSslContextFactory");
parameters.add("keystorePath","add_keystore_file_path_here"));
parameters.add("keystorePassword", "vidya.vadke");
parameters.add("keyPassword", "vidya.vadke");
parameters.add("keystoreType", "PKCS12");
// Start the component.
component.start();
instead of:
// Update component's context with keystore parameters.
File keystoreFile = new File("D:\\metadata.crt", "keystore");
component.getContext().getParameters().add("keystorePath",
keystoreFile.toURI().toASCIIString());
component.getContext().getParameters().add("keystorePassword",
"vidya.vadke");
component.getContext().getParameters().add("keyPassword",
"vidya.vadke");
// Start the component.
component.start();
Hope this helps ....
vidya vadke wrote:
>
> Hi all,
>
> I tried using a trial SSL certificate for securing my test application.
>
> I got following error -
> INFO: Starting the Grizzly [HTTP] server
> java.io.FileNotFoundException: C:\Documents and Settings\Admin\.keystore
> (The system cannot find the file specified)
> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(Unknown Source)
> at java.io.FileInputStream.<init>(Unknown Source)
> at
> com.noelios.restlet.ext.grizzly.HttpsServerHelper.configure(HttpsServerHelper.java:155)
> at
> com.noelios.restlet.ext.grizzly.GrizzlyServerHelper.start(GrizzlyServerHelper.java:102)
> at org.restlet.Server.start(Server.java:383)
> at org.restlet.Component.startServers(Component.java:1233)
> at org.restlet.Component.start(Component.java:1194)
> at restservice.InputDataWebService.main(InputDataWebService.java:37)
>
>
> Here is my sample code -
> import java.io.File;
>
> import org.restlet.Component;
> import org.restlet.VirtualHost;
> import org.restlet.data.Protocol;
>
> public class InputDataWebService {
>
> public static void main(String[] args) {
> try {
> // Create a new Component.
> Component component = new Component();
> // Add a new HTTP server listening on port 8182.
> component.getServers().add(Protocol.HTTP, 8182);
> component.getServers().add(Protocol.HTTPS, 8183);
>
> /* arredocenter.com */
> VirtualHost host = new VirtualHost(component.getContext());
> host.setHostDomain("www.metadata.com|metadata.com|metadata");
> host.attach(new InputDataApplication(component.getContext()));
> component.getHosts().add(host);
>
>
> // Update component's context with keystore parameters.
> File keystoreFile = new File("D:\\metadata.crt", "keystore");
> component.getContext().getParameters().add("keystorePath",
> keystoreFile.toURI().toASCIIString());
> component.getContext().getParameters().add("keystorePassword",
> "vidya.vadke");
> component.getContext().getParameters().add("keyPassword",
> "vidya.vadke");
>
>
>
> // Start the component.
> component.start();
> } catch (Exception e) {
> // Something is wrong.
> e.printStackTrace();
> }
> }
>
> }
>
> Can anyone tell me what am i missing here?
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=990522
>
>
--
View this message in context:
http://n2.nabble.com/SSL-in-restlet-tp1693602p1693683.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=990615