Lionel PJ

Greenhorn
+ Follow
since Oct 31, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lionel PJ

Check if you are able to ping the machine.
18 years ago
I have been using Design Patterns for the past year and passed my scjd exam with this.
I will be glad to read this book too, if I get a chance.

Originally posted by Carl Trusiak:
This Week we are giving away four copies of the book "Design Patterns Explained: A New Perspective on Object-Oriented Design".
The Author, Alan Shalloway, will be online to answer your questions!
These copies will be Autographed by the Authors
Everyone give Alan a warm JavaRanch welcome.



[This message has been edited by Lionel PJ (edited October 03, 2001).]
Any help to get this problem resolved would be of help.

I get the error as below:
D:\test\nt>java Client
Server
Client exception: Error marshaling transport header; nested exception is:
javax.net.ssl.SSLException: untrusted server cert chain
java.rmi.MarshalException: Error marshaling transport header; nested exception is:
javax.net.ssl.SSLException: untrusted server cert chain
javax.net.ssl.SSLException: untrusted server cert chain
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.Handshaker.process_record([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:76)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:134)
at java.io.DataOutputStream.flush(DataOutputStream.java:108)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:207)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:87)
at Server_Stub.passArgs(Unknown Source)
at Client.main(Client.java, Compiled Code)
the server was invokde as:
D:\test\nt>java -Djava.rmi.server.codebase="file:/d:/test" -Djava.policy=d:/test/policy Server a b c
Server bound in registry
where policy had allpermission
The server program is given as below:
import java.net.InetAddress;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.RemoteException;
import java.rmi.RMISecurityManager;
import java.rmi.server.UnicastRemoteObject;
public class Server extends UnicastRemoteObject implements Message
{
private static String[] args;
public Server() throws RemoteException
{
// super();
super(0, new RMISSLClientSocketFactory(),
new RMISSLServerSocketFactory());
}
public String[] passArgs() {
System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
System.out.println(args.length);
System.out.println();
return args;
}
public static void main(String a[])
{
// Create and install a security manager
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new RMISecurityManager());
}
args=a;
try
{
Server obj = new Server();
// Bind this object instance to the name "Server"
Registry r = LocateRegistry.createRegistry(4646);
r.rebind("Server", obj);
System.out.println("Server bound in registry");
} catch (Exception e) {
System.out.println("Server err: " + e.getMessage());
e.printStackTrace();
}
}
}

The RMISSLServerSocketFactory class is as below:
------------------------------------------------
import java.io.*;
import java.net.*;
import java.rmi.server.*;
import javax.net.ssl.*;
import java.security.KeyStore;
import javax.net.*;
import javax.net.ssl.*;
import javax.security.cert.X509Certificate;
import com.sun.net.ssl.*;
public class RMISSLServerSocketFactory implements RMIServerSocketFactory, Serializable
{
public ServerSocket createServerSocket(int port)
throws IOException
{
SSLServerSocketFactory ssf = null;
try {
// set up key manager to do server authentication
SSLContext ctx;
KeyManagerFactory kmf;
KeyStore ks;
char[] passphrase = "passphrase".toCharArray();
ctx = SSLContext.getInstance("TLS");
kmf = KeyManagerFactory.getInstance("SunX509");
ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream("testkeys"), passphrase);
kmf.init(ks, passphrase);
ctx.init(kmf.getKeyManagers(), null, null);
ssf = ctx.getServerSocketFactory();
} catch (Exception e)
{
e.printStackTrace();
}
return ssf.createServerSocket(port);
}
}
The RMIClientSocketFactory is as below:
--------------------------------------
import java.io.*;
import java.net.*;
import java.rmi.server.*;
import javax.net.ssl.*;
public class RMISSLClientSocketFactory implements RMIClientSocketFactory, Serializable
{
public Socket createSocket(String host, int port)
throws IOException
{
SSLSocketFactory factory =(SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket(host, port);
return socket;
}
}
And finally the client program is :
-------------------------------
import java.net.InetAddress;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.RemoteException;
public class Client
{
public static void main(String args[])
{
try
{
// "obj" is the identifier that we'll use to refer
// to the remote object that implements the "Hello"
// interface
Message obj = null;
Registry r = LocateRegistry.getRegistry(InetAddress.getLocalHost().getHostName(),4646);
obj = (Message)r.lookup("Server");
String[] s = r.list();
for(int i = 0; i < s.length; i++)
System.out.println(s);
String[] arg = null;
System.out.println(obj.passArgs());
arg = obj.passArgs();
System.out.println(arg[0]+"\n"+arg[1]+"\n"+arg[2]+"\n");
} catch (Exception e) {
System.out.println("Client exception: " + e.getMessage());
e.printStackTrace();
}
}
}
The Message interface has the code:
------------------------------------
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Message extends Remote
{
String[] passArgs() throws RemoteException;
}
Plz. help. Urgent.
Regards,
LioneL
22 years ago
After along time I got my results. I was to post this mail a few days back but the ranch was not reachable.
-------------------
Test History
Customer:
Lionel P J
Testing ID:
sp2790241
Test:
Sun Certified Developer for the Java 2 Platform
(310-027)
Date Taken:
2001-04-08 12:53:34.420
Registration Number:
fe5syd03a1
Site:
ii47
Grade:
P
Score:
141
Comment:
This report shows the total points that could
have been awarded in each section and the
actual number of points you were awarded. This
information is provided in order to give you
feedback on your relative strengths on a
per-section basis. The maximum number of
points you could have received is 155; the
minimum to pass is 124. General
Considerations(maximum = 58): 52
Documentation(maximum = 20): 20
GUI(maximum = 24): 20 Server(maximum =
53): 49
Read This Amit.
http://www.javaranch.com/ubb/Forum25/HTML/000412.html
[This message has been edited by Lionel PJ (edited February 25, 2001).]
Hi All,
I was a very silent player in the two groups scjd and java-dev-test and as for this group I did not even watch it, because they insisted my name must be changed.
But as an Indian I dont have a second name. I had not made much of contribution to both of them.
A sense of gratitude to all groups for having helped me with a few ideas or made me think of the various possibilites in the assignments makes me write this mail to u today (though its a sunday).
Lemme jus tell u that I had downloaded the new assignment on the 26th of the last month. I went on to complete this project inspite of the all the problems that I faced. The assignment went into a lot of testing and finally was uploaded on the 18th of this month. I had written the exam on the 23rd, and am waiting for the results now.
So here we go with a few tips for all aspirants who are willing to pass the exam and a few questions that you can get prepared on while you would like to upload your project.
Questions to ponder:
1. Take up the Data class first. Remove the deprecations. Ensure you understand the full flow of Data class methods.
2. Understand what happens when an argumetn like 27 is passed to getRecord method.
3. Understand the necessity of thread-safety in the Data class.
4. Understand the need of nested monitors if you are using any.
5. Complete the 3 methods lock, unlock and criteriaFind by either directly modifying Data class or delegating the job to another class. Document them
6. Understand why there will be an OutOfMemoryError when you pass a .java to open with the Data constructor (for people who are writing jd with the conversion tool).
7. Should you really extend Data class?
8. Read all the doc comments provided. Identify wrong doc comments and rectify them in the classes provided.
9. Make the server program. Understand the need of Singleton. Is it necessary? Or it in-built?
10. Identify the need to pass the Data class methods without tampering the Data class to give network functionality.
11. Find if you really want a client id ? Or is it enough to tap the in-built identification of Sockets and Rmi?
12. Build the server with a pattern or two (whatever is applicable)
13. Make sure your local mode does not have the residue of network functionality.
14. On the client - side, find out if you really want a gui for switching between the modes or use the command-lines.
15. Choosing the layout and the justification of the choice. Find if the preferred size and the looks are tampered when you resize.
16. Is a close button required or the like?
17. the need for hard-coding or dynamically finding the names of the columns for a find.
18. the need for hard-coding or dynamically generating the search string.
19 the need for hard-coding or dynamically parsing any number of search criterion in a string in the back-end.
Material I used:
* Sun/Java tutorial
*Java Look and Feel guidelines
* All in One programmers guide by Barry Boone (can hint you to the answer though its very subtle)
* Programmers guide by Robert/Heller
* Programmers guide by Jamie Jaworski (Nothing much in it, except for three questions and the style of answers one can write and a few other tips)
* Thread programming by Paul Hyde
* Concurrency programming by Doug Lea
* Articles by Allen holub from JavaWorld (part 1 to 9) on real world thread programming
* Article on Adapter pattern from JavaWorld.
* Swing material from Manning.com
* Java Code Conventions
Hope this helps.
Regards,
LioneL
MORE TO COME SOON.


[This message has been edited by Lionel PJ (edited February 25, 2001).]
one more thing I would like to say is you can learn about thread programming and concurrecy handling.
There are books availble if you want to refer to them. For sample Concurrent Programming in Java 2nd ed. by Doug Lea (Sun material).
Its not necessary that you have to buy the book, but you can visit the site and download the src code, its available freely as a file called allcode.java.
In this file you can read the file about RWLock class which may give you an idea about concurrent programming int the real world.
Hope this helps.
Regards,
LioneL
[b]
I don't know how to prioritize. B'cas its all depends on how you are planning to design.
- threads, (syncronized, wait , notify)
- RMI (basics, passing parameters, deploying the class files)
- sockets (yet to study)
- serialization (Basic idea)
- collections (Read about important classes)
- streams (For coding mostly we don't need much. Basic idea)
- javadoc (Try to use most of the functions. Really interesting. . )
- Swing ( JFrame, JTable, JComboBoxes,JButtons,JTextField )

Nice to see your mail abt prioritizing the concepts that one needs to learn about SCJD.
I would not give a priority to each of these topics but instead I can suggest a few methods by which you can program better for scjd.
Regarding threads,
read these articles http://www.javaworld.com/javaworld/jw-09-1998/jw-09-threads_p.html
http://www.javaworld.com/javaworld/jw-10-1998/jw-10-toolbox.html
http://www.javaworld.com/javaworld/jw-11-1998/jw-11-toolbox-2.html
http://www.javaworld.com/javaworld/jw-11-1998/jw-11-toolbox-3.html
http://www.javaworld.com/javaworld/jw-12-1998/jw-12-toolbox-2.html
http://www.javaworld.com/javaworld/jw-02-1999/jw-02-toolbox-3.html
http://www.javaworld.com/javaworld/jw-03-1999/jw-03-toolbox-2.html
http://www.javaworld.com/javaworld/jw-04-1999/jw-04-toolbox.html
http://www.javaworld.com/javaworld/jw-05-1999/jw-05-toolbox.html
http://www.javaworld.com/javaworld/jw-06-1999/jw-06-toolbox2-2.html
About JButton
Now the most important thing I feel is in the use of swings. Lets say you make a button that internally makes an rmi call, this button will be depressed and you may not be cancel this operation, as Swing is not threadsafe unfortunately and it was made just for performance, look and speed. So you may have to use worker threads. the information on this can be sought for in any good thread programming book.
About JTable
to display the data is simple. But it would be useful if you can have a generic JTable that displays any kind of data based on the number of columns and rows. So this piece of code can be used for your future projects too
Javadoc is simple its not really difficult. Just try it and you will find its easy but make sure you implement them.
Read the instructions once too often and make sure you got the spec right. Join groups and share your ideas there also.
And if possible please read about Design Patterns in Java. There are 23 of them. You will find this really useful 2. Its available for free download from Cooper and from Bruce Eckel.
Hope this helps.
Best of Luck
Regards,
LioneL
[This message has been edited by Lionel PJ (edited January 24, 2001).]