• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

question about the 1st example in HF EJB

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic