Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-15-2006
Jason Gao's Avatar
Jason Gao Jason Gao is offline
Registered User
 
 
Join Date: Jul 2006
Location: China
Posts: 17
Send a message via MSN to Jason Gao
-->
How to set the path of client.jks,certs.jks and server.jks in applet

I am sorry to not show my question clearly in title beacause of limited words. I use glacier and storm to implement moitor system. Client uses applet to subscribe the topics. All the raleted resources are put into a jar inclues classes, client.jks, certs.jks and server.jks. This jar and the Ice.jar are downloaded to client to run the subscriber . But the next Exception has confused me several days.

subscriber: Ice.PluginInitializationException
reason = "IceSSL: unable to load keystore from `/client.jks'"
Ice.PluginInitializationException
reason = "IceSSL: unable to load keystore from `/client.jks'"
at IceSSL.Context.<init>(Context.java:116)
at IceSSL.Instance.createContext(Instance.java:131)
at IceSSL.Instance.<init>(Instance.java:46)
at IceSSL.PluginI.<init>(PluginI.java:17)
at IceSSL.PluginFactory.create(PluginFactory.java:23)
at Ice.PluginManagerI.loadPlugin(PluginManagerI.java: 187)
at Ice.PluginManagerI.loadPlugins(PluginManagerI.java :130)
at IceInternal.Instance.finishSetup(Instance.java:497 )
at Ice.CommunicatorI.finishSetup(CommunicatorI.java:1 83)
at Ice.Util.initializeWithPropertiesAndLogger(Util.ja va:113)
at com.thtf.ezone.ezibs.jpc.iceapp.Subscriber.run(Sub scriber.java:224)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \client.jks
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at IceSSL.Context.<init>(Context.java:110)
... 11 more



Firstly
The main code in AlarmApplet.java
package com.thtf.ezone.ezibs.jpc.rmiaccess;

public class AlarmApplet extends Applet {

private Subscriber subs;

public void init() {
try {
System.out.println("init the alarm applet");
}
public void start() {
try {
subs = new Subscriber();
Thread sub = new Thread(subs);
sub.start();
} catch (Exception e) {
System.out.println(e.getMessage());
}

}

Secondly
The main code in Subscriber.java


public class Subscriber implements Runnable{
public int run(String[] args) {
Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();

Glacier2.RouterPrx router = Glacier2.RouterPrxHelper
.checkedCast(defaultRouter);

while (true) {

try {
router.createSession(id, pw);
break;
} catch (Glacier2.PermissionDeniedException ex) {...}
catch (Glacier2.CannotCreateSessionException ex) {...}
} catch (Exception ex) {...}
}
...
...
}
private static Communicator communicator(){
return _communicator;
}
private static Communicator _communicator;
public void run() {

try {
StringSeqHolder argHolder = new StringSeqHolder(new String[0]);

Properties properties = Util.createProperties();
properties.setProperty("Clock.Subscriber.Endpoints ","tcp");
properties.setProperty("Ice.Default.Router","DemoG lacier2/router:ssl -p 80 -h 192.168.0.6");
properties.setProperty("IceStorm.TopicManager.Prox y","DemoIceStorm/TopicManager:default -p 10000 -h 192.168.0.6");
properties.setProperty("IceStorm.TopicManager.Endp oints","default -p 10000");
...
properties.setProperty("IceSSL.Client.Keystore","/client.jks");
properties.setProperty("IceSSL.Client.Certs","/certs.jks");
properties.setProperty("IceSSL.Server.Keystore","/server.jks");
properties.setProperty("IceSSL.Server.Certs","/certs.jks");
_communicator = Util.initializeWithPropertiesAndLogger(
argHolder, properties, null);

this.run(new String[0]);
} catch (LocalException ex) {...}
catch (java.lang.Exception ex) {...}

}
}

Thirdly
In jsp file
<applet
codebase = "<%=Root%>"
code = "com.jpc.rmiaccess.AlarmApplet.class"
archive = "app.jar,Ice.jar"
name = "alarmApplet"
width = "0"
height = "0"
>
</applet>

Finally
I put client.jks, certs.jks and server.jks into app.jar and at the root directory. Three files is side by side the "com" directory.


Thank you to read my question.
__________________
Jason Gao
HongKong UNIVERSITY
China Hongkong!

Last edited by Jason Gao : 09-15-2006 at 06:58 AM.
Reply With Quote
  #2 (permalink)  
Old 09-15-2006
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,564
Hi,

These errors indicate that IceSSL can't open the keystore files because they are not found on the filesystem where your applet is running. IceSSL only supports reading the keystore files from the filesystem, it can't look for them in Jar files. If you have a commercial interest for this feature, we could look into adding support for it. If that's the case please contact us at info@zeroc.com.

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 09-15-2006
Jason Gao's Avatar
Jason Gao Jason Gao is offline
Registered User
 
 
Join Date: Jul 2006
Location: China
Posts: 17
Send a message via MSN to Jason Gao
-->
Thank you very much for your rapid reply! But I regret to recieve the message to block the way to use applet to accross firewall with glacier. I have done a lof of work with application programe not applet and been succeed.
__________________
Jason Gao
HongKong UNIVERSITY
China Hongkong!
Reply With Quote
  #4 (permalink)  
Old 09-25-2006
Jason Gao's Avatar
Jason Gao Jason Gao is offline
Registered User
 
 
Join Date: Jul 2006
Location: China
Posts: 17
Send a message via MSN to Jason Gao
-->
Smile I have succeeded.

I hava change the FileInputStream to the URL InputStream in Ice.Context.java. Then I set those paths like "http://localhost:8080/test/app/(client.jks,certs.jks , server.jks )". Finally I put client.jks,certs.jks , server.jks in correct paths whick are same to setted properties.
__________________
Jason Gao
HongKong UNIVERSITY
China Hongkong!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible using ICE with Java applet? Yunqiao Yin Help Center 6 01-07-2008 09:41 PM
Ice 2.1 client Ice 3.1 server Powell Trusler Help Center 7 09-28-2006 07:28 PM
How can client know the status that client and server disconnceted? skyriver Help Center 2 06-08-2005 12:37 AM
How server initiatively send message to client, and client can responce to it? ouloba Help Center 3 11-26-2004 10:35 AM
how Server to ClientH alesio Help Center 1 02-17-2004 12:26 PM


All times are GMT -4. The time now is 11:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.