Re: ClassNotFound problem
Niclas Hedhman <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Organization | Private |
| Message-ID | <[email protected]> |
On Wednesday 08 December 2004 13:37, [email protected] wrote: > HI Niclas, > > Yeah, you are right. The class is being used since I am passing it over. I > cannot export the object however because it contains non serializable > attributes. The third option is ruled out already. Can you give me some > idea about how to use dynamic class loading as stated by you in point 2. Serializable has nothing to do with exporting. Exporting is about keeping the object on the server side and each calll is is done over the wire. Serializing is about making a copy of the object and transferring it to the client. If the object is referring to non-Serializable classes you must provide your own readObject/writeObject (and I would recommend that they are always used). Dynamic classloading; 1. A SecurityManager must be present; if( System.getSecurityManager() == null ) System.setSecurityManager( new SecurityManager() ); 2. You need to ensure that the codebase of the classes used are locatable by the client. This is either done by classloader management in your server application in such a away that globally unique URLs (http:// for instance) are used, OR since you probably don't know what that means and using file based classpath entries from command-line, you need to set the system property java.rmi.server.codebase= a location where those Jars can be found by the client. Cheers Niclas -- +------//-------------------+ / http://www.dpml.net / / http://niclas.hedhman.org / +------//-------------------+ =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html