Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about the 1st example in HF EJB

 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first example in HF EJB (AdviceBean, Advice, AdviceHome) ---

I run the code and deployed it to the RI server following Kathy's instruction (pg 29 -- pg 57). Here are my 2 basic questions ---

1. In order to run the Client, we need to add the "AdviceAppClient.jar" in the classpath. However, as I know, the client can be any standalone java application residing on any machine. If we always require the client side to include this server generated JAR file, it is impossible. So, I am wondering how it should work for a standalone client ?

2. I opened one console window, everytime I type "java -cp ... AdviceClient"
it always returns me with the same advice message. I don't know why ? It seems the AdviceBean is supposed to use a random number to pick an advice, why do I always get the same random number on this console window ?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. "Client" is a loose term here. The code interacting with the stubs will still usually be on the server. For instance, in web applications (http/html), the client isn't directly calling any java methods. All the client does is submit and get html forms. In any multi-tiered architecture, the real client doesn't even know that the backend is using EJBs at all, nor does it care.

2. This reminds me of dealing with pseudorandom numbers in VB. I had to use the current time to offset the number. I think the Java api's Math.random and Random do this for you, so it surprises me that you are getting the same one each time. Maybe Advice Guy is trying to tell you something!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic