Re: jini 2.1 examples

Gregg Wonderly <[email protected]> Tue, 10 Jun 2008 11:04:25 -0500
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
Bulzan Stefan wrote:
> Thank you for your help,
> 
> I recognize that getting the reference to TransactionManager was a obvious
> thing. I did it, I got my Transaction that I needed but when I want to use
> it in writing an object (write(entry, txn, ..) ) it gives me this error:

The stack trace below shows that a "take" call is in progress, not a "write". 
ClassNotFoundException in Jini, in general, indicates that either the web server 
providing access to the codebase jars is not running, or the codebase URLs are 
not properly specified to allow services and clients to download the code needed 
to resolve the named class.

The code at

 > 	at worker.GenericWorker.run(GenericWorker.java:50)

looks like the point where the call originates.  What does this code do, and 
what thread is it running in?  It might be that you simply need to set the 
context class loader for that thread, as in

	public void run() {
		ClassLoader ld = Thread.currentThread().getContextClassLoader();
		try {
			// Using the current classes class loader as the
			// context classloader is usually the right answer
			// in clients.  You may need to do something different
			// for your application, so show us what you are doing
			// with worker.GenericWorker
			Thread.currentThread().setContextClassLoader(
				getClass().getClassLoader() );
			// worker.GenericWorker.run() code here
		} finally {
			Thread.currentThread().setContextClassLoader( ld );
		}
	}

Gregg Wonderly

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html