I have a machine running the JINI services and help tools (the web server serving requests from the lib dir in the JINI installation directory, rmid, reggie, mahalo) and a JavaSpace. They all start OK, but running the following peace of code that writes a simple Entry into the JavaSpace under a (non-null) transaction results in a request to the web server for
com/sun/jini/mahalo/TxnManagerImpl_Stub.class
which the web server cannot satisfy, since the file is into a jar. If I add manually the file into the lib directory, the requester finds it, but asks for
/com/sun/jini/mahalo/TxnManager.class
. The important parts of the code I am trying to run are:
TransactionManager mgr = null;
entries = new Entry[]{ new Name("TransactionManager") };
mgr = (TransactionManager)registrar.lookup(new ServiceTemplate(null,null,entries));
System.out.println("Manager: "+mgr);
Entry exemplu1 = new ExempluEntry("Message1");
ExempluEntry template = new ExempluEntry();
Entry result = null;
Transaction.Created trc = null;
Transaction txn = null;
try {
trc = TransactionFactory.create(mgr, 300000);
System.out.println("Transaction created " + trc);
txn = trc.transaction;
System.out.println("Transaction " + txn);
} catch (Exception e) {
System.err.println("Could not create transaction " + e);
}
try{
System.out.println("Writing the first Entry");
space.write(exemplu1, txn, Lease.FOREVER);
System.out.println("Writing the second Entry")
...
}
catch (Exception ex) {
System.out.println("Exception: "+ex);
}
The output is:
Manager: com.sun.jini.mahalo.TxnManagerImpl_Stub[RemoteStub [ref: sun.rmi.server.UnicastRef2@2c7568]] Transaction created net.jini.core.transaction.Transaction$Created@849bc Transaction net.jini.core.transaction.server.ServerTransaction@2751fc8c Writing the first Entry. Exception: java.rmi.ServerException: RemoteException occured in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnManagerImpl_Stub
Everything is OK if I use null as the transaction parameter for the write method. Plus, it seems that the client sees the TxnManagerImpl_Stub.class after retreiving it from the ServiceRegistrar.
When I start the JINI services and tools I think they have all the necessary classes and packages they need...