• Post Reply Bookmark Topic Watch Topic
  • New Topic

toString() in EJB

 
dar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all.
I need to invoke in a client EJB's toString() method.
I have implementation in my ejb-implementation class:
public String toString(){
return new String(" User id =" + m_id +"; ");
}
and in the remote interface
public java.lang.String toString() throws RemoteException;
But I got this error message:
... method toString() in interface userEntity cannot override method toString() in class java.lang.Object, overridden method does not throw java.rmi.RemoteException at line 12, column 27
How can I do (implement) toString() method in my EJB.
Please, help me.
Thank You.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you really need to implement toString() type functionality, then you'll need to name the method differently from toString() because the throws clause is different.
Out of interest, why do you want a client to be able to call toString() on your EJB?
Simon
 
dar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You, Simon, for your answer.
Why do I want a client to be able to call toString() on my EJB?
Because, I can't (don't know) how to trace/debug from my client (it's servlet).
I need to find out which EJB instance is actual used in servlet.

Originally posted by Simon Brown:
If you really need to implement toString() type functionality, then you'll need to name the method differently from toString() because the throws clause is different.
Out of interest, why do you want a client to be able to call toString() on your EJB?
Simon

[ April 22, 2002: Message edited by: dajac chison ]
[ April 22, 2002: Message edited by: dajac chison ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!