rmi and ssl - client socket factory NoClassDefFound Exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rmi and ssl - client socket factory NoClassDefFound Exception

ryan-116
Hello,

...still working on getting RMI and SSL completely sorted:

in ofbiz-containers.xml I have:

    <container name="rmi-dispatcher"
class="org.ofbiz.service.rmi.RmiServiceContainer">
        <property name="bound-name" value="RMIDispatcher"/>
        <property name="bound-host" value="127.0.0.1"/>
        <property name="bound-port" value="1099"/>
        <property name="delegator-name" value="default"/>
        <property name="client-factory"
value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
        <property name="server-factory"
value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
        <property name="ssl-keystore" value=".keystore"/><!-- this is
installed in the ${OFBIZ_HOME} dir-->
        <property name="ssl-keystore-type" value="JKS"/>
        <property name="ssl-keystore-pass" value="somegarbagepass"/>
        <property name="ssl-keystore-alias" value="ssl"/>
        <property name="ssl-client-auth" value="false"/>
    </container>

my client class is really simple (logging and extra exception handling
left out)

public class RMIDispatcher {

  public String endpoint="rmi://somehost:1099/RMIDispatcher";
  public RemoteDispatcher remoteDispatcher = null;
  public Map rmiResult= null;
  public String[] loginParams = {};

  public RMIDispatcher() throws Exception {
    try {
      RemoteDispatcher remoteDispatcher = (RemoteDispatcher)
Naming.lookup(endpoint);
    } catch (Exception e) {
      throw e;
    }
  }

  public Map dispatch(String method,String[] params) throws
RemoteException, GenericServiceException {
    rmiResult = remoteDispatcher.runSync(method, UtilMisc.toMap(params));
    return rmiResult;
  }
}

when invoking the dispatch() method, I get the following:
java.lang.NoClassDefFoundError
    at
org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory.createSocket(SSLClientSocketFactory.java:42)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
    at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
    at sun.rmi.transport.DGCImpl_Stub.clean(Unknown Source)
    at
sun.rmi.transport.DGCClient$EndpointEntry.makeCleanCalls(DGCClient.java:630)
    at
sun.rmi.transport.DGCClient$EndpointEntry.access$1700(DGCClient.java:144)
    at
sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:544)
    at java.lang.Thread.run(Thread.java:613)

which I think means that
org.ofbiz.base.util.SSLUtil.getSSLSocketFactory() is returning null.


So the question, why would that be? (argh - unfortunately, I haven't
been able to get the client-side debugger attached to the sources for
SSLUtil() hopefully its not obvious once I do that).

regards,
-Ryan
Reply | Threaded
Open this post in threaded view
|

Resolved: re: rmi and ssl - client socket factory NoClassDefFound Exception

ryan-116
Well, I figured it out - the NoClassDefFound was because I hadn't
specified the dependency on JDBM in the client. Subsequently I also
found some errors in my keystore.


ryan wrote:

> Hello,
>
> ...still working on getting RMI and SSL completely sorted:
>
> in ofbiz-containers.xml I have:
>
>    <container name="rmi-dispatcher"
> class="org.ofbiz.service.rmi.RmiServiceContainer">
>        <property name="bound-name" value="RMIDispatcher"/>
>        <property name="bound-host" value="127.0.0.1"/>
>        <property name="bound-port" value="1099"/>
>        <property name="delegator-name" value="default"/>
>        <property name="client-factory"
> value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
>        <property name="server-factory"
> value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
>        <property name="ssl-keystore" value=".keystore"/><!-- this is
> installed in the ${OFBIZ_HOME} dir-->
>        <property name="ssl-keystore-type" value="JKS"/>
>        <property name="ssl-keystore-pass" value="somegarbagepass"/>
>        <property name="ssl-keystore-alias" value="ssl"/>
>        <property name="ssl-client-auth" value="false"/>
>    </container>
>
> my client class is really simple (logging and extra exception handling
> left out)
>
> public class RMIDispatcher {
>
>  public String endpoint="rmi://somehost:1099/RMIDispatcher";
>  public RemoteDispatcher remoteDispatcher = null;
>  public Map rmiResult= null;
>  public String[] loginParams = {};
>
>  public RMIDispatcher() throws Exception {
>    try {
>      RemoteDispatcher remoteDispatcher = (RemoteDispatcher)
> Naming.lookup(endpoint);
>    } catch (Exception e) {
>      throw e;
>    }
>  }
>
>  public Map dispatch(String method,String[] params) throws
> RemoteException, GenericServiceException {
>    rmiResult = remoteDispatcher.runSync(method, UtilMisc.toMap(params));
>    return rmiResult;
>  }
> }
>
> when invoking the dispatch() method, I get the following:
> java.lang.NoClassDefFoundError
>    at
> org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory.createSocket(SSLClientSocketFactory.java:42)
>
>    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
>    at
> sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
>    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
>    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
>    at sun.rmi.transport.DGCImpl_Stub.clean(Unknown Source)
>    at
> sun.rmi.transport.DGCClient$EndpointEntry.makeCleanCalls(DGCClient.java:630)
>
>    at
> sun.rmi.transport.DGCClient$EndpointEntry.access$1700(DGCClient.java:144)
>    at
> sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:544)
>
>    at java.lang.Thread.run(Thread.java:613)
>
> which I think means that
> org.ofbiz.base.util.SSLUtil.getSSLSocketFactory() is returning null.
>
>
> So the question, why would that be? (argh - unfortunately, I haven't
> been able to get the client-side debugger attached to the sources for
> SSLUtil() hopefully its not obvious once I do that).
>
> regards,
> -Ryan