• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SSLHandshakeException

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to test an example using RMI over SSL.

The example doesn't give me an error when I use LocateRegistry.createRegistry(<port> to start a registry in the application.
When I comment out the LocateRegistry and use the command line rmiregistry <port> I get this error when it tries to do Naming.bind(name, server);.




Thanks.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's because you're setting the SecureRMISocketFactory as the RMISocketFactory - it's probably assuming that *all* socket communication is going to be using SSL. If you start the registry outside the server, it's not going to be using this SocketFactory, so when your server tries to register with the registry, it uses an SSL socket, but gets a "regular" socket response from the registry.

It's possible to use the "regular" registry, but still use a custom socket factory between your client and server - the Using a Custom Socket Factory guide on Sun's site shows how.
 
Santh Narayanan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That worked and also understood the concept.
I really appreciate your answer.

Thanks Nathan,
 
Santh Narayanan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I start my server with the following code, which works perfect,
it doesn't give an exception if I run the main method in this class.

If I try to run the client, i get the error.

one thing I have noted, the NotSerializableException does not
occur with the Registry.rebind invocation is that you invoke rebind on
a registry reference returned from LocateRegistry.createRegistry

I this situation I am using rmiregistry command.


Error:

HelloClient exception: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.sun.ne
t.ssl.internal.ssl.SSLSocketFactoryImpl
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.sun.ne
t.ssl.internal.ssl.SSLSocketFactoryImpl
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at HelloClient.main(HelloClient.java:16)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.sun
.net.ssl.internal.ssl.SSLSocketFactoryImpl
at java.io.ObjectInputStream.readObject0(Unknown Source)
.......


I have listed all the remaining class.



Please let me know how can I fix this problem.
Thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It think the problem is that your SSLSocketFactory inside your RMISSLClientSocketFactory isn't serializable. You should mark that field as "transient" and restore the value inside a "readObject()" method.

For more information on how the transient keyword and readObject()/writeObject() works with Serializable objects - here's an article that covers it...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic