• Post Reply Bookmark Topic Watch Topic
  • New Topic

MZ guide example  RSS feed

 
vitesse wei
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any one has been followed Mikalai Zaikin's SCBCD 5 study guide,appendix D,I encounter a error while I run the client.
according guide,result should be like this
4 + 3 = 7.0
4 - 3 = 1.0
4 * 3 = 12.0
4 / 3 = 1.3333333333333333
6 * 3 = 18.0
7 / 3 = 2.3333333333333335
History before cleanup:
[
2006-11-15 13:32:52.159 : 7.0 divide 3.0 is 2.3333333333333335,
2006-11-15 13:32:52.143 : 6.0 multiply 3.0 is 18.0,
2006-11-15 13:32:52.143 : 4.0 divide 3.0 is 1.3333333333333333,
2006-11-15 13:32:52.127 : 4.0 multiply 3.0 is 12.0,
2006-11-15 13:32:52.112 : 4.0 subtract 3.0 is 1.0]
History after cleanup:
[]

but when i run I get this:
4 + 3 = 7.0
4 - 3 = 1.0
4 * 3 = 12.0
4 / 3 = 1.3333333333333333
6 * 3 = 18.0
7 / 3 = 2.3333333333333335
History before cleanup:
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy0.getHistory(Unknown Source)
at by.iba.client.PersistentCalculatorClient.main(PersistentCalculatorClient.java:30)
Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
java.io.EOFException....


my persistentCalculatorClient.java is like this:
package by.iba.client;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import by.iba.ejb.PersistentCalculator;

public class PersistentCalculatorClient {

/**
* @param args
*/
public static void main(String[] args) {
try {
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("PersistentCalculatorBean/remote");
PersistentCalculator calc = (PersistentCalculator) PortableRemoteObject
.narrow(ref, PersistentCalculator.class);

System.out.println("4 + 3 = " + calc.add(4, 3));
System.out.println("4 - 3 = " + calc.subtract(4, 3));
System.out.println("4 * 3 = " + calc.multiply(4, 3));
System.out.println("4 / 3 = " + calc.divide(4, 3));
System.out.println("6 * 3 = " + calc.multiply(6, 3));
System.out.println("7 / 3 = " + calc.divide(7, 3));

System.out.println(" History before cleanup:");
System.out.println(calc.getHistory());

calc.clearHistory();

System.out.println(" History after cleanup:");
System.out.println(calc.getHistory());

} catch (NamingException ne) {
ne.printStackTrace();
}

}

}

it sames like problem cause by "calc.getHistory()",but I don't know how to fix it.and by checking byHSQL database manager,table and data is already there.anyone have same experience and any ideas,please help!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!