Re: java.rmi.UnmarshalException
liang li <[email protected]> Thu, 15 May 2008 13:20:22 +0800
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
thanks Gregg, i succeed to export my service . before i saw many examples which only show how to provide services with the thing the proxy is the server thank you again. best regards byron lee 2008/5/14, Gregg Wonderly <[email protected]>: > > liang li wrote: > >> thanks gregg. >> i will show your more detail: >> > > private void initializeJoinManager() >> { >> try >> { >> Log4JiniImpl impl = new Log4JiniImpl(); >> >> LookupDiscoveryManager manager = new LookupDiscoveryManager( >> initialMemberGroups, null, null); >> >> >> JoinManager joinManager = new JoinManager(impl, null, >> (Log4JiniImpl) impl, manager, null); >> > > Here you are passing the join manager a non-exported object that is > serializable. So, that class must be present in the -dl.jar that you have > specified in your codebase. I am not sure, but I believe that you actually > want to use an Exporter here, and if you do that, and use the > BasicJeriExporter, you do not need to perform any RMIC operations because > the _stub equivalent information is automatically generated by the exporter > and provided to the remote client. > > So, my recommendation is to remove the Serializable declaration from > Log4JiniImpl, and then replace your initializeJoinManager() method with the > following code. > > private volatile Exporter exp; > private volatile Remote svcObj; > private volatile Log4JiniImpl impl; > private void initializeJoinManager() { > try { > impl = new Log4JiniImpl(); > > LookupDiscoveryManager manager = new LookupDiscoveryManager( > initialMemberGroups, null, null); > > // Get the exporter from config, but provide a default > exp = config.getEntry( COMPONENT, "exporter", > Exporter.class, new BasicJeriExporter( > TcpServerEndpoint.getInstance(0), > new BasicILFactory() ) ); > > // export the service > svcObj = exp.export( impl ); > > JoinManager joinManager = new JoinManager( svcObj, null, > (Log4JiniImpl) impl, manager, null); > } catch ( IOException ex ) { > log.log( Level.SEVERE, ex.toString(), ex ); > } > } > > That will get you an exported service who's remote clients will only depend > on the interface, and the types specified by the methods in that interface's > declaration. > > All of these things are in the Jini documentation, and through Dan's > plethora of information linked to from his website and from the > http://jini.dev.java.net web site as well as http://www.jini.org. > > Gregg Wonderly > -------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to [email protected]