"Rahman, Zahid" wrote:
>
>  Class      HelloWorldBean
>  method    String Hello(){ .....}
>
> Interface          HelloWorldHome
> only method     create();
>
> Using the above client code in my JSP I get an error to the effect  that
> HelloWorldHome interface doesn't have a hello method.
> which I agree with because it doesn't. However can you tell me how I can
> call the hello method and more importantly how can
> I get an instance of HelloWorld  class without  calling the create or finder
> method of the HelloWorldHome first.

First, as someone else mentioned, the method in your bean class should
be Hello(String) and not Hello().

Second, your client needs a reference of type HelloWorld, upon which to
call the Hello(String) method. The only way to do that is to call the
create method. So your client code needs to look like this:

> HelloWorldHome helloworld = (HelloWorldHome)PortableRemoteObject.narrow
>     (objref,HelloWorldHome.class);
>     //NOT THIS: Output = helloworld.hello(Input);
    HelloWorld hw = helloworld.create(); //create reference of type
HelloWorld (remote interface)
                                         //the actual object is the stub
class
    Output = hw.Hello(Input);

The home interface returns a reference to the stub object. When you call
the Hello(String) method, the stub calls the skeleton, the call is
passed to the container, which then calls the HelloWorldBean class
Hello(String) method. That is why the Hello method in the bean needs to
have the same signature as the HelloWorldRemote interface.

client -> stub (through reference of type remote interface) ->
  over network -> skeleton -> EJB container -> EJB

You clearly do not understand the concepts involved in EJBs. You should
find an online tutorial or reference and try to understand the concepts
behind EJBs. Try some of these links:

http://theserverside.com/resources/book.jsp
http://theserverside.com/
http://java.sun.com/products/ejb/faq.html
http://java.sun.com/products/ejb/training.html

K Mukhar

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to