e're now ready to run the test client, but first a word
of explanation.
InterestHome for example, it needs to know about this class. This
means that you will need the Bean class files on both the client and the server
even though they execute on the server. This is fairly obvious if you think
about the logic, but it causes all sorts of problems for people who are new to
RMI programming. If the client can't find the Bean classes, you will get error
messages like this:
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: com.web_tomorrow.interest.InterestHome]A `communication exception' is the exception that represents any error that can't readily be ascribed to a definite cause. If you get this message you need to pay attention to the CLASSPATH on the client.
java -classpath $$CLASSPATH:\ /usr/lib/jboss/lib/ext/ejb.jar:/usr/lib/jboss/client/jboss-client.jar \ InterestClientOnce again, this needs to go in a shell script or a Makefile; you won't want to type it more than once.
Got context Got reference Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023The Bean should produce an output on the server as well; this is to show that the Bean has executed on the server, not the client. Look for something like this in the server log:
[Interest] Someone called `calculateCompoundInterest!'Well, that's it. We covered coding, compiling and deploying the Bean, and coding and running a simple test client. If you found this article useful, drop me a line at k.boone@web-tomorrow.com; if there's enough response I may be persuaded to produce some more sophisticated tutorials.
Kevin Boone, June 2000
©1994-2003 Kevin Boone, all rights reserved